Module dpmod: Change committed
havoc at icculus.org
havoc at icculus.org
Sat Jul 12 06:03:05 EDT 2003
Commiter : havoc
CVSROOT : /cvs/cvsroot/twilight
Module : dpmod
Commit time: 2003-07-12 10:03:05 UTC
Log message:
inventory... changed...
Modified files:
qc/client.qc qc/domination.qc qc/havocbot_roles.qc
qc/inventory.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/mode_management.qc qc/modedefs.qc qc/player.qc
qc/w_dbshotgun.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
------=MIME.ac6f4f3d0c8175841318c1ec483c5ed3
Content-Type: text/plain; name="dpmod.20030712.100305.havoc.diff"
Content-Disposition: attachment; filename="dpmod.20030712.100305.havoc.diff"
Content-Transfer-Encoding: 8bit
Index: dpmod/qc/client.qc
diff -u dpmod/qc/client.qc:1.7 dpmod/qc/client.qc:1.8
--- dpmod/qc/client.qc:1.7 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/client.qc Sat Jul 12 06:02:55 2003
@@ -162,13 +162,13 @@
parm1 = self.items;
parm2 = self.health;
parm3 = self.armorvalue;
- parm4 = ItemQuantity(self, "shells");
- parm5 = ItemQuantity(self, "nails");
- parm6 = ItemQuantity(self, "rockets");
- parm7 = ItemQuantity(self, "cells");
+ parm4 = Inventory_Quantity(self, "shells");
+ parm5 = Inventory_Quantity(self, "nails");
+ parm6 = Inventory_Quantity(self, "rockets");
+ parm7 = Inventory_Quantity(self, "cells");
parm8 = self.weapon;
parm9 = self.armortype * 100;
- parm10 = ItemQuantity(self, "xshells");
+ parm10 = Inventory_Quantity(self, "xshells");
};
void() DecodeLevelParms =
@@ -182,11 +182,11 @@
self.armortype = 0.8;
self.armorvalue = 200;
// 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);
+ Inventory_SetQuantity(self, "shells", 9999999);
+ Inventory_SetQuantity(self, "nails", 9999999);
+ Inventory_SetQuantity(self, "rockets", 9999999);
+ Inventory_SetQuantity(self, "cells", 9999999);
+ Inventory_SetQuantity(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;
- 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);
+ Inventory_SetQuantity(self, "shells", STARTDM_AMMO_SHELLS);
+ Inventory_SetQuantity(self, "nails", STARTDM_AMMO_NAILS);
+ Inventory_SetQuantity(self, "rockets", STARTDM_AMMO_ROCKETS);
+ Inventory_SetQuantity(self, "cells", STARTDM_AMMO_CELLS);
+ Inventory_SetQuantity(self, "xshells", STARTDM_AMMO_XSHELLS);
self.weapon = W_BestWeapon(TRUE);
}
else // singleplayer or coop
@@ -214,13 +214,13 @@
if (self.health < 1)
self.health = 1;
self.armorvalue = parm3;
- ItemSetQuantity(self, "shells", parm4);
- ItemSetQuantity(self, "nails", parm5);
- ItemSetQuantity(self, "rockets", parm6);
- ItemSetQuantity(self, "cells", parm7);
+ Inventory_SetQuantity(self, "shells", parm4);
+ Inventory_SetQuantity(self, "nails", parm5);
+ Inventory_SetQuantity(self, "rockets", parm6);
+ Inventory_SetQuantity(self, "cells", parm7);
self.weapon = parm8;
self.armortype = parm9 / 100;
- ItemSetQuantity(self, "xshells", parm10);
+ Inventory_SetQuantity(self, "xshells", parm10);
}
self.bodyhealth = self.health + 100;
if ((self.items & self.weapon) == 0)
@@ -851,11 +851,11 @@
self.classname = "player";
self.health = 999;
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);
+ Inventory_SetQuantity(self, "shells", 0);
+ Inventory_SetQuantity(self, "nails", 0);
+ Inventory_SetQuantity(self, "rockets", 0);
+ Inventory_SetQuantity(self, "cells", 0);
+ Inventory_SetQuantity(self, "xshells", 0);
self.items = 0;
self.think = SUB_Null;
self.nextthink = 0;
@@ -1166,11 +1166,11 @@
if (cvar("temp1") & 4096)
{
- 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);
+ Inventory_SetQuantity(self, "shells", AMMOMAX_SHELLS);
+ Inventory_SetQuantity(self, "nails", AMMOMAX_NAILS);
+ Inventory_SetQuantity(self, "rockets", AMMOMAX_ROCKETS);
+ Inventory_SetQuantity(self, "cells", AMMOMAX_CELLS);
+ Inventory_SetQuantity(self, "xshells", AMMOMAX_XSHELLS);
}
if (intermission_running)
Index: dpmod/qc/domination.qc
diff -u dpmod/qc/domination.qc:1.1.1.1 dpmod/qc/domination.qc:1.2
--- dpmod/qc/domination.qc:1.1.1.1 Thu Sep 19 15:08:25 2002
+++ dpmod/qc/domination.qc Sat Jul 12 06:02:55 2003
@@ -1,55 +1,172 @@
+/*
+Domination as a plugin for netquake mods
+by LordHavoc (havoc at telefragged.com)
+
+How to add domination points to a mod:
+1. Add this line to progs.src above world.qc:
+domination.qc
+2. Comment out all lines in ClientObituary (in client.qc) that begin with targ.frags or attacker.frags.
+Optional (if you want dom points in id1 maps):
+3. Add this line to the end of worldspawn (in world.qc):
+dom_spawnpointsformap();
+
+Note: The only teams who can use dom control points are identified by dom_team_a_teamcolor and dom_team_b_teamcolor (typically red and blue).
+*/
+
+float dom_team_none_modelindex;
+float dom_team_none_skin;
+float dom_team_none_name;
+float dom_team_none_teamcolor = 0;
+float dom_team_a_modelindex;
+float dom_team_a_skin;
+float dom_team_a_name;
+float dom_team_a_color = 4; // red
+float dom_team_b_modelindex;
+float dom_team_b_skin;
+float dom_team_b_name;
+float dom_team_b_color = 13; // blue
+
+string(float t) dom_teamname_for_colorteam =
+{
+ t = t - 1;
+ if (t == dom_team_a_teamcolor)
+ return dom_team_a_name;
+ else if (t == dom_team_b_teamcolor)
+ return dom_team_b_name;
+ else
+ return dom_team_none_name;
+};
+
void() dompointthink =
{
- self.nextthink = time + 3;
- if (!self.team)
- return;
- head = findchain(head, classname, "player");
- while (head)
- {
- if (head.team == self.team)
- head.frags = head.frags + 1;
- head = head.chain;
- }
+ self.nextthink = time + 3;
+ if (!self.team)
+ return;
+ head = find(head, classname, "player");
+ while (head)
+ {
+ if (head.team == self.team)
+ head.frags = head.frags + 1;
+ head = find(head, classname, "player");
+ }
};
void() dompointtouch =
+{
+ if (other.team == self.team)
+ return;
+ if (other.classname != "player")
+ return;
+ if (other.health < 1)
+ return;
+ // only red and blue can claim it
+ s = dom_teamname_for_colorteam(other.team);
+ if (s == "none")
+ return;
+
+ self.team = other.team;
+
+ bprint(self.message);
+ bprint("\n");
+
+ if (self.noise != "")
+ sound(self, CHAN_BODY, self.noise, 1, ATTN_NORM);
+ if (self.noise1 != "")
+ sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NONE);
+};
+
+/*QUAKED dom_team (0 .5 .8) (-16 -16 -24) (16 16 32)
+Team declaration for Domination gameplay, this allows you to decide what team
+names and control point models are used in your map.
+
+Note: If you use dom_team entities you must define at least 3 and only two
+can have netname set! The nameless team owns all control points at start.
+
+Keys:
+"netname"
+ Name of the team (for example Red, Blue, Green, Yellow, Life, Death, etc)
+"cnt"
+ Scoreboard color of the team (for example 4 is red and 13 is blue)
+"model"
+ Model to use for control points owned by this team (for example
+ "progs/b_g_key.mdl" is a gold keycard, and "progs/b_s_key.mdl" is a silver
+ keycard)
+"skin"
+ Skin of the model to use (for team skins on a single model)
+"noise"
+ Sound to play when this team captures a point.
+ (this is a localized sound, like a small alarm or other effect)
+"noise1"
+ Narrator speech to play when this team captures a point.
+ (this is a global sound, like "Red team has captured a control point")
+"message"
+ Message to show when a team captures a point
+ (for example "Red team has captured a control point", or
+ "The forces of light have captured a mana well")
+*/
+
+void(string teamname, float teamcolor, string pointmodel, float pointskin) dom_spawnteam =
{
- if (other.team == self.team)
- return;
- if (other.classname != "player")
- return;
- if (other.health < 1)
- return;
- s = colorname(other.team - 1);
- bprint(s);
- bprint(" player ");
- bprint(other.netname);
- bprint(" captured a ");
- if (self.team)
- {
- s = colorname(self.team - 1);
- bprint(s);
- }
- else
- bprint("new");
- bprint(" control point\n");
- self.team = other.team;
+ precachemodel(pointmodel);
+ newmis = spawn();
+ newmis.classname = "dom_team";
+ newmis.netname = teamname;
+ newmis.team = teamcolor + 1;
+ newmis.skin = pointskin;
+ setmodel(newmis, pointmodel);
+ newmis.lefty = newmis.modelindex;
+ newmis.model = "";
+ newmis.modelindex = 0;
};
+void() dom_spawnteams =
+{
+ // LordHavoc: edit this if you want to change things
+ dom_spawnteam("Red", 4, "progs/b_g_key.mdl", 0);
+ dom_spawnteam("Blue", 13, "progs/b_s_key.mdl", 0);
+ dom_spawnteam("", 0, "progs/rune1.mdl", 0);
+};
+
+/*QUAKED dom_controlpoint (0 .5 .8) (-16 -16 -24) (16 16 32)
+Control point for Domination gameplay.
+*/
void() dom_controlpoint =
{
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_TRIGGER;
- setorigin(self, self.origin);
-
- setmodel(self, "progs/b_g_key.mdl");
- dom_redmodelindex = self.modelindex;
- setmodel(self, "progs/b_s_key.mdl");
- dom_bluemodelindex = self.modelindex;
- setmodel(self, "progs/rune1.mdl");
- self.owner = world;
- self.team = 0; // no team
+ head = find(world, classname, "dom_team");
+ if (head == world)
+ {
+ dom_spawnteams();
+ head = find(world, classname, "dom_team");
+ }
+ while(head && head.netname != "")
+ head = find(head, classname, "dom_team");
- self.
+ self.team = head.team + 1; // no team
+ self.netname = head.netname; // name for previous owner printing
+ self.model = head.mdl;
+ self.modelindex = head.lefty;
+ setsize(self, '-16 -16 -24', '16 16 32');
+ self.solid = SOLID_TRIGGER;
+ setorigin(self, self.origin);
};
+
+void(vector org) dom_spawnpoint =
+{
+ newmis = spawn();
+ newmis.classname = "dom_controlpoint";
+ newmis.think = dom_controlpoint;
+ newmis.nextthink = time;
+ setorigin(newmis, org);
+};
+
+void() dom_spawnpointsformap =
+{
+ /*
+ if (world.model == "maps/e1m1.bsp")
+ {
+ dom_spawnpoint('0 0 0');
+ }
+ */
+};
+
Index: dpmod/qc/havocbot_roles.qc
diff -u dpmod/qc/havocbot_roles.qc:1.3 dpmod/qc/havocbot_roles.qc:1.4
--- dpmod/qc/havocbot_roles.qc:1.3 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/havocbot_roles.qc Sat Jul 12 06:02:55 2003
@@ -354,7 +354,7 @@
*/
if (!self.havocbot_role_timeout)
self.havocbot_role_timeout = time + random() * 30 + 60;
- if (ItemQuantity(self, "rockets") < 15 || time > self.havocbot_role_timeout)
+ if (Inventory_Quantity(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 (ItemQuantity(self, "rockets") >= 25)
+ if (Inventory_Quantity(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 (ItemQuantity(self, "rockets") < 15 || time > self.havocbot_role_timeout)
+ if (Inventory_Quantity(self, "rockets") < 15 || time > self.havocbot_role_timeout)
{
bprint("changing role to middle\n");
self.havocbot_role = havocbot_role_ctf_middle;
Index: dpmod/qc/inventory.qc
diff -u dpmod/qc/inventory.qc:1.1 dpmod/qc/inventory.qc:1.2
--- dpmod/qc/inventory.qc:1.1 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/inventory.qc Sat Jul 12 06:02:55 2003
@@ -1,147 +1,785 @@
+void() Item_Touch;
+float(entity item, entity character) Item_GenericCanPickup;
+float(entity item, entity additem) Item_GenericAbsorbItem;
+
+entity(string name) ItemClass_Register;
+void() ItemClass_RegisterDefaultClasses;
+entity(string name) ItemClass_FindByName;
+
+entity(entity original) Item_Clone;
+entity(entity aitemclass) Item_Create;
+entity(string name) Item_CreateByName;
+void(entity item) Item_Destroy;
+entity(string name, float initialcount, vector org) Item_SpawnEasy;
+entity(entity item, float amount) Item_Split;
+float(entity item, float adjust) Item_AdjustQuantity;
+
+float(entity character) Inventory_GetBulk;
+float(entity character) Inventory_GetBulkLimit;
+entity(entity character, entity item) Inventory_GetNextItem;
+entity(entity character, string name) Inventory_ItemByName;
+void(entity character, entity item) Inventory_AttachItem;
+void(entity character, entity item) Inventory_DetachItem;
+float(entity character, entity giveitem) Inventory_AbsorbItem;
+void(entity character, entity item) Inventory_DropItem;
+void(entity character, entity item) Inventory_PickupItem;
+float(entity character, string name, float itemcount) Inventory_DropByName;
+float(entity character, string name, float itemcount) Inventory_DestroyByName;
+float(entity character, entity absorbcharacter) Inventory_AbsorbInventory;
+float(entity character, string name) Inventory_Quantity;
+float(entity character, string name, float adjust) Inventory_AdjustQuantity;
+float(entity character, string name, float n) Inventory_SetQuantity;
+entity(entity character, string name, float chooseempty) Inventory_ItemWithMostCapacity;
+entity(entity character, string name, float choosefull) Inventory_ItemWithLeastCapacity;
+entity(entity character, string name, float choosefull) Inventory_ItemWithMostQuantity;
+entity(entity character, string name, float chooseempty) Inventory_ItemWithLeastQuantity;
+
+void(entity character) updateammodisplay;
+
+.float bulkbase;
+.float bulkpercount;
+.float bulklimit;
.float count;
.float count1;
.entity inventory_next;
.entity inventory_prev;
+
+// the item class this item most closely fits
+.entity itemclass;
+
+// decides whether a character can pick up this item
+.float(entity item, entity character) it_canpickup;
+
+// absorbs quantity (count) from another item
+// deducts quantity absorbed from the item, but leaves item intact
+// returns amount absorbed
+// (often overriden by guns so that they can absorb ammo)
+.float(entity item, entity additem) it_absorbitem;
+
+void() Item_Touch =
+{
+ if (other.classname == "player")
+ if (other.health >= 1)
+ if (other.button8)
+ if (time > self.lefty)
+ if (self.it_canpickup(self, other))
+ Inventory_PickupItem(self, other);
+};
+
+float(entity item, entity character) Item_GenericCanPickup =
+{
+ return (item.bulkbase + item.bulkpercount * item.count <= character.bulklimit - Inventory_GetBulk(character));
+};
-entity(entity e, string name) ItemCreate =
+float(entity item, entity additem) Item_GenericAbsorbItem =
{
+ local float c;
+ c = 0;
+ if (item.itemclass == additem.itemclass)
+ {
+ c = Item_AdjustQuantity(item, additem.count);
+ additem.count = additem.count - c;
+ }
+ return c;
+};
+
+entity(string name) ItemClass_Register =
+{
local entity item;
item = spawn();
- item.classname = "playeritem";
+ item.classname = "playeritemclass";
+ item.itemclass = item;
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;
+ item.count = 1;
+ item.count1 = 1;
+ item.count2 = 1;
+ item.bulkbase = 0;
+ item.bulkpercount = 0;
+ item.touch = Item_Touch;
+ item.it_canpickup = Item_GenericCanPickup;
+ item.it_absorbitem = Item_GenericAbsorbItem;
+ item.noise1 = "weapons/lock4.wav";
+ item.noise2 = "weapons/lock4.wav";
+ item.mdl = item.model;
+ // invisible until ItemDrop is called
+ item.model = "";
return item;
};
-entity(entity e, string name) ItemByName =
+void() ItemClass_RegisterDefaultClasses =
{
local entity item;
- item = e.inventory_next;
+
+ item = ItemClass_Register("shells");
+ setmodel(item, "progs/backpack.mdl");
+ setsize(item, '-16 -16 -24', '16 16 8');
+ item.count1 = AMMOMAX_SHELLS;
+ //item.bulkbase = 0;
+ //item.bulkpercount = 0.1;
+
+ item = ItemClass_Register("nails");
+ setmodel(item, "progs/backpack.mdl");
+ setsize(item, '-16 -16 -24', '16 16 8');
+ item.count1 = AMMOMAX_NAILS;
+ //item.bulkbase = 0;
+ //item.bulkpercount = 0.05;
+
+ item = ItemClass_Register("rockets");
+ setmodel(item, "progs/backpack.mdl");
+ setsize(item, '-16 -16 -24', '16 16 8');
+ item.count1 = AMMOMAX_ROCKETS;
+ //item.bulkbase = 0;
+ //item.bulkpercount = 0.5;
+
+ item = ItemClass_Register("cells");
+ setmodel(item, "progs/backpack.mdl");
+ setsize(item, '-16 -16 -24', '16 16 8');
+ item.count1 = AMMOMAX_CELLS;
+ //item.bulkbase = 0;
+ //item.bulkpercount = 0.1;
+
+ item = ItemClass_Register("xshells");
+ setmodel(item, "progs/backpack.mdl");
+ setsize(item, '-16 -16 -24', '16 16 8');
+ item.count1 = AMMOMAX_XSHELLS;
+ //item.bulkbase = 0;
+ //item.bulkpercount = 0.1;
+};
+
+entity(string name) ItemClass_FindByName =
+{
+ local entity aitemclass;
+ aitemclass = findchain(classname, "playeritemclass");
+ if (aitemclass == world)
+ {
+ ItemClass_RegisterDefaultClasses();
+ aitemclass = findchain(classname, "playeritemclass");
+ }
+ while (aitemclass != world && aitemclass.netname != name)
+ aitemclass = aitemclass.chain;
+ return aitemclass;
+}
+
+entity(entity original) Item_Clone =
+{
+ local entity item;
+ if (original == world)
+ return world;
+
+ item = spawn();
+ item.classname = "playeritem";
+ item.owner = world;
+ item.itemclass = original.itemclass;
+ item.netname = original.netname;
+ item.count = original.count;
+ item.count1 = original.count1;
+ item.count2 = original.count2;
+ item.bulkbase = original.bulkbase;
+ item.bulkpercount = original.bulkpercount;
+ item.touch = original.touch;
+ item.it_canpickup = original.it_canpickup;
+ item.it_absorbitem = original.it_absorbitem;
+ item.noise1 = original.noise1;
+ item.noise2 = original.noise2;
+ setmodel(item, original.mdl);
+ setsize(item, original.mins, original.maxs);
+ setorigin(item, original.origin);
+ item.mdl = item.model;
+ return item;
+};
+
+entity(entity aitemclass) Item_Create =
+{
+ local entity item;
+ item = Item_Clone(aitemclass);
+ if (item != world)
+ {
+ // invisible until Item_Drop is called
+ item.model = "";
+ }
+ return item;
+};
+
+entity(string name) Item_CreateByName =
+{
+ return Item_Create(ItemClass_FindByName(name));
+};
+
+void(entity item) Item_Destroy =
+{
+ Inventory_DetachItem(item.owner, item);
+ remove(item);
+};
+
+entity(string name, float initialcount, vector org) Item_SpawnEasy =
+{
+ local entity item;
+ item = Item_CreateByName(name);
+ if (item == world)
+ return world;
+ item.count = initialcount;
+ item.velocity = '0 0 400' + randomvec() * 200;
+ item.angles = randompos('0 0 0', '0 360 0');
+ item.flags = 0;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ item.model = item.mdl;
+ setorigin(item, org);
+ return item;
+};
+
+entity(entity item, float amount) Item_Split =
+{
+ local entity newitem;
+ if (amount > item.count)
+ amount = item.count;
+ newitem = Item_Clone(item);
+ newitem.count = amount;
+ item.count = item.count - amount;
+ return newitem;
+};
+
+float(entity item, float adjust) Item_AdjustQuantity =
+{
+ local float c, c2;
+ if (adjust > 0)
+ {
+ // begin with remaining capacity
+ c = item.count1 - item.count;
+ // limit by adjust
+ if (c > adjust)
+ c = adjust;
+ // abort if we ran out
+ if (c <= 0)
+ return 0;
+ if (item.owner)
+ if (item.bulkpercount)
+ {
+ // limit by remaining bulk capacity
+ c2 = item.owner.bulklimit - Inventory_GetBulk(item.owner);
+ c2 = floor(c2 / item.bulkpercount);
+ if (c > c2)
+ c = c2;
+ }
+ // abort if we ran out
+ if (c <= 0)
+ return 0;
+ }
+ else if (adjust < 0)
+ {
+ c = 0 - item.count;
+ if (c < adjust)
+ c = adjust;
+ if (c >= 0)
+ return 0;
+ }
+ // add the calculated quantity to item
+ item.count = item.count + c;
+ // return amount of adjustment
+ return c;
+};
+
+float(entity character) Inventory_GetBulk =
+{
+ local float b;
+ local entity item;
+ b = 0;
+ item = character.inventory_next;
+ if (item == world)
+ item = character.inventory_next = character.inventory_prev = character;
+ while (item != character)
+ {
+ b = b + item.bulkbase + item.bulkpercount * item.count;
+ item = item.inventory_next;
+ }
+ return b;
+};
+
+float(entity character) Inventory_GetBulkLimit =
+{
+ return character.bulklimit;
+};
+
+entity(entity character, entity item) Inventory_GetNextItem =
+{
if (item == world)
- item = e.inventory_next = e.inventory_prev = e;
- while (item != e)
{
+ item = character.inventory_next;
+ if (item == world)
+ item = character.inventory_next = character.inventory_prev = character;
+ if (item == character)
+ item = world;
+ return item;
+ }
+ if (item.inventory_next == item.owner)
+ return world;
+ return item.inventory_next;
+};
+
+entity(entity character, string name) Inventory_ItemByName =
+{
+ local entity item;
+ item = character.inventory_next;
+ if (item == world)
+ item = character.inventory_next = character.inventory_prev = character;
+ while (item != character)
+ {
if (item.netname == name)
return item;
item = item.inventory_next;
}
return world;
};
+
+void(entity character, entity item) Inventory_AttachItem =
+{
+ Inventory_DetachItem(character, item);
+
+ item.movetype = MOVETYPE_NONE;
+ item.solid = SOLID_NOT;
+ item.model = "";
+ item.owner = character;
+ if (item.owner.inventory_next == world)
+ item.owner.inventory_next = item.owner.inventory_prev = item.owner;
+ 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;
+};
-float(entity e, string name) ItemMaxQuantity =
+void(entity character, entity item) Inventory_DetachItem =
{
+ if (item.inventory_next)
+ {
+ item.owner = world;
+ item.inventory_next.inventory_prev = item.inventory_prev;
+ item.inventory_prev.inventory_next = item.inventory_next;
+ item.inventory_next = world;
+ item.inventory_prev = world;
+ }
+};
+
+float(entity character, entity giveitem) Inventory_AbsorbItem =
+{
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;
+ local float c, total;
+ c = 0;
+ total = 0;
+ item = Inventory_GetNextItem(character, world);
+ while (item)
+ {
+ total = total + item.it_absorbitem(item, giveitem);
+ if (giveitem.count == 0)
+ {
+ // fully absorbed (giveitem empty)
+ return total;
+ }
+ if (item.itemclass == giveitem.itemclass)
+ c = c + 1;
+ item = Inventory_GetNextItem(character, item);
+ }
+ // some remains, check if we can spawn an item to hold it
+ //eprint(giveitem);
+ if (c < giveitem.itemclass.count2)
+ if (giveitem.bulkbase + giveitem.bulkpercount * giveitem.count <= character.bulklimit - Inventory_GetBulk(character))
+ {
+ // clone the giveitem and add it to inventory
+ item = Item_Clone(giveitem);
+ //eprint(item);
+ Inventory_AttachItem(character, item);
+ // the giveitem is now empty
+ total = total + giveitem.count;
+ giveitem.count = 0;
+ }
+ return total;
+};
+
+void(entity character, entity item) Inventory_DropItem =
+{
+ if (character == world)
+ {
+ bprint("Inventory_DropItem: character == world\n");
+ return;
+ }
+ Inventory_DetachItem(character, item);
+ item.velocity = character.velocity + '0 0 400' + randomvec() * 200;
+ item.angles = character.angles;
+ item.avelocity = character.avelocity;
+ item.flags = 0;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ item.model = item.mdl;
+ item.lefty = time + 0.1;
+ setorigin(item, character.origin);
+ sound(item, CHAN_BODY, item.noise2, 1, ATTN_STATIC);
+};
+
+void(entity character, entity item) Inventory_PickupItem =
+{
+ local string s;
+ local float c;
+ c = Inventory_AbsorbItem(character, item);
+ if (c)
+ {
+ sound(item, CHAN_BODY, item.noise1, 1, ATTN_STATIC);
+ if (character.flags & FL_CLIENT)
+ {
+ s = ftos(c);
+ sprint(character, "You got ");
+ sprint(character, s);
+ sprint(character, " ");
+ sprint(character, item.netname);
+ sprint(character, "\n");
+ }
+ if (item.count == 0)
+ Item_Destroy(item);
+ }
};
-float(entity e, string name) ItemQuantity =
+float(entity character, string name, float itemcount) Inventory_DropByName =
{
+ local float c;
local entity item;
- item = ItemByName(e, name);
- if (item)
- return item.count;
- /*
+ c = 0;
+ item = Inventory_GetNextItem(character, world);
+ while (item)
+ {
+ if (name == "" || item.netname == name)
+ {
+ Inventory_DropItem(character, item);
+ item = world;
+ c = c + 1;
+ if (c >= itemcount)
+ return c;
+ }
+ item = Inventory_GetNextItem(character, item);
+ }
+ return c;
+}
+
+float(entity character, string name, float itemcount) Inventory_DestroyByName =
+{
+ local float c;
+ local entity item;
+ c = 0;
+ item = Inventory_GetNextItem(character, world);
+ while (item)
+ {
+ if (name == "" || item.netname == name)
+ {
+ Item_Destroy(item);
+ item = world;
+ c = c + 1;
+ if (c >= itemcount)
+ return c;
+ }
+ item = Inventory_GetNextItem(character, item);
+ }
+ return c;
+}
+
+float(entity character, entity absorbcharacter) Inventory_AbsorbInventory =
+{
+ local float c;
+ local entity item;
+ c = 0;
+ item = Inventory_GetNextItem(absorbcharacter, world);
+ while (item)
+ {
+ Inventory_AbsorbItem(character, item);
+ if (item.count == 0)
+ {
+ Item_Destroy(item);
+ item = world;
+ c = c + 1;
+ }
+ item = Inventory_GetNextItem(absorbcharacter, item);
+ }
+ return c;
+}
+
+float(entity character, string name) Inventory_Quantity =
+{
+ local float c;
+ local entity item;
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;
+ return character.ammo_shells;
+ else if (name == "nails")
+ return character.ammo_nails;
+ else if (name == "rockets")
+ return character.ammo_rockets;
+ else if (name == "cells")
+ return character.ammo_cells;
+ else if (name == "xshells")
+ return character.ammo_xshells;
+ else
+ {
+ c = 0;
+ item = character.inventory_next;
+ if (item == world)
+ item = character.inventory_next = character.inventory_prev = character;
+ while (item != character)
+ {
+ if (item.netname == name)
+ c = c + item.count;
+ item = item.inventory_next;
+ }
+ return c;
+ }
};
-float(entity e, string name, float n) ItemAdjustQuantity =
+float(entity character, string name, float adjust) Inventory_AdjustQuantity =
{
- local entity item;
- item = ItemByName(e, name);
+ local entity item, aitemclass;
+ local float c, total;
+ if (name == "shells")
+ return character.ammo_shells = bound(0, character.ammo_shells + adjust, AMMOMAX_SHELLS);
+ else if (name == "nails")
+ return character.ammo_nails = bound(0, character.ammo_nails + adjust, AMMOMAX_NAILS);
+ else if (name == "rockets")
+ return character.ammo_rockets = bound(0, character.ammo_rockets + adjust, AMMOMAX_ROCKETS);
+ else if (name == "cells")
+ return character.ammo_cells = bound(0, character.ammo_cells + adjust, AMMOMAX_CELLS);
+ else if (name == "xshells")
+ return character.ammo_xshells = bound(0, character.ammo_xshells + adjust, AMMOMAX_XSHELLS);
+ else
+ {
+ c = 0;
+ total = adjust;
+ item = Inventory_GetNextItem(character, world);
+ while (item && adjust != 0)
+ {
+ if (item.itemclass.netname == name)
+ {
+ c = c + 1;
+ adjust = adjust - Item_AdjustQuantity(item, adjust);
+ if (item.count == 0)
+ {
+ Item_Destroy(item);
+ item = world;
+ c = 0;
+ }
+ }
+ item = Inventory_GetNextItem(character, item);
+ }
+ // some may remain, check if we can spawn an item to hold it
+ if (adjust > 0)
+ {
+ aitemclass = ItemClass_FindByName(name);
+ //eprint(aitemclass);
+ if (c < aitemclass.count2)
+ if (aitemclass.bulkbase + aitemclass.bulkpercount * adjust <= character.bulklimit - Inventory_GetBulk(character))
+ {
+ // create item and add it to inventory
+ item = Item_Create(aitemclass);
+ item.count = adjust;
+ adjust = 0;
+ //eprint(item);
+ Inventory_AttachItem(character, item);
+ }
+ }
+ total = total - adjust;
+ return total;
+ }
+};
+
+float(entity character, string name, float n) Inventory_SetQuantity =
+{
+ n = n - Inventory_Quantity(character, name);
+ return Inventory_AdjustQuantity(character, name, n);
+}
+
+entity(entity character, string name, float chooseempty) Inventory_ItemWithMostCapacity =
+{
+ local entity item, best;
+ local float capacity, bestcapacity;
+ item = character.inventory_next;
+ if (item == world)
+ item = character.inventory_next = character.inventory_prev = character;
+ best = world;
+ bestcapacity = 0;
+ while (item != character)
+ {
+ if (item.netname == name)
+ {
+ capacity = item.count1 - item.count;
+ if (capacity < item.count1 || chooseempty)
+ if (bestcapacity < capacity)
+ {
+ bestcapacity = capacity;
+ best = item;
+ }
+ }
+ item = item.inventory_next;
+ }
+ return best;
+};
+
+entity(entity character, string name, float choosefull) Inventory_ItemWithLeastCapacity =
+{
+ local entity item, best;
+ local float capacity, bestcapacity;
+ item = character.inventory_next;
+ if (item == world)
+ item = character.inventory_next = character.inventory_prev = character;
+ best = world;
+ bestcapacity = 1000000000;
+ while (item != character)
+ {
+ if (item.netname == name)
+ {
+ capacity = item.count1 - item.count;
+ if (capacity > 0 || choosefull)
+ if (bestcapacity > capacity)
+ {
+ bestcapacity = capacity;
+ best = item;
+ }
+ }
+ item = item.inventory_next;
+ }
+ return best;
+};
+
+entity(entity character, string name, float choosefull) Inventory_ItemWithMostQuantity =
+{
+ local entity item, best;
+ local float quantity, bestquantity;
+ item = character.inventory_next;
+ if (item == world)
+ item = character.inventory_next = character.inventory_prev = character;
+ best = world;
+ bestquantity = 0;
+ while (item != character)
+ {
+ if (item.netname == name)
+ {
+ quantity = item.count;
+ if (quantity < item.count1 || choosefull)
+ if (bestquantity < quantity)
+ {
+ bestquantity = quantity;
+ best = item;
+ }
+ }
+ item = item.inventory_next;
+ }
+ return best;
+};
+
+entity(entity character, string name, float chooseempty) Inventory_ItemWithLeastQuantity =
+{
+ local entity item, best;
+ local float quantity, bestquantity;
+ item = character.inventory_next;
if (item == world)
- item = ItemCreate(e, name);
- return (item.count = bound(0, item.count + n, item.count1));
+ item = character.inventory_next = character.inventory_prev = character;
+ best = world;
+ bestquantity = 0;
+ while (item != character)
+ {
+ if (item.netname == name)
+ {
+ quantity = item.count;
+ if (quantity > 0 || chooseempty)
+ if (bestquantity < quantity)
+ {
+ bestquantity = quantity;
+ best = item;
+ }
+ }
+ item = item.inventory_next;
+ }
+ return best;
+};
+
+/*
+float(entity character, string name, float n) Inventory_AdjustQuantityAllByName =
+{
+ local float c;
+ local entity item;
+ while (n > 0)
+ {
+ item = ItemWithLeastCapacity(character, name, FALSE);
+ if (item == world)
+ {
+ item = ItemCreate(GetItemClassByName(name));
+ if (item == world)
+ return 0;
+ ItemAttach(item, e);
+ }
+ c = item.count1 - item.count;
+ if (c > n)
+ c = n;
+ item.count = item.count + c;
+ n = n - c;
+ }
+ item = ItemWithLeastQuantity(character, name, FALSE);
+ while (item != world && n < 0)
+ {
+ c = 0 - item.count;
+ if (c < n)
+ c = n;
+ item.count = item.count + c;
+ n = n - c;
+ if (n)
+ item = ItemWithLeastQuantity(character, name, FALSE);
+ }
+ //if (!keepempty)
+ {
+ item = ItemWithLeastQuantity(character, name, TRUE);
+ while (item != world && item.count <= 0)
+ {
+ ItemDestroy(item);
+ item = ItemWithLeastQuantity(character, name, TRUE);
+ }
+ }
+ return Inventory_Quantity(character, name);
+*/
/*
if (name == "shells")
- return (e.ammo_shells = bound(0, e.ammo_shells + n, AMMOMAX_SHELLS));
+ return (character.ammo_shells = bound(0, character.ammo_shells + n, AMMOMAX_SHELLS));
if (name == "nails")
- return (e.ammo_nails = bound(0, e.ammo_nails + n, AMMOMAX_NAILS));
+ return (character.ammo_nails = bound(0, character.ammo_nails + n, AMMOMAX_NAILS));
if (name == "rockets")
- return (e.ammo_rockets = bound(0, e.ammo_rockets + n, AMMOMAX_ROCKETS));
+ return (character.ammo_rockets = bound(0, character.ammo_rockets + n, AMMOMAX_ROCKETS));
if (name == "cells")
- return (e.ammo_cells = bound(0, e.ammo_cells + n, AMMOMAX_CELLS));
+ return (character.ammo_cells = bound(0, character.ammo_cells + n, AMMOMAX_CELLS));
if (name == "xshells")
- return (e.ammo_xshells = bound(0, e.ammo_xshells + n, AMMOMAX_XSHELLS));
+ return (character.ammo_xshells = bound(0, character.ammo_xshells + n, AMMOMAX_XSHELLS));
*/
+/*
};
+*/
-float(entity e, string name, float n) ItemSetQuantity =
+/*
+float(entity character, string name, float n) Inventory_SetQuantity =
{
- local entity item;
- item = ItemByName(e, name);
- if (item == world)
- item = ItemCreate(e, name);
- return (item.count = bound(0, n, item.count1));
+ return Inventory_AdjustQuantityAllByName(character, name, n - Inventory_QuantityAllByName(character, name));
+*/
/*
if (name == "shells")
- return (e.ammo_shells = bound(0, n, AMMOMAX_SHELLS));
+ return (character.ammo_shells = bound(0, n, AMMOMAX_SHELLS));
if (name == "nails")
- return (e.ammo_nails = bound(0, n, AMMOMAX_NAILS));
+ return (character.ammo_nails = bound(0, n, AMMOMAX_NAILS));
if (name == "rockets")
- return (e.ammo_rockets = bound(0, n, AMMOMAX_ROCKETS));
+ return (character.ammo_rockets = bound(0, n, AMMOMAX_ROCKETS));
if (name == "cells")
- return (e.ammo_cells = bound(0, n, AMMOMAX_CELLS));
+ return (character.ammo_cells = bound(0, n, AMMOMAX_CELLS));
if (name == "xshells")
- return (e.ammo_xshells = bound(0, n, AMMOMAX_XSHELLS));
+ return (character.ammo_xshells = bound(0, n, AMMOMAX_XSHELLS));
*/
+/*
};
+*/
-float(entity e, float t, float a) full_ammo =
+void(entity character) updateammodisplay =
{
- 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");
+ character.ammo_shells = Inventory_Quantity(character, "shells");
+ character.ammo_nails = Inventory_Quantity(character, "nails");
+ character.ammo_rockets = Inventory_Quantity(character, "rockets");
+ character.ammo_cells = Inventory_Quantity(character, "cells");
};
Index: dpmod/qc/item_ammo.qc
diff -u dpmod/qc/item_ammo.qc:1.4 dpmod/qc/item_ammo.qc:1.5
--- dpmod/qc/item_ammo.qc:1.4 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/item_ammo.qc Sat Jul 12 06:02:55 2003
@@ -7,17 +7,21 @@
===============================================================================
*/
+.string ammo_typestring;
+
void() ammo_touch =
{
- local entity stemp;
- local float best;
- local float used;
+ local entity stemp;
+ local float best;
+ local float used;
+ local string s;
if (other.classname != "player")
return;
if (other.health < 1)
return;
- used = full_ammo(other, self.weapon, self.aflag);
+
+ used = Inventory_AdjustQuantity(other, self.ammo_typestring, self.aflag);
if (used < 1)
return;
@@ -27,12 +31,6 @@
best = W_BestWeapon(TRUE);
self = stemp;
- 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);
-
if (other.flags & FL_CLIENT)
{
// sprint (other, self.netname);
@@ -75,11 +73,11 @@
float WEAPON_BIG2 = 1;
-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;};
+float(entity player, entity item) item_shells_pickupeval = {if (Inventory_Quantity(player, "shells") < AMMOMAX_SHELLS) return (AMMOMAX_SHELLS - Inventory_Quantity(player, "shells")) * (AMMOMAX_SHELLS - Inventory_Quantity(player, "shells")) * item.dmg;else return 0;};
+float(entity player, entity item) item_nails_pickupeval = {if (Inventory_Quantity(player, "nails") < AMMOMAX_NAILS) return (AMMOMAX_NAILS - Inventory_Quantity(player, "nails")) * (AMMOMAX_NAILS - Inventory_Quantity(player, "nails")) * item.dmg;else return 0;};
+float(entity player, entity item) item_rockets_pickupeval = {if (Inventory_Quantity(player, "rockets") < AMMOMAX_ROCKETS) return (AMMOMAX_ROCKETS - Inventory_Quantity(player, "rockets")) * (AMMOMAX_ROCKETS - Inventory_Quantity(player, "rockets")) * item.dmg;else return 0;};
+float(entity player, entity item) item_cells_pickupeval = {if (Inventory_Quantity(player, "cells") < AMMOMAX_CELLS) return (AMMOMAX_CELLS - Inventory_Quantity(player, "cells")) * (AMMOMAX_CELLS - Inventory_Quantity(player, "cells")) * item.dmg;else return 0;};
+//float(entity player, entity item) item_xshells_pickupeval = {if (Inventory_Quantity(player, "xshells") < AMMOMAX_XSHELLS) return (AMMOMAX_XSHELLS - Inventory_Quantity(player, "xshells")) * (AMMOMAX_XSHELLS - Inventory_Quantity(player, "xshells")) * item.dmg;else return 0;};
/*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32)
*/
@@ -89,6 +87,7 @@
{
self.touch = ammo_touch;
+ self.ammo_typestring = "shells";
self.weapon = 1;
if (self.spawnflags & WEAPON_BIG2)
{
@@ -96,7 +95,7 @@
setmodel (self, "progs/a_shell2.mdl");
if (self.aflag < 1)
self.aflag = AMMO_SHELLS * 2;
- self.netname = "You got some shotgun buckshot shells\n";
+ self.netname = "You got some shotgun shells\n";
}
else
{
@@ -104,7 +103,7 @@
setmodel (self, "progs/a_shell1.mdl");
if (self.aflag < 1)
self.aflag = AMMO_SHELLS;
- self.netname = "You got some shotgun buckshot shells\n";
+ self.netname = "You got some shotgun shells\n";
}
setsize (self, '-16 -16 0', '16 16 8');
setorigin(self, self.origin + '16 16 0');
@@ -117,6 +116,7 @@
spawnxshells = spawnxshells + 1;
if (spawnxshells & 1)
{
+ self.ammo_typestring = "xshells";
self.weapon = 5;
self.netname = "You got some shotgun explosive slugs\n";
self.dmg = 110 * self.aflag / (AMMOMAX_XSHELLS * AMMOMAX_XSHELLS);
@@ -134,6 +134,7 @@
{
self.touch = ammo_touch;
+ self.ammo_typestring = "nails";
self.weapon = 2;
if (self.spawnflags & WEAPON_BIG2)
{
@@ -168,6 +169,7 @@
{
self.touch = ammo_touch;
+ self.ammo_typestring = "rockets";
self.weapon = 3;
if (self.spawnflags & WEAPON_BIG2)
{
@@ -202,6 +204,7 @@
{
self.touch = ammo_touch;
+ self.ammo_typestring = "cells";
self.weapon = 4;
if (self.spawnflags & WEAPON_BIG2)
{
Index: dpmod/qc/item_backpacks.qc
diff -u dpmod/qc/item_backpacks.qc:1.2 dpmod/qc/item_backpacks.qc:1.3
--- dpmod/qc/item_backpacks.qc:1.2 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/item_backpacks.qc Sat Jul 12 06:02:55 2003
@@ -11,7 +11,10 @@
self.nextthink = time;
// self.alpha = 1 - (time - self.cnt) * 4;
// if (self.alpha < 0.01)
+ {
+ Inventory_DestroyByName(self, "", 99999);
remove(self);
+ }
};
void() BackpackRemove =
@@ -27,15 +30,15 @@
void() BackpackTouch =
{
- local entity oself;
- local string s;
- local float best, old, new;
- local float acount, d;
+ local entity oself, item;
+ local string s;
+ local float best, old, new;
+ local float acount, d;
if (other.classname != "player")
- return;
+ return;
if (other.health < 1)
- return;
+ return;
oself = self;
acount = 0;
@@ -82,10 +85,10 @@
self = oself;
// add the ammo
- ItemAdjustQuantity(other, "shells", ItemQuantity(self, "shells"));
- ItemAdjustQuantity(other, "nails", ItemQuantity(self, "nails"));
- ItemAdjustQuantity(other, "rockets", ItemQuantity(self, "rockets"));
- ItemAdjustQuantity(other, "cells", ItemQuantity(self, "cells"));
+ //Inventory_AdjustQuantity(other, "shells", Inventory_Quantity(self, "shells"));
+ //Inventory_AdjustQuantity(other, "nails", Inventory_Quantity(self, "nails"));
+ //Inventory_AdjustQuantity(other, "rockets", Inventory_Quantity(self, "rockets"));
+ //Inventory_AdjustQuantity(other, "cells", Inventory_Quantity(self, "cells"));
if (self.super_damage_finished > time)
if (self.super_damage_finished > other.super_damage_finished)
{
@@ -114,42 +117,65 @@
if (other.flags & FL_CLIENT)
{
- if (ItemQuantity(self, "shells"))
+ item = Inventory_GetNextItem(self, world);
+ while (item)
{
+ d = Inventory_AbsorbItem(other, item);
+ if (d)
+ {
+ s = ftos(d);
+ if (acount)
+ sprint(other, ", ");
+ acount = 1;
+ sprint (other, s);
+ sprint (other, " ");
+ sprint (other, item.netname);
+ if (item.count == 0)
+ {
+ Item_Destroy(item);
+ item = world;
+ }
+ }
+ item = Inventory_GetNextItem(self, item);
+ }
+ /*
+ if (Inventory_Quantity(self, "shells"))
+ {
if (acount)
sprint(other, ", ");
acount = 1;
- s = ftos(ItemQuantity(self, "shells"));
+ s = ftos(Inventory_Quantity(self, "shells"));
sprint (other, s);
sprint (other, " shells");
}
- if (ItemQuantity(self, "nails"))
+ if (Inventory_Quantity(self, "nails"))
{
if (acount)
sprint(other, ", ");
acount = 1;
- s = ftos(ItemQuantity(self, "nails"));
+ s = ftos(Inventory_Quantity(self, "nails"));
sprint (other, s);
sprint (other, " rounds");
}
- if (ItemQuantity(self, "rockets"))
+ if (Inventory_Quantity(self, "rockets"))
{
if (acount)
sprint(other, ", ");
acount = 1;
- s = ftos(ItemQuantity(self, "rockets"));
+ s = ftos(Inventory_Quantity(self, "rockets"));
sprint (other, s);
sprint (other, " rockets");
}
- if (ItemQuantity(self, "cells"))
+ if (Inventory_Quantity(self, "cells"))
{
if (acount)
sprint(other, ", ");
acount = 1;
- s = ftos(ItemQuantity(self, "cells"));
+ s = ftos(Inventory_Quantity(self, "cells"));
sprint (other, s);
sprint (other, " cells");
}
+ */
if (self.super_damage_finished > time)
{
if (acount)
@@ -216,7 +242,11 @@
if (deathmatch == DM_FRAGFEST || deathmatch == DM_ELIM)
return;
- if (!(ItemQuantity(self, "shells") + ItemQuantity(self, "nails") + ItemQuantity(self, "rockets") + ItemQuantity(self, "cells")))
+
+ if (deathmatch == DM_RPG)
+ Inventory_DropByName(self, "", 99999);
+
+ if (!(Inventory_Quantity(self, "shells") + Inventory_Quantity(self, "nails") + Inventory_Quantity(self, "rockets") + Inventory_Quantity(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
@@ -250,14 +280,6 @@
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;
- 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;
@@ -303,14 +325,16 @@
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 + 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;
+ item.havocrating = item.havocrating + Inventory_Quantity(item, "shells") * 60;
+ item.havocrating = item.havocrating + Inventory_Quantity(item, "nails") * 15;
+ item.havocrating = item.havocrating + Inventory_Quantity(item, "rockets") * 120;
+ item.havocrating = item.havocrating + Inventory_Quantity(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);
*/
item.havocpickup = TRUE;
item.pickupevalfunc = item_backpack_pickupeval;
+
+ Inventory_AbsorbInventory(item, self);
};
Index: dpmod/qc/item_weapons.qc
diff -u dpmod/qc/item_weapons.qc:1.5 dpmod/qc/item_weapons.qc:1.6
--- dpmod/qc/item_weapons.qc:1.5 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/item_weapons.qc Sat Jul 12 06:02:55 2003
@@ -22,11 +22,11 @@
return;
new = self.weapon;
if (other.items & self.weapon == self.weapon) // has it already
- 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))
+ if ((Inventory_Quantity(other, "shells") >= AMMOMAX_SHELLS ) || (Inventory_Quantity(self, "shells") < 1))
+ if ((Inventory_Quantity(other, "nails") >= AMMOMAX_NAILS ) || (Inventory_Quantity(self, "nails") < 1))
+ if ((Inventory_Quantity(other, "rockets") >= AMMOMAX_ROCKETS) || (Inventory_Quantity(self, "rockets") < 1))
+ if ((Inventory_Quantity(other, "cells") >= AMMOMAX_CELLS ) || (Inventory_Quantity(self, "cells") < 1))
+ if ((Inventory_Quantity(other, "xshells") >= AMMOMAX_XSHELLS) || (Inventory_Quantity(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 (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);
+ if (Inventory_Quantity(self, "shells")) if (Inventory_Quantity(other, "shells") < Inventory_Quantity(self, "shells")) Inventory_SetQuantity(other, "shells", Inventory_Quantity(self, "shells")); else Inventory_AdjustQuantity(other, "shells", AMMOWEAPONOVERFLOW_SHELLS);
+ if (Inventory_Quantity(self, "nails")) if (Inventory_Quantity(other, "nails") < Inventory_Quantity(self, "nails")) Inventory_SetQuantity(other, "nails", Inventory_Quantity(self, "nails")); else Inventory_AdjustQuantity(other, "nails", AMMOWEAPONOVERFLOW_NAILS);
+ if (Inventory_Quantity(self, "rockets")) if (Inventory_Quantity(other, "rockets") < Inventory_Quantity(self, "rockets")) Inventory_SetQuantity(other, "rockets", Inventory_Quantity(self, "rockets")); else Inventory_AdjustQuantity(other, "rockets", AMMOWEAPONOVERFLOW_ROCKETS);
+ if (Inventory_Quantity(self, "cells")) if (Inventory_Quantity(other, "cells") < Inventory_Quantity(self, "cells")) Inventory_SetQuantity(other, "cells", Inventory_Quantity(self, "cells")); else Inventory_AdjustQuantity(other, "cells", AMMOWEAPONOVERFLOW_CELLS);
+ if (Inventory_Quantity(self, "xshells")) if (Inventory_Quantity(other, "xshells") < Inventory_Quantity(self, "xshells")) Inventory_SetQuantity(other, "xshells", Inventory_Quantity(self, "xshells")); else Inventory_AdjustQuantity(other, "xshells", AMMOWEAPONOVERFLOW_XSHELLS);
}
else
{
- 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"));
+ Inventory_AdjustQuantity(other, "shells", Inventory_Quantity(self, "shells"));
+ Inventory_AdjustQuantity(other, "nails", Inventory_Quantity(self, "nails"));
+ Inventory_AdjustQuantity(other, "rockets", Inventory_Quantity(self, "rockets"));
+ Inventory_AdjustQuantity(other, "cells", Inventory_Quantity(self, "cells"));
+ Inventory_AdjustQuantity(other, "xshells", Inventory_Quantity(self, "xshells"));
}
if (other.flags & FL_CLIENT)
@@ -106,21 +106,21 @@
if (w & IT_WEAPON9) f = f + 1000;
if (w & IT_WEAPON10) f = f + 3000;
}
- 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);
+ if (Inventory_Quantity(item, "shells"))
+ if (Inventory_Quantity(player, "shells") < AMMOMAX_SHELLS)
+ f = f + (AMMOMAX_SHELLS - Inventory_Quantity(player, "shells")) * (AMMOMAX_SHELLS - Inventory_Quantity(player, "shells")) * 60 * Inventory_Quantity(item, "shells") / (AMMOMAX_SHELLS * AMMOMAX_SHELLS);
+ if (Inventory_Quantity(item, "nails"))
+ if (Inventory_Quantity(player, "nails") < AMMOMAX_NAILS)
+ f = f + (AMMOMAX_NAILS - Inventory_Quantity(player, "nails")) * (AMMOMAX_NAILS - Inventory_Quantity(player, "nails")) * 15 * Inventory_Quantity(item, "nails") / (AMMOMAX_NAILS * AMMOMAX_NAILS);
+ if (Inventory_Quantity(item, "rockets"))
+ if (Inventory_Quantity(player, "rockets") < AMMOMAX_ROCKETS)
+ f = f + (AMMOMAX_ROCKETS - Inventory_Quantity(player, "rockets")) * (AMMOMAX_ROCKETS - Inventory_Quantity(player, "rockets")) * 120 * Inventory_Quantity(item, "rockets") / (AMMOMAX_ROCKETS * AMMOMAX_ROCKETS);
+ if (Inventory_Quantity(item, "cells"))
+ if (Inventory_Quantity(player, "cells") < AMMOMAX_CELLS)
+ f = f + (AMMOMAX_CELLS - Inventory_Quantity(player, "cells")) * (AMMOMAX_CELLS - Inventory_Quantity(player, "cells")) * 30 * Inventory_Quantity(item, "cells") / (AMMOMAX_CELLS * AMMOMAX_CELLS);
+ if (Inventory_Quantity(item, "xshells"))
+ if (Inventory_Quantity(player, "xshells") < AMMOMAX_XSHELLS)
+ f = f + (AMMOMAX_XSHELLS - Inventory_Quantity(player, "xshells")) * (AMMOMAX_XSHELLS - Inventory_Quantity(player, "xshells")) * 110 * Inventory_Quantity(item, "xshells") / (AMMOMAX_XSHELLS * AMMOMAX_XSHELLS);
return f;
};
@@ -142,16 +142,16 @@
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;
+ Inventory_SetQuantity(self, "shells", shells);
+ Inventory_SetQuantity(self, "nails", nails);
+ Inventory_SetQuantity(self, "rockets", rockets);
+ Inventory_SetQuantity(self, "cells", cells);
+ Inventory_SetQuantity(self, "xshells", xshells);
+// self.havocrating = self.havocrating + Inventory_Quantity(self, "shells") * 60;
+// self.havocrating = self.havocrating + Inventory_Quantity(self, "nails") * 15;
+// self.havocrating = self.havocrating + Inventory_Quantity(self, "rockets") * 120;
+// self.havocrating = self.havocrating + Inventory_Quantity(self, "cells") * 30;
+// self.havocrating = self.havocrating + Inventory_Quantity(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.4 dpmod/qc/m_enforcer.qc:1.5
--- dpmod/qc/m_enforcer.qc:1.4 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/m_enforcer.qc Sat Jul 12 06:02:55 2003
@@ -404,7 +404,7 @@
if (r < 0.20)
{
self.th_missile = enf_missile_rocket;
- ItemSetQuantity(self, "rockets", AMMO_ENFORCER_ROCKETS);
+ Inventory_SetQuantity(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;
- ItemSetQuantity(self, "cells", AMMO_ENFORCER_PLASMACELLS);
+ Inventory_SetQuantity(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;
- ItemSetQuantity(self, "cells", AMMO_ENFORCER_LASERCELLS);
+ Inventory_SetQuantity(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.4 dpmod/qc/m_ogre.qc:1.5
--- dpmod/qc/m_ogre.qc:1.4 Mon Jun 23 06:21:15 2003
+++ dpmod/qc/m_ogre.qc Sat Jul 12 06:02:55 2003
@@ -76,7 +76,7 @@
return FALSE;
// don't fire when out of ammo
- if (ItemQuantity(self, "rockets") < 1 && ItemQuantity(self, "nails") < 1)
+ if (Inventory_Quantity(self, "rockets") < 1 && Inventory_Quantity(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 (ItemQuantity(self, "rockets") < 1)
+ if (Inventory_Quantity(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 (ItemQuantity(self, "nails") < 1) ogre_run1();};
+void() ogre_nail1 =[ $shoot1, ogre_nail2 ] {ai_face();if (Inventory_Quantity(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 (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_nail4 =[ $shoot3, ogre_nail5 ] {ai_face();if (Inventory_Quantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail5 =[ $shoot3, ogre_nail6 ] {ai_face();if (Inventory_Quantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail6 =[ $shoot3, ogre_nail7 ] {ai_face();if (Inventory_Quantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail7 =[ $shoot3, ogre_nail8 ] {ai_face();if (Inventory_Quantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail8 =[ $shoot3, ogre_nail9 ] {ai_face();if (Inventory_Quantity(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 (ItemQuantity(self, "rockets") < 1) ogre_nail1();};
+void() ogre_gren1 =[ $shoot1, ogre_gren2 ] {ai_face();if (Inventory_Quantity(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();};
@@ -464,8 +464,8 @@
if (!self.deathtype) // map makers can override this
self.deathtype = " was destroyed by an ogre";
- ItemSetQuantity(self, "rockets", AMMO_OGRE_GRENADES);
- //ItemSetQuantity(self, "nails", 0);
+ Inventory_SetQuantity(self, "rockets", AMMO_OGRE_GRENADES);
+ //Inventory_SetQuantity(self, "nails", 0);
//self.items = IT_WEAPON6;
self.shoulddodge = TRUE;
Index: dpmod/qc/m_soldier.qc
diff -u dpmod/qc/m_soldier.qc:1.5 dpmod/qc/m_soldier.qc:1.6
--- dpmod/qc/m_soldier.qc:1.5 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/m_soldier.qc Sat Jul 12 06:02:55 2003
@@ -501,7 +501,7 @@
{
//self.items = IT_WEAPON4;
self.th_missile = army_missile_nail;
- ItemSetQuantity(self, "nails", 15);
+ Inventory_SetQuantity(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;
- ItemSetQuantity(self, "shells", 5);
+ Inventory_SetQuantity(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;
- ItemSetQuantity(self, "nails", 5);
+ Inventory_SetQuantity(self, "nails", 5);
if (!self.deathtype) // map makers can override this
self.deathtype = " lays down for a grunt";
}
Index: dpmod/qc/mode_management.qc
diff -u dpmod/qc/mode_management.qc:1.3 dpmod/qc/mode_management.qc:1.4
--- dpmod/qc/mode_management.qc:1.3 Thu Feb 20 03:44:59 2003
+++ dpmod/qc/mode_management.qc Sat Jul 12 06:02:55 2003
@@ -261,6 +261,7 @@
else if (cvar("deathmatch") == 10) setdm("10?Dark Places - Capture The Flag - 2 Team");
else if (cvar("deathmatch") == 11) setdm("11?Dark Places - Capture The Flag - 3 Team");
else if (cvar("deathmatch") == 12) setdm("12?Dark Places - Domination");
+ else if (cvar("deathmatch") == 30) setdm("30?Dark Places - Role Playing Game");
else setdm("1?Dark Places - Deathmatch");
/*if (deathmatch == 8) cvar_set("teamplay", "3?Dark Places - Elimination");
Index: dpmod/qc/modedefs.qc
diff -u dpmod/qc/modedefs.qc:1.2 dpmod/qc/modedefs.qc:1.3
--- dpmod/qc/modedefs.qc:1.2 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/modedefs.qc Sat Jul 12 06:02:55 2003
@@ -22,5 +22,5 @@
float DM_CTF_3TEAM = 11;
float DM_TEAM_MODS_END = 20;
-float DM_REVELATION = 30;
+float DM_RPG = 30;
Index: dpmod/qc/player.qc
diff -u dpmod/qc/player.qc:1.4 dpmod/qc/player.qc:1.5
--- dpmod/qc/player.qc:1.4 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/player.qc Sat Jul 12 06:02:55 2003
@@ -647,10 +647,10 @@
//self.solid = SOLID_NOT;
//self.currentammo = 0;
- //ItemSetQuantity(self, "shells", 0);
- //ItemSetQuantity(self, "nails", 0);
- //ItemSetQuantity(self, "rockets", 0);
- //ItemSetQuantity(self, "cells", 0);
+ //Inventory_SetQuantity(self, "shells", 0);
+ //Inventory_SetQuantity(self, "nails", 0);
+ //Inventory_SetQuantity(self, "rockets", 0);
+ //Inventory_SetQuantity(self, "cells", 0);
//self.items = 0;
//self.effects = 0;
//self.armorvalue = 0;
Index: dpmod/qc/w_dbshotgun.qc
diff -u dpmod/qc/w_dbshotgun.qc:1.10 dpmod/qc/w_dbshotgun.qc:1.11
--- dpmod/qc/w_dbshotgun.qc:1.10 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_dbshotgun.qc Sat Jul 12 06:02:55 2003
@@ -97,11 +97,11 @@
*/
/*
if (self.shotgunmode)
- self.currentammo = ItemAdjustQuantity(self, "xshells", -1);
+ Inventory_AdjustQuantity(self, "xshells", -1);
else
*/
/*
- self.currentammo = ItemAdjustQuantity(self, "shells", -1);
+ Inventory_AdjustQuantity(self, "shells", -1);
self.wfiretime = time;
w_muzzleflash(v, 4);
if (explosive)
@@ -156,10 +156,10 @@
}
/*
if (self.shotgunmode)
- self.currentammo = ItemAdjustQuantity(self, "xshells", -1);
+ Inventory_AdjustQuantity(self, "xshells", -1);
else
*/
- self.currentammo = ItemAdjustQuantity(self, "shells", -1);
+ Inventory_AdjustQuantity(self, "shells", -1);
self.wfiretime = time;
w_muzzleflash(v, 2);
if (explosive)
@@ -198,13 +198,13 @@
/*
if (self.shotgunmode)
{
- swapmode = ItemQuantity(self, "xshells") < 1 && ItemQuantity(self, "shells") >= 1;
- otherammo = ItemQuantity(self, "shells") >= 1;
+ swapmode = Inventory_Quantity(self, "xshells") < 1 && Inventory_Quantity(self, "shells") >= 1;
+ otherammo = Inventory_Quantity(self, "shells") >= 1;
}
else
{
- swapmode = ItemQuantity(self, "shells") < 1 && ItemQuantity(self, "xshells") >= 1;
- otherammo = ItemQuantity(self, "xshells") >= 1;
+ swapmode = Inventory_Quantity(self, "shells") < 1 && Inventory_Quantity(self, "xshells") >= 1;
+ otherammo = Inventory_Quantity(self, "xshells") >= 1;
}
if (otherammo)
@@ -234,7 +234,7 @@
self.shotgunshells = 0;
}
if (self.button0 || self.button3)
- if (ItemQuantity(self, "shells") > 0)
+ if (Inventory_Quantity(self, "shells") > 0)
if (W_ShotsToFire(0.2))
W_DBShotgunGatlingFireCode(self.button3);
}
@@ -271,9 +271,9 @@
/*
if (self.shotgunmode)
{
- if (ItemQuantity(self, "xshells") >= 1)
+ if (Inventory_Quantity(self, "xshells") >= 1)
{
- self.wload = min(ItemQuantity(self, "xshells"), 2);
+ self.wload = min(Inventory_Quantity(self, "xshells"), 2);
self.attack_finished = time + 0.2;
sound(self, CHAN_AUTO, "weapons/bsgload.wav", 1, ATTN_STATIC);
}
@@ -282,9 +282,9 @@
*/
/*
{
- if (ItemQuantity(self, "shells") >= 1)
+ if (Inventory_Quantity(self, "shells") >= 1)
{
- self.wload = min(ItemQuantity(self, "shells"), 2);
+ self.wload = min(Inventory_Quantity(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, ItemQuantity(self, "xshells"), VWEP_SUPER_SHOTGUN, "progs/v_dpshot2.mdl");
+ wset(IT_WEAPON3, IT_SHELLS, Inventory_Quantity(self, "xshells"), VWEP_SUPER_SHOTGUN, "progs/v_dpshot2.mdl");
else
*/
- wset(IT_WEAPON3, IT_SHELLS, ItemQuantity(self, "shells"), VWEP_SUPER_SHOTGUN, "progs/v_dpshot2.mdl");
+ wset(IT_WEAPON3, IT_SHELLS, Inventory_Quantity(self, "shells"), VWEP_SUPER_SHOTGUN, "progs/v_dpshot2.mdl");
};
-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");};
+float(float request) setweapon3 = {return weapongeneric(IT_WEAPON3, Inventory_Quantity(self, "shells") >= 1/* || Inventory_Quantity(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_grenade.qc
diff -u dpmod/qc/w_grenade.qc:1.9 dpmod/qc/w_grenade.qc:1.10
--- dpmod/qc/w_grenade.qc:1.9 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_grenade.qc Sat Jul 12 06:02:55 2003
@@ -55,7 +55,7 @@
W_Hostile();
sound(self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(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);
@@ -67,7 +67,7 @@
W_Hostile();
sound(self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(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);
};
@@ -77,7 +77,7 @@
void() W_GrenadeFireProximity =
{
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(self, "rockets", -1);
w_muzzleflash(shotorg, 3);
LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200, self, 100 * damagescale, 150, GRENADE_PROXIMITY, 5, "GRENADE", Obituary_Grenade);
};
@@ -87,7 +87,7 @@
void() W_GrenadeFireSticky =
{
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(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);
};
@@ -112,7 +112,7 @@
{
//if (self.activemines < 20)
//{
- if (ItemQuantity(self, "rockets") >= 1)
+ if (Inventory_Quantity(self, "rockets") >= 1)
{
if (W_ShotsToFire(0.6))
W_GrenadeFireImpact();
@@ -147,7 +147,7 @@
{
if (self.activemines < 20)
{
- if (ItemQuantity(self, "rockets") >= 1)
+ if (Inventory_Quantity(self, "rockets") >= 1)
W_GenericSlowFireCode("weapons/grenade.wav", 0.6, W_GrenadeFirePipebomb);
}
else
@@ -167,7 +167,7 @@
sound(self, CHAN_WEAPON, "weapons/bomb/trigger.wav", 1, ATTN_STATIC);
self.detonatetimeout = time + 0.1;
}
- else if (ItemQuantity(self, "rockets") >= 1)
+ else if (Inventory_Quantity(self, "rockets") >= 1)
W_GenericSlowFireCode("weapons/grenade.wav", 0.6, W_GrenadeFireImpact);
else
self.switchweapon = W_BestWeapon(TRUE);
@@ -200,7 +200,7 @@
}
else if (self.button0)
{
- if (ItemQuantity(self, "rockets") >= 1)
+ if (Inventory_Quantity(self, "rockets") >= 1)
{
if (self.grenademode == 0)
W_GenericSlowFireCode("weapons/grenade.wav", 0.6, W_GrenadeFireImpact);
@@ -227,12 +227,12 @@
/*
if (self.button0)
{
- if (ItemQuantity(self, "rockets") >= 1)
+ if (Inventory_Quantity(self, "rockets") >= 1)
W_GenericSlowFireCode("weapons/grenade.wav", 0.5, W_GrenadeFireImpact);
}
else if (self.button3)
{
- if (ItemQuantity(self, "rockets") >= 1)
+ if (Inventory_Quantity(self, "rockets") >= 1)
W_GenericSlowFireCode("weapons/grenade.wav", 0.8, W_GrenadeFireProximity);
}
*/
@@ -263,8 +263,8 @@
};
float() w_grenaderating = {return genericweaponrating(200, 500, 300);};
-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_grenadesetup = {wset(IT_WEAPON6, IT_ROCKETS, Inventory_Quantity(self, "rockets"), VWEP_GRENADE_LAUNCHER, "progs/v_dprock.mdl");};
+float(float request) setweapon6 = {return weapongeneric(IT_WEAPON6, Inventory_Quantity(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.3 dpmod/qc/w_info.qc:1.4
--- dpmod/qc/w_info.qc:1.3 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_info.qc Sat Jul 12 06:02:55 2003
@@ -221,10 +221,10 @@
if (self.health < 1)
return;
- ItemSetQuantity(self, "shells", 99999);
- ItemSetQuantity(self, "nails", 99999);
- ItemSetQuantity(self, "rockets", 99999);
- ItemSetQuantity(self, "cells", 99999);
+ Inventory_SetQuantity(self, "shells", 99999);
+ Inventory_SetQuantity(self, "nails", 99999);
+ Inventory_SetQuantity(self, "rockets", 99999);
+ Inventory_SetQuantity(self, "cells", 99999);
self.items = self.items
| IT_WEAPON1
| IT_WEAPON2
Index: dpmod/qc/w_lightning.qc
diff -u dpmod/qc/w_lightning.qc:1.2 dpmod/qc/w_lightning.qc:1.3
--- dpmod/qc/w_lightning.qc:1.2 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_lightning.qc Sat Jul 12 06:02:55 2003
@@ -119,10 +119,10 @@
void(float cells) W_LightningFireCode =
{
- if (cells > ItemQuantity(self, "cells"))
- cells = ItemQuantity(self, "cells");
+ if (cells > Inventory_Quantity(self, "cells"))
+ cells = Inventory_Quantity(self, "cells");
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
+ Inventory_AdjustQuantity(self, "cells", 0 - cells);
self.wframe = self.wframe + 1;
if (self.wframe >= 3)
self.wframe = 1;
@@ -144,7 +144,7 @@
if (self.button0)
{
- if (ItemQuantity(self, "cells") > 0)
+ if (Inventory_Quantity(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 (ItemQuantity(self, "rockets") >= 1)
+ //if (Inventory_Quantity(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, 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");};
+void() w_lightningsetup = {wset(IT_WEAPON8, IT_CELLS, Inventory_Quantity(self, "cells"), VWEP_LIGHTNING, "progs/v_dplight.mdl");};
+float(float request) setweapon8 = {return weapongeneric(IT_WEAPON8, Inventory_Quantity(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.8 dpmod/qc/w_nailgun.qc:1.9
--- dpmod/qc/w_nailgun.qc:1.8 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_nailgun.qc Sat Jul 12 06:02:55 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 && ItemQuantity(self, "nails") >= 1)
+ while (shots > 0 && Inventory_Quantity(self, "nails") >= 1)
{
shots = shots - 1;
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "nails", -1);
+ Inventory_AdjustQuantity(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 = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(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 (ItemQuantity(self, "nails") >= 1)
+ if (Inventory_Quantity(self, "nails") >= 1)
{
self.wload = W_ShotsToFire(0.1);
if (self.wload)
@@ -109,7 +109,7 @@
else
{
if (self.button3)
- if (ItemQuantity(self, "rockets") >= 1)
+ if (Inventory_Quantity(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, 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");};
+void() w_nailgunsetup = {wset(IT_WEAPON4, IT_NAILS, Inventory_Quantity(self, "nails"), VWEP_NAILGUN, "progs/v_dpnail.mdl");};
+float(float request) setweapon4 = {return weapongeneric(IT_WEAPON4, Inventory_Quantity(self, "nails") >= 1 || Inventory_Quantity(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.2 dpmod/qc/w_oldplasmarifle.qc:1.3
--- dpmod/qc/w_oldplasmarifle.qc:1.2 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_oldplasmarifle.qc Sat Jul 12 06:02:55 2003
@@ -16,7 +16,7 @@
{
local vector dir;
self.wload = self.wload - 1;
- self.currentammo = ItemAdjustQuantity(self, "cells", -1);
+ Inventory_AdjustQuantity(self, "cells", -1);
self.wfiretime = time;
dir = shotdir + randomvec() * 0.03;
w_muzzleflash(shotorg, 1);
@@ -26,7 +26,7 @@
void() W_PlasmaRifleFireHighPower =
{
- self.currentammo = ItemAdjustQuantity(self, "cells", 0 - self.wload);
+ Inventory_AdjustQuantity(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 > ItemQuantity(self, "cells"))
- self.wload = ItemQuantity(self, "cells");
+ if (self.wload > Inventory_Quantity(self, "cells"))
+ self.wload = Inventory_Quantity(self, "cells");
if (self.button0 && self.wload >= 1)
{
@@ -60,7 +60,7 @@
}
else if (time > self.attack_finished)
{
- charge = ItemQuantity(self, "cells");
+ charge = Inventory_Quantity(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, 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_plasmariflesetup = {wset(IT_WEAPON8, IT_CELLS, Inventory_Quantity(self, "cells"), VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
+float(float request) setweapon8 = {return weapongeneric(IT_WEAPON8, Inventory_Quantity(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.10 dpmod/qc/w_plasmarifle.qc:1.11
--- dpmod/qc/w_plasmarifle.qc:1.10 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_plasmarifle.qc Sat Jul 12 06:02:55 2003
@@ -32,11 +32,11 @@
{
shots = shots - 1;
cells = cellspershot;
- if (cells > ItemQuantity(self, "cells"))
- cells = ItemQuantity(self, "cells");
+ if (cells > Inventory_Quantity(self, "cells"))
+ cells = Inventory_Quantity(self, "cells");
if (cells <= 0)
return;
- self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
+ Inventory_AdjustQuantity(self, "cells", 0 - cells);
self.wfiretime = time;
if (self.plasmabarrel == 0)
{
@@ -89,7 +89,7 @@
self.woverload = 0;
}
}
- else if (self.button0 && ItemQuantity(self, "cells") > 0)
+ else if (self.button0 && Inventory_Quantity(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 && ItemQuantity(self, "cells") > 0)
+ if (self.button3 && Inventory_Quantity(self, "cells") > 0)
{
self.woverload = 12;
- //if (self.woverload > ItemQuantity(self, "cells"))
- // self.woverload = ItemQuantity(self, "cells");
- //self.currentammo = ItemAdjustQuantity(self, "cells", 0 - self.woverload);
+ //if (self.woverload > Inventory_Quantity(self, "cells"))
+ // self.woverload = Inventory_Quantity(self, "cells");
+ Inventory_AdjustQuantity(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, 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_plasmariflesetup = {wset(IT_WEAPON9, IT_CELLS, Inventory_Quantity(self, "cells"), VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
+float(float request) setweapon9 = {return weapongeneric(IT_WEAPON9, Inventory_Quantity(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.2 dpmod/qc/w_plasmawave.qc:1.3
--- dpmod/qc/w_plasmawave.qc:1.2 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_plasmawave.qc Sat Jul 12 06:02:55 2003
@@ -48,11 +48,11 @@
local float cells;
W_Hostile();
sound(self, CHAN_WEAPON, "plasma/plasma.wav", 1, ATTN_NORM);
- cells = ItemQuantity(self, "cells");
+ cells = Inventory_Quantity(self, "cells");
if (cells > 10)
cells = 10;
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
+ Inventory_AdjustQuantity(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 = ItemQuantity(self, "cells");
+ cells = Inventory_Quantity(self, "cells");
if (cells > 50)
cells = 50;
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
+ Inventory_AdjustQuantity(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 = ItemQuantity(self, "cells");
+ cells = Inventory_Quantity(self, "cells");
if (cells > 50)
cells = 50;
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
+ Inventory_AdjustQuantity(self, "cells", 0 - cells);
//cells = cells + 60;
shots = ceil(cells / 5);
if (shots > 12)
@@ -109,14 +109,14 @@
W_PlasmaWaveFireWave();
}
}
- else if (self.button0 && ItemQuantity(self, "cells") > 0)
+ else if (self.button0 && Inventory_Quantity(self, "cells") > 0)
{
if (W_ShotsToFire(0.5))
W_PlasmaWaveFireShot();
}
else if (time >= self.attack_finished)
{
- if (self.button3 && ItemQuantity(self, "cells") > 0)
+ if (self.button3 && Inventory_Quantity(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, 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_plasmawavesetup = {wset(IT_WEAPON10, IT_CELLS, Inventory_Quantity(self, "cells"), VWEP_LIGHTNING, "progs/v_dplight.mdl");};
+float(float request) setweapon10 = {return weapongeneric(IT_WEAPON10, Inventory_Quantity(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.9 dpmod/qc/w_rocket.qc:1.10
--- dpmod/qc/w_rocket.qc:1.9 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_rocket.qc Sat Jul 12 06:02:55 2003
@@ -98,7 +98,7 @@
sound(self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
self.wfiretime = time;
self.flags = self.flags - (self.flags & FL_ONGROUND);
- self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(self, "rockets", -1);
w_muzzleflash(shotorg, 2);
LaunchMissile(shotorg, shotdir * 5000, self, 100 * damagescale, 100, "ROCKET", Obituary_Rocket);
};
@@ -110,18 +110,18 @@
self.wfiretime = time;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.velocity = self.velocity - shotdir * 450;
- self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(self, "rockets", -1);
w_muzzleflash(shotorg, 4);
LaunchMissile(shotorg, shotdir * 3000, self, 100 * damagescale, 100, "ROCKET", Obituary_Rocket);
spiralmissile_orbitentity = newmis;
- if (ItemQuantity(self, "rockets") < 1)
+ if (Inventory_Quantity(self, "rockets") < 1)
return;
- self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(self, "rockets", -1);
w_muzzleflash(shotorg + v_right * 8, 4);
LaunchSpiralMissile(shotorg, shotdir, self, 100 * damagescale, 100, "ROCKET", Obituary_Rocket, -12);
- if (ItemQuantity(self, "rockets") < 1)
+ if (Inventory_Quantity(self, "rockets") < 1)
return;
- self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+ Inventory_AdjustQuantity(self, "rockets", -1);
w_muzzleflash(shotorg - v_right * 8, 4);
LaunchSpiralMissile(shotorg, shotdir, self, 100 * damagescale, 100, "ROCKET", Obituary_Rocket, 12);
};
@@ -168,8 +168,8 @@
};
float() w_rocketrating = {return genericweaponrating(200, 1000, 240);};
-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_rocketsetup = {wset(IT_WEAPON7, IT_ROCKETS, Inventory_Quantity(self, "rockets"), VWEP_ROCKET_LAUNCHER, "progs/v_dprock2.mdl");};
+float(float request) setweapon7 = {return weapongeneric(IT_WEAPON7, Inventory_Quantity(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.9 dpmod/qc/w_shotgun.qc:1.10
--- dpmod/qc/w_shotgun.qc:1.9 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_shotgun.qc Sat Jul 12 06:02:55 2003
@@ -21,7 +21,7 @@
W_Hostile();
sound(self, CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM);
self.wfiretime = time;
- self.currentammo = ItemAdjustQuantity(self, "shells", -1);
+ Inventory_AdjustQuantity(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 > ItemQuantity(self, "shells"))
- self.wload = ItemQuantity(self, "shells");
+ if (self.wload > Inventory_Quantity(self, "shells"))
+ self.wload = Inventory_Quantity(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 (ItemQuantity(self, "shells") >= 1)
+ else if (Inventory_Quantity(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, 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_shotgunsetup = {wset(IT_WEAPON2, IT_SHELLS, Inventory_Quantity(self, "shells"), VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
+float(float request) setweapon2 = {return weapongeneric(IT_WEAPON2, Inventory_Quantity(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.8 dpmod/qc/w_supernailgun.qc:1.9
--- dpmod/qc/w_supernailgun.qc:1.8 Wed Jun 11 05:07:37 2003
+++ dpmod/qc/w_supernailgun.qc Sat Jul 12 06:02:55 2003
@@ -18,10 +18,10 @@
W_Hostile();
sound(self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
v = shotorg;
- while (shots > 0 && ItemQuantity(self, "nails") >= 1)
+ while (shots > 0 && Inventory_Quantity(self, "nails") >= 1)
{
shots = shots - 1;
- self.currentammo = ItemAdjustQuantity(self, "nails", -1);
+ Inventory_AdjustQuantity(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 > ItemQuantity(self, "rockets"))
- a = ItemQuantity(self, "rockets");
- self.currentammo = ItemAdjustQuantity(self, "rockets", 0 - a);
+ if (a > Inventory_Quantity(self, "rockets"))
+ a = Inventory_Quantity(self, "rockets");
+ Inventory_AdjustQuantity(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 (ItemQuantity(self, "nails") >= 1)
+ if (Inventory_Quantity(self, "nails") >= 1)
{
self.wload = W_ShotsToFire(0.05);
if (self.wload > 0)
@@ -107,7 +107,7 @@
else
{
if (self.button3)
- if (ItemQuantity(self, "rockets") >= 1)
+ if (Inventory_Quantity(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, 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");};
+void() w_snailgunsetup = {wset(IT_WEAPON5, IT_NAILS, Inventory_Quantity(self, "nails"), VWEP_SUPER_NAILGUN, "progs/v_dpnail2.mdl");};
+float(float request) setweapon5 = {return weapongeneric(IT_WEAPON5, Inventory_Quantity(self, "nails") >= 1 || Inventory_Quantity(self, "rockets") >= 1, request, w_snailgunsetup, w_snailgun, w_snailgunraise1, w_directaim, w_snailgunrating, "Super Nailgun");};
More information about the twilight-commits
mailing list