[nexuiz-commits] r6706 - in trunk/data: . qcsrc/common qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon May 11 14:33:07 EDT 2009


Author: div0
Date: 2009-05-11 14:33:07 -0400 (Mon, 11 May 2009)
New Revision: 6706

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/common/items.qc
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/cl_weapons.qc
   trunk/data/qcsrc/server/constants.qh
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/t_items.qc
   trunk/data/qcsrc/server/w_hook.qc
   trunk/data/qcsrc/server/w_porto.qc
   trunk/data/weapons.cfg
   trunk/data/weaponsHavoc.cfg
Log:
hook now takes fuel


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/defaultNexuiz.cfg	2009-05-11 18:33:07 UTC (rev 6706)
@@ -24,7 +24,7 @@
 seta g_configversion 0	"Configuration file version (used to upgrade settings) 0: first run, or previous start was <2.4.1  Later, it's overridden by config.cfg, version ranges are defined in config_update.cfg"
 
 // default.cfg versioning (update using update-cvarcount.sh, run that every time after adding a new cvar)
-set cvar_check_default 4ca99f9a6a53e5c14b991b2424efa88f
+set cvar_check_default ca174b42ef38020187602cfda6d8ef43
 
 // Nexuiz version (formatted for machines)
 // used to determine if a client version is compatible

Modified: trunk/data/qcsrc/common/items.qc
===================================================================
--- trunk/data/qcsrc/common/items.qc	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/qcsrc/common/items.qc	2009-05-11 18:33:07 UTC (rev 6706)
@@ -98,21 +98,21 @@
 void RegisterWeapons()
 {
 	// %weaponaddpoint
-	register_weapon(WEP_LASER,            w_laser,        0,          1, 1, 1, 0,                      "laser",        "laser",           "Laser");
-	register_weapon(WEP_SHOTGUN,          w_shotgun,      IT_SHELLS,  2, 1, 0, BOT_PICKUP_RATING_LOW,  "shotgun",      "shotgun",         "Shotgun");
-	register_weapon(WEP_UZI,              w_uzi,          IT_NAILS,   3, 1, 0, BOT_PICKUP_RATING_MID,  "uzi",          "uzi",             "Machine Gun");
-	register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher,    IT_ROCKETS, 4, 1, 1, BOT_PICKUP_RATING_MID,  "gl",           "grenadelauncher", "Mortar");
-	register_weapon(WEP_ELECTRO,          w_electro,      IT_CELLS,   5, 1, 0, BOT_PICKUP_RATING_MID,  "electro",      "electro",         "Electro");
-	register_weapon(WEP_CRYLINK,          w_crylink,      IT_CELLS,   6, 1, 0, BOT_PICKUP_RATING_MID,  "crylink",      "crylink",         "Crylink");
-	register_weapon(WEP_NEX,              w_nex,          IT_CELLS,   7, 1, 0, BOT_PICKUP_RATING_HIGH, "nex",          "nex",             "Nex");
-	register_weapon(WEP_HAGAR,            w_hagar,        IT_ROCKETS, 8, 1, 1, BOT_PICKUP_RATING_MID,  "hagar",        "hagar",           "Hagar");
-	register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher,    IT_ROCKETS, 9, 1, 1, BOT_PICKUP_RATING_HIGH, "rl",           "rocketlauncher",  "Rocket Launcher");
-	register_weapon(WEP_PORTO,            w_porto,        0,          0, 0, 0, 0,                      "porto" ,       "porto",           "Port-O-Launch");
-	register_weapon(WEP_MINSTANEX,        w_minstanex,    IT_CELLS,   7, 0, 1, BOT_PICKUP_RATING_HIGH, "minstanex",    "minstanex",       "MinstaNex");
-	register_weapon(WEP_HOOK,             w_hook,         IT_CELLS,   0, 0, 1, 0,                      "hookgun",      "hook",            "Grappling Hook");
-	register_weapon(WEP_SEEKER,           w_seeker,       IT_ROCKETS, 8, 0, 0, BOT_PICKUP_RATING_HIGH, "seeker",       "seeker",          "T.A.G. Seeker");
-	register_weapon(WEP_HLAC,             w_hlac,         IT_CELLS,   6, 1, 0, BOT_PICKUP_RATING_MID,  "hlac",         "hlac",            "Heavy Laser Assault Cannon");
-	register_weapon(WEP_CAMPINGRIFLE,     w_campingrifle, IT_NAILS,   3, 1, 0, BOT_PICKUP_RATING_MID,  "campingrifle", "campingrifle",    "Rifle");
+	register_weapon(WEP_LASER,            w_laser,        0,                1, 1, 1, 0,                      "laser",        "laser",           "Laser");
+	register_weapon(WEP_SHOTGUN,          w_shotgun,      IT_SHELLS,        2, 1, 0, BOT_PICKUP_RATING_LOW,  "shotgun",      "shotgun",         "Shotgun");
+	register_weapon(WEP_UZI,              w_uzi,          IT_NAILS,         3, 1, 0, BOT_PICKUP_RATING_MID,  "uzi",          "uzi",             "Machine Gun");
+	register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher,    IT_ROCKETS,       4, 1, 1, BOT_PICKUP_RATING_MID,  "gl",           "grenadelauncher", "Mortar");
+	register_weapon(WEP_ELECTRO,          w_electro,      IT_CELLS,         5, 1, 0, BOT_PICKUP_RATING_MID,  "electro",      "electro",         "Electro");
+	register_weapon(WEP_CRYLINK,          w_crylink,      IT_CELLS,         6, 1, 0, BOT_PICKUP_RATING_MID,  "crylink",      "crylink",         "Crylink");
+	register_weapon(WEP_NEX,              w_nex,          IT_CELLS,         7, 1, 0, BOT_PICKUP_RATING_HIGH, "nex",          "nex",             "Nex");
+	register_weapon(WEP_HAGAR,            w_hagar,        IT_ROCKETS,       8, 1, 1, BOT_PICKUP_RATING_MID,  "hagar",        "hagar",           "Hagar");
+	register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher,    IT_ROCKETS,       9, 1, 1, BOT_PICKUP_RATING_HIGH, "rl",           "rocketlauncher",  "Rocket Launcher");
+	register_weapon(WEP_PORTO,            w_porto,        0,                0, 0, 0, 0,                      "porto" ,       "porto",           "Port-O-Launch");
+	register_weapon(WEP_MINSTANEX,        w_minstanex,    IT_CELLS,         7, 0, 1, BOT_PICKUP_RATING_HIGH, "minstanex",    "minstanex",       "MinstaNex");
+	register_weapon(WEP_HOOK,             w_hook,         IT_CELLS|IT_FUEL, 0, 0, 1, 0,                      "hookgun",      "hook",            "Grappling Hook");
+	register_weapon(WEP_SEEKER,           w_seeker,       IT_ROCKETS,       8, 0, 0, BOT_PICKUP_RATING_HIGH, "seeker",       "seeker",          "T.A.G. Seeker");
+	register_weapon(WEP_HLAC,             w_hlac,         IT_CELLS,         6, 1, 0, BOT_PICKUP_RATING_MID,  "hlac",         "hlac",            "Heavy Laser Assault Cannon");
+	register_weapon(WEP_CAMPINGRIFLE,     w_campingrifle, IT_NAILS,         3, 1, 0, BOT_PICKUP_RATING_MID,  "campingrifle", "campingrifle",    "Rifle");
 
 	register_weapons_done();
 }

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/qcsrc/server/cl_client.qc	2009-05-11 18:33:07 UTC (rev 6706)
@@ -2182,6 +2182,7 @@
 */
 void() ctf_setstatus;
 void() nexball_setstatus;
+.float items_added;
 void PlayerPreThink (void)
 {
 	self.stat_sys_ticrate = cvar("sys_ticrate");
@@ -2405,12 +2406,16 @@
 
 		if(frametime)
 		{
+			self.items &~= self.items_added;
+
 			W_WeaponFrame();
 
-			self.items &~= IT_FUEL; // TODO don't do this if the current weapon actually USES fuel...
+			self.items_added = 0;
 			if(self.items & IT_JETPACK)
 				if(self.items & IT_FUEL_REGEN || self.ammo_fuel >= 0.01)
-					self.items |= IT_FUEL;
+					self.items_added |= IT_FUEL;
+
+			self.items |= self.items_added;
 		}
 
 		player_regen();

Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/qcsrc/server/cl_weapons.qc	2009-05-11 18:33:07 UTC (rev 6706)
@@ -173,11 +173,12 @@
 	SUB_SetFade(self, time + 20, 1);
 }
 
-// returns amount of ammo used, or -1 for failure, or 0 for no ammo count
-float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo)
+// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
+string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo)
 {
 	entity oldself, wep;
-	float wa, thisammo;
+	float wa, thisammo, i, j;
+	string s;
 	var .float ammofield;
 
 	wep = spawn();
@@ -198,29 +199,38 @@
 		weapon_defaultspawnfunc(wpn);
 		self = oldself;
 		if(startitem_failed)
-			return -1;
+			return string_null;
 		wep.think = thrown_wep_think;
 		wep.nextthink = time + 0.5;
-		return 0;
+		return "";
 	}
 	else
 	{
-		ammofield = Item_CounterField(wa);
+		s = "";
 		oldself = self;
 		self = wep;
 		weapon_defaultspawnfunc(wpn);
 		self = oldself;
 		if(startitem_failed)
-			return -1;
+			return string_null;
 		if(doreduce)
 		{
-			thisammo = min(own.ammofield, wep.ammofield);
-			wep.ammofield = thisammo;
-			own.ammofield -= thisammo;
+			for(i = 0, j = 1; i < 24; ++i, j *= 2)
+			{
+				if(wa & j)
+				{
+					ammofield = Item_CounterField(j);
+					thisammo = min(own.ammofield, wep.ammofield);
+					wep.ammofield = thisammo;
+					own.ammofield -= thisammo;
+					s = strcat(s, " and ", ftos(thisammo), " ", Item_CounterFieldName(j));
+				}
+			}
+			s = substring(s, 5, -1);
 		}
 		wep.think = thrown_wep_think;
 		wep.nextthink = time + 0.5;
-		return wep.ammofield;
+		return s;
 	}
 }
 
@@ -248,7 +258,8 @@
 // toss current weapon
 void W_ThrowWeapon(vector velo, vector delta, float doreduce)
 {
-	local float w, a, wb;
+	local float w, wb;
+	string a;
 
 	w = self.weapon;
 	if (w == 0)
@@ -273,14 +284,14 @@
 	self.weapons &~= wb;
 	W_SwitchWeapon_Force(self, w_getbestweapon(self));
 	a = W_ThrowNewWeapon(self, w, doreduce, self.origin + delta, velo);
-	if(a < 0)
+	if not(a)
 		return;
 	if(self.health >= 1)
 	{
-		if(a == 0)
+		if(a == "")
 			sprint(self, strcat("You dropped the ^2", W_Name(w), "\n"));
 		else
-			sprint(self, strcat("You dropped the ^2", W_Name(w), " with ", ftos(a), " ", Item_CounterFieldName(W_AmmoItemCode(w)), "\n"));
+			sprint(self, strcat("You dropped the ^2", W_Name(w), " with ", a, "\n"));
 	}
 };
 
@@ -346,7 +357,7 @@
 	while (c < 5)
 	{
 		c = c + 1;
-		if(wb && self.weapons & wb == 0)
+		if(wb && ((self.weapons & wb) == 0))
 		{
 			W_SwitchWeapon_Force(self, w_getbestweapon(self));
 			wb = 0;

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/qcsrc/server/constants.qh	2009-05-11 18:33:07 UTC (rev 6706)
@@ -1,5 +1,5 @@
-string CVAR_CHECK_DEFAULT = "4ca99f9a6a53e5c14b991b2424efa88f";
-string CVAR_CHECK_WEAPONS = "00219e78f5d78d7d8a1600c4f4c73aa5";
+string CVAR_CHECK_DEFAULT = "ca174b42ef38020187602cfda6d8ef43";
+string CVAR_CHECK_WEAPONS = "b338022e7d7e73d5dccef57bebd2c37e";
 
 float	FALSE					= 0;
 float	TRUE					= 1;

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2009-05-11 18:33:07 UTC (rev 6706)
@@ -943,30 +943,16 @@
 		}
 	}
 
-	if(start_weapons & WEPBIT_HOOK)
+	if(g_jetpack || (g_grappling_hook && (start_weapons & WEPBIT_HOOK)))
 	{
-		// can't have off-hand hook, if hook weapon is enabled
-
-		// note: if g_grappling_hook is 1, also give some initial cells
-		if(g_grappling_hook)
-		{
-			if(!start_ammo_cells)
-				start_ammo_cells = g_pickup_cells;
-			if(!warmup_start_ammo_cells)
-				warmup_start_ammo_cells = g_pickup_cells;
-		}
-
-		g_grappling_hook = 0;
-	}
-
-	if(g_jetpack)
-	{
 		g_grappling_hook = 0; // these two can't coexist, as they use the same button
-		start_items |= IT_JETPACK;
 		start_items |= IT_FUEL_REGEN;
 		start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_stable"));
 	}
 
+	if(g_jetpack)
+		start_items |= IT_JETPACK;
+
 	if(g_weapon_stay == 2)
 	{
 		if(!start_ammo_shells) start_ammo_shells = g_pickup_shells;

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/qcsrc/server/t_items.qc	2009-05-11 18:33:07 UTC (rev 6706)
@@ -732,9 +732,15 @@
 
 	if(e.items && e.items != IT_SUPERWEAPON)
 	{
-		ammofield = Item_CounterField(e.items);
-		if(!self.ammofield)
-			self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(e.items)));
+		for(i = 0, j = 1; i < 24; ++i, j *= 2)
+		{
+			if(e.items & j)
+			{
+				ammofield = Item_CounterField(j);
+				if(!self.ammofield)
+					self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j)));
+			}
+		}
 	}
 	else
 	{

Modified: trunk/data/qcsrc/server/w_hook.qc
===================================================================
--- trunk/data/qcsrc/server/w_hook.qc	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/qcsrc/server/w_hook.qc	2009-05-11 18:33:07 UTC (rev 6706)
@@ -7,7 +7,7 @@
 .float dmg_last;
 .float hook_refire;
 .float hook_time_hooked;
-.float hook_time_ammodecrease;
+.float hook_time_fueldecrease;
 
 void W_Hook_ExplodeThink (void)
 {
@@ -103,7 +103,7 @@
 
 float w_hook(float req)
 {
-	float hooked_time_max, hooked_ammodecrease_delay;
+	float hooked_time_max, hooked_fuel;
 		
 	if (req == WR_AIM)
 	{
@@ -115,11 +115,12 @@
 		{
 			if(!self.hook)
 			if not(self.hook_state & HOOK_WAITING_FOR_RELEASE)
+			if not(self.hook_state & HOOK_FIRING)
 			if (time > self.hook_refire)
 			if (weapon_prepareattack(0, -1))
 			{
 				if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
-					self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_primary_ammo");
+					self.ammo_fuel = self.ammo_fuel - cvar("g_balance_hook_primary_fuel");
 				self.hook_state |= HOOK_FIRING;
 				weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hook_primary_animtime"), w_ready);				
 			}
@@ -138,6 +139,10 @@
 		{
 			// if hooked, no bombs, and increase the timer
 			self.hook_refire = max(self.hook_refire, time + cvar("g_balance_hook_primary_refire"));
+
+			// hook also inhibits health regeneration, but only for 1 second
+			if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+				self.pauseregen_finished = max(self.pauseregen_finished, time + cvar("g_balance_pause_fuel_regen"));
 		}
 
 		if(self.hook && self.hook.state == 1)
@@ -149,20 +154,22 @@
 					self.hook_state |= HOOK_REMOVING;
 			}
 			
-			hooked_ammodecrease_delay = cvar("g_balance_hook_primary_hooked_ammodecrease_delay");
-			if (hooked_ammodecrease_delay > 0)
+			hooked_fuel = cvar("g_balance_hook_primary_hooked_fuel");
+			if (hooked_fuel > 0)
 			{
-				if ( time > self.hook_time_ammodecrease )
+				if ( time > self.hook_time_fueldecrease )
 				{
 					if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 					{
-						if ( self.ammo_cells >= frametime / hooked_ammodecrease_delay )
+						if ( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel )
 						{
-							self.ammo_cells -= frametime / hooked_ammodecrease_delay;
+							self.ammo_fuel -= (time - self.hook_time_fueldecrease) * hooked_fuel;
+							self.hook_time_fueldecrease = time;
 							// decrease next frame again
 						}
 						else
 						{
+							self.ammo_fuel = 0;
 							self.hook_state |= HOOK_REMOVING;
 							W_SwitchWeapon_Force(self, w_getbestweapon(self));
 						}
@@ -173,7 +180,7 @@
 		else
 		{
 			self.hook_time_hooked = time;				
-			self.hook_time_ammodecrease = time + cvar("g_balance_hook_primary_hooked_time_free");
+			self.hook_time_fueldecrease = time + cvar("g_balance_hook_primary_hooked_time_free");
 		}
 
 		if (self.BUTTON_CROUCH)
@@ -218,7 +225,10 @@
 	}
 	else if (req == WR_CHECKAMMO1)
 	{
-		return self.ammo_cells >= cvar("g_balance_hook_primary_ammo");			
+		if(self.hook)
+			return self.ammo_fuel > 0;
+		else
+			return self.ammo_fuel >= cvar("g_balance_hook_primary_fuel");
 	}
 	else if (req == WR_CHECKAMMO2)
 	{

Modified: trunk/data/qcsrc/server/w_porto.qc
===================================================================
--- trunk/data/qcsrc/server/w_porto.qc	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/qcsrc/server/w_porto.qc	2009-05-11 18:33:07 UTC (rev 6706)
@@ -15,7 +15,7 @@
 	remove(self);
 }
 
-float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
+string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
 void W_Porto_Fail (float failhard)
 {
 	if(self.owner == world)

Modified: trunk/data/weapons.cfg
===================================================================
--- trunk/data/weapons.cfg	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/weapons.cfg	2009-05-11 18:33:07 UTC (rev 6706)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit weaponsHavoc.cfg too.
 
-set cvar_check_weapons 00219e78f5d78d7d8a1600c4f4c73aa5
+set cvar_check_weapons b338022e7d7e73d5dccef57bebd2c37e
 
 // NOTE: this only replaces weapons on the map
 // use g_start_weapon_* to also replace the on-startup weapons!
@@ -272,12 +272,12 @@
 set g_balance_portal_health 200 // these get recharged whenever the portal is used
 set g_balance_portal_lifetime 15 // these get recharged whenever the portal is used
 
-set g_balance_hook_primary_ammo 2 // hook monkeys set 0
+set g_balance_hook_primary_fuel 10 // hook monkeys set 0
 set g_balance_hook_primary_refire 0 // hook monkeys set 0
 set g_balance_hook_primary_animtime 0.3 // good shoot anim
 set g_balance_hook_primary_hooked_time_max 0 // infinite
 set g_balance_hook_primary_hooked_time_free 2 // 2s being hooked are free
-set g_balance_hook_primary_hooked_ammodecrease_delay 0.5 // remove one cell every 0.5 seconds
+set g_balance_hook_primary_hooked_fuel 8 // fuel per second hooked
 set g_balance_hook_secondary_damage 25 // not much
 set g_balance_hook_secondary_edgedamage 5 // not much
 set g_balance_hook_secondary_radius 500 // LOTS

Modified: trunk/data/weaponsHavoc.cfg
===================================================================
--- trunk/data/weaponsHavoc.cfg	2009-05-11 12:34:11 UTC (rev 6705)
+++ trunk/data/weaponsHavoc.cfg	2009-05-11 18:33:07 UTC (rev 6706)
@@ -1,4 +1,4 @@
-set cvar_check_weapons 00219e78f5d78d7d8a1600c4f4c73aa5
+set cvar_check_weapons b338022e7d7e73d5dccef57bebd2c37e
 
 // NOTE: this only replaces weapons on the map
 // use g_start_weapon_* to also replace the on-startup weapons!
@@ -267,12 +267,12 @@
 set g_balance_portal_health 200 // these get recharged whenever the portal is used
 set g_balance_portal_lifetime 15 // these get recharged whenever the portal is used
 
-set g_balance_hook_primary_ammo 2 // hook monkeys set 0
+set g_balance_hook_primary_fuel 10 // hook monkeys set 0
 set g_balance_hook_primary_refire 0 // hook monkeys set 0
 set g_balance_hook_primary_animtime 0.3 // good shoot anim
 set g_balance_hook_primary_hooked_time_max 0 // infinite
 set g_balance_hook_primary_hooked_time_free 2 // 2s being hooked are free
-set g_balance_hook_primary_hooked_ammodecrease_delay 0.5 // remove one cell every 0.5 seconds
+set g_balance_hook_primary_hooked_fuel 8 // fuel per second hooked
 set g_balance_hook_secondary_damage 25 // not much
 set g_balance_hook_secondary_edgedamage 5 // not much
 set g_balance_hook_secondary_radius 500 // LOTS



More information about the nexuiz-commits mailing list