[nexuiz-commits] r6719 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue May 12 11:16:42 EDT 2009


Author: div0
Date: 2009-05-12 11:16:41 -0400 (Tue, 12 May 2009)
New Revision: 6719

Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/t_items.qc
Log:
items: randomize initial spawn of powerups fully
regeneration: always regenerate fuel, even in LMS


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2009-05-12 13:35:36 UTC (rev 6718)
+++ trunk/data/qcsrc/server/cl_client.qc	2009-05-12 15:16:41 UTC (rev 6719)
@@ -1745,9 +1745,6 @@
 	limita = cvar("g_balance_armor_limit");
 	limitf = cvar("g_balance_fuel_limit");
 
-	if (g_minstagib || (g_lms && !cvar("g_lms_regenerate")))
-		return;
-
 	max_mod = regen_mod = rot_mod = limit_mod = 1;
 
 	if (self.runes & RUNE_REGEN)
@@ -1783,38 +1780,51 @@
 	limita = limita * limit_mod;
 	//limitf = limitf * limit_mod;
 
-	if (self.armorvalue > maxa)
+	if (!g_minstagib && (!g_lms || cvar("g_lms_regenerate")))
 	{
-		if (time > self.pauserotarmor_finished)
+		if (self.armorvalue > maxa)
 		{
-			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);
+			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)
+		else if (self.armorvalue < maxa)
 		{
-			self.armorvalue = CalcRegen(self.armorvalue, maxa, cvar("g_balance_armor_regen"));
-			self.armorvalue = min(maxa, self.armorvalue + cvar("g_balance_armor_regenlinear") * frametime);
+			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.health > maxh)
-	{
-		if (time > self.pauserothealth_finished)
+		if (self.armorvalue > limita)
+			self.armorvalue = limita;
+
+		if (self.health > maxh)
 		{
-			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);
+			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)
+		else if (self.health < maxh)
 		{
-			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 (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)
@@ -1834,17 +1844,8 @@
 			}
 		}
 	}
-
-	if (self.health > limith)
-		self.health = limith;
-	if (self.armorvalue > limita)
-		self.armorvalue = limita;
 	if (self.ammo_fuel > limitf)
 		self.ammo_fuel = limitf;
-
-	// if player rotted to death...  die!
-	if(self.health < 1)
-		self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
 }
 
 float zoomstate_set;

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2009-05-12 13:35:36 UTC (rev 6718)
+++ trunk/data/qcsrc/server/t_items.qc	2009-05-12 15:16:41 UTC (rev 6719)
@@ -1,4 +1,7 @@
-#define ITEM_RESPAWNTIME(i) ((i).respawntime + crandom() * (i).respawntimejitter)
+#define ITEM_RESPAWNTIME(i)         ((i).respawntime + crandom() * (i).respawntimejitter)
+	// range: respawntime - respawntimejitter .. respawntime + respawntimejitter
+#define ITEM_RESPAWNTIME_INITIAL(i) (10 + random() * ((i).respawntime + (i).respawntimejitter - 10))
+	// range: 10 .. respawntime + respawntimejitter
 
 floatfield Item_CounterField(float it)
 {
@@ -99,21 +102,31 @@
 	}
 }
 
-void Item_ScheduleRespawn(entity e)
+void Item_ScheduleRespawnIn(entity e, float t)
 {
 	if(e.flags & FL_POWERUP)
 	{
 		e.think = Item_RespawnCountdown;
-		e.nextthink = time + ITEM_RESPAWNTIME(e) - 5;
+		e.nextthink = time + max(0, t - 5);
 		e.count = 0;
 	}
 	else
 	{
 		e.think = Item_Respawn;
-		e.nextthink = time + ITEM_RESPAWNTIME(e);
+		e.nextthink = time + t;
 	}
 }
 
+void Item_ScheduleRespawn(entity e)
+{
+	Item_ScheduleRespawnIn(e, ITEM_RESPAWNTIME(e));
+}
+
+void Item_ScheduleInitialRespawn(entity e)
+{
+	Item_ScheduleRespawnIn(e, ITEM_RESPAWNTIME_INITIAL(e));
+}
+
 float Item_GiveTo(entity item, entity player)
 {
 	float _switchweapon;
@@ -381,7 +394,7 @@
 		{
 			e.solid = SOLID_NOT;
 			e.model = string_null;
-			Item_ScheduleRespawn(e);
+			Item_ScheduleInitialRespawn(e);
 		}
 	}
 }
@@ -406,7 +419,7 @@
 	{
 		self.solid = SOLID_NOT;
 		self.model = string_null;
-		Item_ScheduleRespawn(self);
+		Item_ScheduleInitialRespawn(self);
 	}
 }
 
@@ -656,7 +669,7 @@
 	{
 		self.solid = SOLID_NOT;
 		self.model = string_null;
-		Item_ScheduleRespawn(self);
+		Item_ScheduleInitialRespawn(self);
 	}
 }
 



More information about the nexuiz-commits mailing list