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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jun 29 02:06:01 EDT 2009


Author: div0
Date: 2009-06-29 02:06:00 -0400 (Mon, 29 Jun 2009)
New Revision: 7123

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/constants.qh
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/miscfunctions.qc
Log:
rot/regen system cleanup; hopefully no actual change
for fuel, rot now goes to 100 as before, but regen only goes to 50


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-06-28 15:49:29 UTC (rev 7122)
+++ trunk/data/defaultNexuiz.cfg	2009-06-29 06:06:00 UTC (rev 7123)
@@ -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 53ad20239e3fbf681eb91c2436691158
+set cvar_check_default 99547c339e474ecb1b5758a604370575
 
 // Nexuiz version (formatted for machines)
 // used to determine if a client version is compatible
@@ -735,7 +735,8 @@
 set g_balance_armor_rot 0.1
 set g_balance_armor_regenlinear 0
 set g_balance_armor_rotlinear 0
-set g_balance_armor_stable 100
+set g_balance_armor_regenstable 100
+set g_balance_armor_rotstable 100
 set g_balance_armor_limit 999
 set g_balance_armor_start 0
 set g_balance_armor_blockpercent 0.6
@@ -743,7 +744,8 @@
 set g_balance_health_rot 0.1
 set g_balance_health_regenlinear 0
 set g_balance_health_rotlinear 0
-set g_balance_health_stable 100
+set g_balance_health_regenstable 100
+set g_balance_health_rotstable 100
 set g_balance_health_limit 999
 set g_balance_health_start 150
 set g_balance_selfdamagepercent 0.6
@@ -1560,7 +1562,8 @@
 set g_balance_fuel_rot 0.05
 set g_balance_fuel_regenlinear 0
 set g_balance_fuel_rotlinear 0
-set g_balance_fuel_stable 100
+set g_balance_fuel_regenstable 50
+set g_balance_fuel_rotstable 100
 set g_balance_fuel_limit 999
 set g_balance_pause_fuel_regen 2 // other than this, fuel uses the health regen counter
 set g_balance_pause_fuel_rot 5

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2009-06-28 15:49:29 UTC (rev 7122)
+++ trunk/data/qcsrc/server/cl_client.qc	2009-06-29 06:06:00 UTC (rev 7123)
@@ -1787,22 +1787,60 @@
 		self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
 }
 
-float CalcRegen(float current, float stable, float regenfactor)
+float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
 {
 	if(current > stable)
 		return current;
 	else if(current > stable - 0.25) // when close enough, "snap"
 		return stable;
 	else
-		return min(stable, current + (stable - current) * regenfactor * frametime);
+		return min(stable, current + (stable - current) * regenfactor * regenframetime);
 }
 
+float CalcRot(float current, float stable, float rotfactor, float rotframetime)
+{
+	if(current < stable)
+		return current;
+	else if(current < stable + 0.25) // when close enough, "snap"
+		return stable;
+	else
+		return max(stable, current + (stable - current) * rotfactor * rotframetime);
+}
+
+float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit)
+{
+	if(current > rotstable)
+	{
+		if(rotframetime > 0)
+		{
+			current = CalcRot(current, rotstable, rotfactor, rotframetime);
+			current = max(rotstable, current - rotlinear * rotframetime);
+		}
+	}
+	else if(current < regenstable)
+	{
+		if(regenframetime > 0)
+		{
+			current = CalcRegen(current, regenstable, regenfactor, regenframetime);
+			current = min(regenstable, current + regenlinear * regenframetime);
+		}
+	}
+
+	if(current > limit)
+		current = limit;
+
+	return current;
+}
+
 void player_regen (void)
 {
-	float maxh, maxa, maxf, limith, limita, limitf, max_mod, regen_mod, rot_mod, limit_mod;
-	maxh = cvar("g_balance_health_stable");
-	maxa = cvar("g_balance_armor_stable");
-	maxf = cvar("g_balance_fuel_stable");
+	float minh, mina, minf, maxh, maxa, maxf, limith, limita, limitf, max_mod, regen_mod, rot_mod, limit_mod;
+	maxh = cvar("g_balance_health_rotstable");
+	maxa = cvar("g_balance_armor_rotstable");
+	maxf = cvar("g_balance_fuel_rotstable");
+	minh = cvar("g_balance_health_regenstable");
+	mina = cvar("g_balance_armor_regenstable");
+	minf = cvar("g_balance_fuel_regenstable");
 	limith = cvar("g_balance_health_limit");
 	limita = cvar("g_balance_armor_limit");
 	limitf = cvar("g_balance_fuel_limit");
@@ -1838,76 +1876,27 @@
 	maxh = maxh * max_mod;
 	//maxa = maxa * max_mod;
 	//maxf = maxf * max_mod;
+	minh = minh * max_mod;
+	//mina = mina * max_mod;
+	//minf = minf * max_mod;
 	limith = limith * limit_mod;
 	limita = limita * limit_mod;
 	//limitf = limitf * limit_mod;
 
+	if(g_lms)
+		rot_mod = 0;
+
 	if (!g_minstagib && (!g_lms || cvar("g_lms_regenerate")))
 	{
-		if (self.armorvalue > maxa)
-		{
-			if (time > self.pauserotarmor_finished)
-			{
-				self.armorvalue = max(maxa, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_rot") * frametime);
-				self.armorvalue = max(maxa, self.armorvalue - cvar("g_balance_armor_rotlinear") * frametime);
-			}
-		}
-		else if (self.armorvalue < maxa)
-		{
-			if (time > self.pauseregen_finished)
-			{
-				self.armorvalue = CalcRegen(self.armorvalue, maxa, cvar("g_balance_armor_regen"));
-				self.armorvalue = min(maxa, self.armorvalue + cvar("g_balance_armor_regenlinear") * frametime);
-			}
-		}
-		if (self.armorvalue > limita)
-			self.armorvalue = limita;
+		self.armorvalue = CalcRotRegen(self.armorvalue, mina, cvar("g_balance_armor_regen"), cvar("g_balance_armor_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished), maxa, cvar("g_balance_armor_rot"), cvar("g_balance_armor_rotlinear"), rot_mod * frametime * (time > self.pauserotarmor_finished), limita);
+		self.health = CalcRotRegen(self.health, minh, cvar("g_balance_health_regen"), cvar("g_balance_health_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished), maxh, cvar("g_balance_health_rot"), cvar("g_balance_health_rotlinear"), rot_mod * frametime * (time > self.pauserotarmor_finished), limith);
 
-		if (self.health > maxh)
-		{
-			if (time > self.pauserothealth_finished)
-			{
-				self.health = max(maxh, self.health + (maxh - self.health) * rot_mod*cvar("g_balance_health_rot") * frametime);
-				self.health = max(maxh, self.health - rot_mod*cvar("g_balance_health_rotlinear") * frametime);
-			}
-		}
-		else if (self.health < maxh)
-		{
-			if (time > self.pauseregen_finished)
-			{
-				self.health = CalcRegen(self.health, maxh, regen_mod * cvar("g_balance_health_regen"));
-				self.health = min(maxh, self.health + regen_mod*cvar("g_balance_health_regenlinear") * frametime);
-			}
-		}
-		if (self.health > limith)
-			self.health = limith;
-
 		// if player rotted to death...  die!
 		if(self.health < 1)
 			self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
 	}
 
-	if (self.ammo_fuel > maxf)
-	{
-		if (time > self.pauserotfuel_finished)
-		{
-			self.ammo_fuel = max(maxf, self.ammo_fuel + (maxf - self.ammo_fuel) * rot_mod*cvar("g_balance_fuel_rot") * frametime);
-			self.ammo_fuel = max(maxf, self.ammo_fuel - rot_mod*cvar("g_balance_fuel_rotlinear") * frametime);
-		}
-	}
-	else if (self.ammo_fuel < maxf)
-	{
-		if(self.items & IT_FUEL_REGEN)
-		{
-			if (time > self.pauseregen_finished)
-			{
-				self.ammo_fuel = CalcRegen(self.ammo_fuel, maxf, regen_mod * cvar("g_balance_fuel_regen"));
-				self.ammo_fuel = min(maxf, self.ammo_fuel + regen_mod*cvar("g_balance_fuel_regenlinear") * frametime);
-			}
-		}
-	}
-	if (self.ammo_fuel > limitf)
-		self.ammo_fuel = limitf;
+	self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, cvar("g_balance_fuel_regen"), cvar("g_balance_fuel_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished), maxf, cvar("g_balance_fuel_rot"), cvar("g_balance_fuel_rotlinear"), rot_mod * frametime * (time > self.pauserotfuel_finished), limitf);
 }
 
 float zoomstate_set;

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2009-06-28 15:49:29 UTC (rev 7122)
+++ trunk/data/qcsrc/server/constants.qh	2009-06-29 06:06:00 UTC (rev 7123)
@@ -1,4 +1,4 @@
-string CVAR_CHECK_DEFAULT = "53ad20239e3fbf681eb91c2436691158";
+string CVAR_CHECK_DEFAULT = "99547c339e474ecb1b5758a604370575";
 string CVAR_CHECK_WEAPONS = "4f7b4c1e2feeef4988b02a93ff35a2ca";
 
 float	FALSE					= 0;

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2009-06-28 15:49:29 UTC (rev 7122)
+++ trunk/data/qcsrc/server/defs.qh	2009-06-29 06:06:00 UTC (rev 7123)
@@ -516,7 +516,6 @@
 // we're using + here instead of , because fteqcc sucks
 
 string clientstuff;
-.float stat_sys_ticrate;
 .float phase;
 .float weapons;
 .float pressedkeys;

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2009-06-28 15:49:29 UTC (rev 7122)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2009-06-29 06:06:00 UTC (rev 7123)
@@ -937,7 +937,7 @@
     {
         g_grappling_hook = 0; // these two can't coexist, as they use the same button
         start_items |= IT_FUEL_REGEN;
-        start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_stable"));
+        start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
     }
 
     if (g_jetpack)



More information about the nexuiz-commits mailing list