From: Samual Lenks <samual@xonotic.org>
Date: Tue, 14 May 2013 02:05:49 +0000 (-0400)
Subject: Add the new effects and cvars for spawning
X-Git-Tag: xonotic-v0.7.0~50^2~2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=41dc5f919224f61262e51e2130128216418af548;p=xonotic%2Fxonotic-data.pk3dir.git

Add the new effects and cvars for spawning
---

diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg
index cd8b472a7..9bbc16b81 100644
--- a/defaultXonotic.cfg
+++ b/defaultXonotic.cfg
@@ -74,6 +74,11 @@ seta cl_unpress_zoom_on_death 1 "automatically unpress zoom when you die (and do
 seta cl_unpress_zoom_on_weapon_switch 1 "automatically unpress zoom when you switch a weapon"
 seta cl_unpress_attack_on_weapon_switch 1 "automatically unpress fire and fire1 attack buttons when you switch a weapon"
 
+seta cl_spawn_event_particles 1 "pointparticles effect whenever a player spawns"
+seta cl_spawn_event_sound 1 "sound effect whenever a player spawns"
+//seta cl_spawn_point_model 0 "place a model at all spawn points" // still needs a model
+seta cl_spawn_point_particles 1 "pointparticles effect at all spawn points"
+
 freelook 1
 sensitivity 6
 v_gamma 1
diff --git a/effectinfo.txt b/effectinfo.txt
index d346a30ef..c2f702fa5 100644
--- a/effectinfo.txt
+++ b/effectinfo.txt
@@ -7778,3 +7778,202 @@ alpha 190 190 180
 sizeincrease -80
 color 0x0000FF 0x000097
 
+// spawn_point_red -- red team idle spawn point effect
+effect spawn_point_red
+count 37.5
+type static
+color 0xFF0F0F 0xFF0F0F
+size 1.0 2.0
+alpha 64 128 128
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 16 16 64
+velocityjitter 32 32 0
+//lightradius 200
+//lighttime 0
+//lightcolor 0.4 0.9 0.9
+
+// spawn_point_blue -- blue team idle spawn point effect
+effect spawn_point_blue
+count 37.5
+type static
+color 0x0F0FFF 0x0F0FFF
+size 1.0 2.0
+alpha 64 128 128
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 16 16 64
+velocityjitter 32 32 0
+//lightradius 200
+//lighttime 0
+//lightcolor 0.4 0.9 0.9
+
+// spawn_point_yellow -- yellow team idle spawn point effect
+effect spawn_point_yellow
+count 37.5
+type static
+color 0xFFFF0F 0xFFFF0F
+size 1.0 2.0
+alpha 64 128 128
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 16 16 64
+velocityjitter 32 32 0
+//lightradius 200
+//lighttime 0
+//lightcolor 0.4 0.9 0.9
+
+// spawn_point_pink -- pink team idle spawn point effect
+effect spawn_point_pink
+count 37.5
+type static
+color 0xFF0FFF 0xFF0FFF
+size 1.0 2.0
+alpha 64 128 128
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 16 16 64
+velocityjitter 32 32 0
+//lightradius 200
+//lighttime 0
+//lightcolor 0.4 0.9 0.9
+
+// spawn_point_neutral -- neutral idle spawn point effect
+effect spawn_point_neutral
+count 37.5
+type static
+color 0xFFFFFF 0xFFFFFF
+size 1.0 2.0
+alpha 64 128 128
+gravity -0.1
+airfriction 0.2
+liquidfriction 0.8
+originjitter 16 16 64
+velocityjitter 32 32 0
+//lightradius 200
+//lighttime 0
+//lightcolor 0.4 0.9 0.9
+
+// spawn_event_red -- red team spawning effect
+effect spawn_event_red
+count 100
+type spark
+tex 64 64
+color 0xFF0F0F 0xFF0F0F
+size 1 1
+alpha 0 256 256
+stretchfactor 0.6
+//gravity 1
+bounce 1
+originjitter 1 1 1
+velocityjitter 500 500 500
+velocitymultiplier 0.1
+airfriction 2
+effect spawn_event_red
+countabsolute 1
+type smoke
+tex 65 65
+size 100 100
+alpha 190 190 180
+sizeincrease -80
+color 0xFF0F0F 0xFF0F0F
+
+// spawn_event_blue -- blue team spawning effect
+effect spawn_event_blue
+count 100
+type spark
+tex 64 64
+color 0x0F0FFF 0x0F0FFF
+size 1 1
+alpha 0 256 256
+stretchfactor 0.6
+//gravity 1
+bounce 1
+originjitter 1 1 1
+velocityjitter 500 500 500
+velocitymultiplier 0.1
+airfriction 2
+effect spawn_event_blue
+countabsolute 1
+type smoke
+tex 65 65
+size 100 100
+alpha 190 190 180
+sizeincrease -80
+color 0x0F0FFF 0x0F0FFF
+
+// spawn_event_yellow -- yellow team spawning effect
+effect spawn_event_yellow
+count 100
+type spark
+tex 64 64
+color 0xFFFF0F 0xFFFF0F
+size 1 1
+alpha 0 256 256
+stretchfactor 0.6
+//gravity 1
+bounce 1
+originjitter 1 1 1
+velocityjitter 500 500 500
+velocitymultiplier 0.1
+airfriction 2
+effect spawn_event_yellow
+countabsolute 1
+type smoke
+tex 65 65
+size 100 100
+alpha 190 190 180
+sizeincrease -80
+color 0xFFFF0F 0xFFFF0F
+
+// spawn_event_pink -- pink team spawning effect
+effect spawn_event_pink
+count 100
+type spark
+tex 64 64
+color 0xFF0FFF 0xFF0FFF
+size 1 1
+alpha 0 256 256
+stretchfactor 0.6
+//gravity 1
+bounce 1
+originjitter 1 1 1
+velocityjitter 500 500 500
+velocitymultiplier 0.1
+airfriction 2
+effect spawn_event_pink
+countabsolute 1
+type smoke
+tex 65 65
+size 100 100
+alpha 190 190 180
+sizeincrease -80
+color 0xFF0FFF 0xFF0FFF
+
+// spawn_event_neutral -- neutral spawning effect
+effect spawn_event_neutral
+count 100
+type spark
+tex 64 64
+color 0xFFFFFF 0xFFFFFF
+size 1 1
+alpha 0 256 256
+stretchfactor 0.6
+//gravity 1
+bounce 1
+originjitter 1 1 1
+velocityjitter 500 500 500
+velocitymultiplier 0.1
+airfriction 2
+effect spawn_event_neutral
+countabsolute 1
+type smoke
+tex 65 65
+size 100 100
+alpha 190 190 180
+sizeincrease -80
+color 0xFFFFFF 0xFFFFFF
diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc
index e480d0ef1..c4dec4c55 100644
--- a/qcsrc/client/Main.qc
+++ b/qcsrc/client/Main.qc
@@ -698,39 +698,46 @@ void Ent_ReadAccuracy(void)
 
 void Spawn_Draw(void)
 {
-	pointparticles(self.cnt, self.origin, '0 0 2', bound(0, frametime, 0.1));
+	pointparticles(self.cnt, self.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
 }
 
 void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
 {
-	float teamnum = ReadByte();
+	float teamnum = (ReadByte() - 1);
 	self.origin_x = ReadShort();
 	self.origin_y = ReadShort();
 	self.origin_z = ReadShort();
 
+	setsize(self, PL_MIN, PL_MAX);
+	droptofloor();
+	
 	if(is_new)
 	{
-		switch(teamnum)
+		if(autocvar_cl_spawn_point_particles)
 		{
-			default: self.cnt = particleeffectnum("EF_STARDUST"); break;
+			switch(teamnum)
+			{
+				case NUM_TEAM_1: self.cnt = particleeffectnum("spawn_point_red"); break;
+				case NUM_TEAM_2: self.cnt = particleeffectnum("spawn_point_blue"); break;
+				case NUM_TEAM_3: self.cnt = particleeffectnum("spawn_point_yellow"); break;
+				case NUM_TEAM_4: self.cnt = particleeffectnum("spawn_point_pink"); break;
+				default: self.cnt = particleeffectnum("spawn_point_neutral"); break;
+			}
+			self.draw = Spawn_Draw;
 		}
-		
-		//self.colormod = '200 0 0'; //colormapPaletteColor(teamnum - 1, FALSE);
-
-		//setsize(self, PL_MIN, PL_MAX);
-
-		//droptofloor();
-
-		//self.mdl = "models/domination/dom_unclaimed.md3";
-		//precache_model(self.mdl);
-		//setmodel(self, self.mdl);
-		self.drawmask = MASK_NORMAL;
-		self.movetype = MOVETYPE_NOCLIP;
-		self.draw = Spawn_Draw;
-		
+		/*if(autocvar_cl_spawn_point_model) // needs a model first
+		{
+			self.mdl = "models/spawnpoint.md3";
+			self.colormod = Team_ColorRGB(teamnum);
+			precache_model(self.mdl);
+			setmodel(self, self.mdl);
+			self.drawmask = MASK_NORMAL;
+			//self.movetype = MOVETYPE_NOCLIP;
+			//self.draw = Spawn_Draw;
+		}*/
 	}
 
-	print(sprintf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d (%s)\n", is_new, vtos(self.origin), teamnum, "foobar"));
+	print(sprintf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d, effect = %d\n", is_new, vtos(self.origin), teamnum, self.cnt));
 }
 
 void Ent_ReadSpawnEvent(float is_new)
@@ -749,15 +756,20 @@ void Ent_ReadSpawnEvent(float is_new)
 		if(is_new)
 		{
 			float teamnum = GetPlayerColor(entnum - 1);
-			//if(autocvar_cl_spawn_event_sound)
+
+			if(autocvar_cl_spawn_event_sound)
 			{
 				sound(self, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTN_NORM);
 			}
-			//if(autocvar_cl_spawn_event_particles)
+			if(autocvar_cl_spawn_event_particles)
 			{
 				switch(teamnum)
 				{
-					default: pointparticles(particleeffectnum("red_cap"), self.origin, '0 0 0', 1); break;
+					case NUM_TEAM_1: pointparticles(particleeffectnum("spawn_event_red"), self.origin, '0 0 0', 1); break;
+					case NUM_TEAM_2: pointparticles(particleeffectnum("spawn_event_blue"), self.origin, '0 0 0', 1); break;
+					case NUM_TEAM_3: pointparticles(particleeffectnum("spawn_event_yellow"), self.origin, '0 0 0', 1); break;
+					case NUM_TEAM_4: pointparticles(particleeffectnum("spawn_event_pink"), self.origin, '0 0 0', 1); break;
+					default: pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); break;
 				}
 			}
 		}
@@ -776,7 +788,7 @@ void Ent_ReadSpawnEvent(float is_new)
 		}
 	}
 	
-	print(sprintf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d (%s), localentnum = %d\n", is_new, vtos(self.origin), entnum, player_localentnum, "foobar"));
+	print(sprintf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d, localentnum = %d\n", is_new, vtos(self.origin), entnum, player_localentnum));
 }
 
 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh
index f8343221d..16714460b 100644
--- a/qcsrc/client/autocvars.qh
+++ b/qcsrc/client/autocvars.qh
@@ -63,6 +63,10 @@ var float autocvar_cl_reticle = 1;
 float autocvar_cl_reticle_item_nex;
 float autocvar_cl_reticle_item_normal;
 float autocvar_cl_reticle_stretch;
+float autocvar_cl_spawn_event_particles;
+var float autocvar_cl_spawn_event_sound = 1;
+// float autocvar_cl_spawn_point_model;
+float autocvar_cl_spawn_point_particles;
 var float autocvar_cl_spawnzoom = 1;
 var float autocvar_cl_spawnzoom_speed = 1;
 var float autocvar_cl_spawnzoom_factor = 2;
diff --git a/qcsrc/common/teams.qh b/qcsrc/common/teams.qh
index db3a39bcd..cde71c7b3 100644
--- a/qcsrc/common/teams.qh
+++ b/qcsrc/common/teams.qh
@@ -63,10 +63,10 @@ vector Team_ColorRGB(float teamid)
 {
 	switch(teamid)
 	{
-		case NUM_TEAM_1: return '1 0.0625 0.0625';
-		case NUM_TEAM_2: return '0.0625 0.0625 1';
-		case NUM_TEAM_3: return '1 1 0.0625';
-		case NUM_TEAM_4: return '1 0.0625 1';
+		case NUM_TEAM_1: return '1 0.0625 0.0625'; // 0xFF0F0F
+		case NUM_TEAM_2: return '0.0625 0.0625 1'; // 0x0F0FFF
+		case NUM_TEAM_3: return '1 1 0.0625'; // 0xFFFF0F
+		case NUM_TEAM_4: return '1 0.0625 1'; // 0xFF0FFF
 	}
 
     return '0 0 0';