f *= 2;
}
}
-.float last_spawn_time;
+
void Spawn_Draw(void)
{
- pointparticles(particleeffectnum("EF_STARDUST"), self.origin, '0 0 2', bound(0, frametime, 0.1));
+ pointparticles(self.cnt, self.origin, '0 0 2', bound(0, frametime, 0.1));
}
-void Ent_ReadSpawnPoint(float is_new)
+void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
{
- float sendflag = ReadByte();
+ float teamnum = ReadByte();
+ self.origin_x = ReadShort();
+ self.origin_y = ReadShort();
+ self.origin_z = ReadShort();
+
+ if(is_new)
+ {
+ switch(teamnum)
+ {
+ default: self.cnt = particleeffectnum("EF_STARDUST"); break;
+ }
+
+ //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;
+
+ }
+
+ print(sprintf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d (%s)\n", is_new, vtos(self.origin), teamnum, "foobar"));
+}
- if(sendflag & 1)
+void Ent_ReadSpawnEvent(float is_new)
+{
+ // If entnum is 0, ONLY do the local spawn actions
+ // this way the server can disable the sending of
+ // spawn origin or such to clients if wanted.
+ float entnum = ReadByte();
+
+ if(entnum)
{
- self.team = ReadByte();
self.origin_x = ReadShort();
self.origin_y = ReadShort();
self.origin_z = ReadShort();
+
+ if(is_new)
+ {
+ float teamnum = GetPlayerColor(entnum - 1);
+ //if(autocvar_cl_spawn_event_sound)
+ {
+ sound(self, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTN_NORM);
+ }
+ //if(autocvar_cl_spawn_event_particles)
+ {
+ switch(teamnum)
+ {
+ default: pointparticles(particleeffectnum("red_cap"), self.origin, '0 0 0', 1); break;
+ }
+ }
+ }
}
- if(sendflag & 2)
+
+ // local spawn actions
+ if(is_new && (!entnum || (entnum == player_localentnum)))
{
- self.last_spawn_time = ReadLong();
- }
+ zoomin_effect = 1;
+ current_viewzoom = (1 / bound(1, autocvar_cl_spawnzoom_factor, 16));
- if(self.last_spawn_time) { pointparticles(particleeffectnum("fireball_muzzleflash"), self.origin, '0 0 2', 1); self.last_spawn_time = 0; }
+ if(autocvar_cl_unpress_zoom_on_spawn)
+ {
+ localcmd("-zoom\n");
+ button_zoom = FALSE;
+ }
+ }
-
- self.colormod = '200 0 0'; //colormapPaletteColor(self.team - 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;
-
- print(sprintf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d (%s)\n", is_new, vtos(self.origin), self.team, "foobar"));
+ print(sprintf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d (%s), localentnum = %d\n", is_new, vtos(self.origin), entnum, player_localentnum, "foobar"));
}
// CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;
case ENT_CLIENT_BUMBLE_RAYGUN: bumble_raygun_read(bIsNewEntity); break;
case ENT_CLIENT_SPAWNPOINT: Ent_ReadSpawnPoint(bIsNewEntity); break;
+ case ENT_CLIENT_SPAWNEVENT: Ent_ReadSpawnEvent(bIsNewEntity); break;
case ENT_CLIENT_NOTIFICATION: Read_Notification(bIsNewEntity); break;
default:
}
}
-void Net_ReadSpawn()
-{
- zoomin_effect = 1;
- current_viewzoom = (1 / bound(1, autocvar_cl_spawnzoom_factor, 16));
-
- if(autocvar_cl_unpress_zoom_on_spawn)
- {
- localcmd("-zoom\n");
- button_zoom = FALSE;
- }
-}
-
void Net_TeamNagger()
{
teamnagger = 1;
Net_ReadRace();
bHandled = true;
break;
- case TE_CSQC_SPAWN:
- Net_ReadSpawn();
- bHandled = true;
- break;
case TE_CSQC_ZCURVEPARTICLES:
Net_ReadZCurveParticles();
bHandled = true;
const float TE_CSQC_PICTURE = 100;
const float TE_CSQC_RACE = 101;
-const float TE_CSQC_SPAWN = 102;
-const float TE_CSQC_ZCURVEPARTICLES = 103;
-const float TE_CSQC_NEXGUNBEAMPARTICLE = 104;
-const float TE_CSQC_LIGHTNINGARC = 105;
-const float TE_CSQC_TEAMNAGGER = 106;
-const float TE_CSQC_PINGPLREPORT = 107;
-const float TE_CSQC_TARGET_MUSIC = 108;
-const float TE_CSQC_WEAPONCOMPLAIN = 109;
-const float TE_CSQC_NEX_SCOPE = 110;
-const float TE_CSQC_MINELAYER_MAXMINES = 111;
-const float TE_CSQC_HAGAR_MAXROCKETS = 112;
-const float TE_CSQC_VEHICLESETUP = 113;
-const float TE_CSQC_SVNOTICE = 114;
+const float TE_CSQC_ZCURVEPARTICLES = 102;
+const float TE_CSQC_NEXGUNBEAMPARTICLE = 103;
+const float TE_CSQC_LIGHTNINGARC = 104;
+const float TE_CSQC_TEAMNAGGER = 105;
+const float TE_CSQC_PINGPLREPORT = 106;
+const float TE_CSQC_TARGET_MUSIC = 107;
+const float TE_CSQC_WEAPONCOMPLAIN = 108;
+const float TE_CSQC_NEX_SCOPE = 109;
+const float TE_CSQC_MINELAYER_MAXMINES = 110;
+const float TE_CSQC_HAGAR_MAXROCKETS = 111;
+const float TE_CSQC_VEHICLESETUP = 112;
+const float TE_CSQC_SVNOTICE = 113;
const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
const float RACE_NET_CHECKPOINT_CLEAR = 1;
const float ENT_CLIENT_ITEM = 34;
const float ENT_CLIENT_BUMBLE_RAYGUN = 35;
const float ENT_CLIENT_SPAWNPOINT = 36;
-const float ENT_CLIENT_NOTIFICATION = 37;
+const float ENT_CLIENT_SPAWNEVENT = 37;
+const float ENT_CLIENT_NOTIFICATION = 38;
const float ENT_CLIENT_TURRET = 40;
const float ENT_CLIENT_AUXILIARYXHAIR = 50;
Called when a client spawns in the server
=============
*/
-
+float SpawnEvent_Send(entity to, float sf);
void PutClientInServer (void)
{
if(IS_BOT_CLIENT(self))
self.oldvelocity = self.velocity;
self.fire_endtime = -1;
- msg_entity = self;
- WRITESPECTATABLE_MSG_ONE({
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_SPAWN);
- });
+ entity spawnevent = spawn();
+ spawnevent.owner = self;
+ Net_LinkEntity(spawnevent, FALSE, 1, SpawnEvent_Send);
self.model = "";
FixPlayermodel();
self.alivetime = time;
antilag_clear(self);
-
- if (autocvar_g_spawnsound)
- soundat(world, self.origin, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTN_NORM);
- } else if(IS_OBSERVER(self)) {
+ }
+ else if(IS_OBSERVER(self))
+ {
PutObserverInServer ();
}
}
-
-.float last_spawn_time;
-.float send_spawn;
-float Spawn_Send(entity to, float sf)
+float SpawnPoint_Send(entity to, float sf)
{
WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT);
- WriteByte(MSG_ENTITY, sf);
-
- if(sf & 1)
- {
- WriteByte(MSG_ENTITY, self.team);
- WriteShort(MSG_ENTITY, self.origin_x);
- WriteShort(MSG_ENTITY, self.origin_y);
- WriteShort(MSG_ENTITY, self.origin_z);
- }
- if(sf & 2)
- {
- WriteLong(MSG_ENTITY, self.last_spawn_time);
- }
-
+
+ WriteByte(MSG_ENTITY, self.team);
+ WriteShort(MSG_ENTITY, self.origin_x);
+ WriteShort(MSG_ENTITY, self.origin_y);
+ WriteShort(MSG_ENTITY, self.origin_z);
+
return TRUE;
}
-void Spawn_Think(void)
+float SpawnEvent_Send(entity to, float sf)
{
- if(self.send_spawn < 0)
+ float send;
+
+ WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT);
+
+ if(autocvar_g_spawnsound)
{
- self.send_spawn = 0;
- self.SendFlags |= 1;
+ WriteByte(MSG_ENTITY, num_for_edict(self.owner));
+ WriteShort(MSG_ENTITY, self.owner.origin_x);
+ WriteShort(MSG_ENTITY, self.owner.origin_y);
+ WriteShort(MSG_ENTITY, self.owner.origin_z);
+ send = TRUE;
}
- else
+ else if((to == self.owner) || (IS_SPEC(to) && (to.enemy == self.owner)) )
{
- self.last_spawn_time = self.send_spawn;
- self.send_spawn = 0;
- self.SendFlags |= 2;
+ WriteByte(MSG_ENTITY, 0);
+ send = TRUE;
}
+ else { send = FALSE; }
+
+ return send;
}
void spawnpoint_use()
some_spawn_has_been_used = 1;
}
print("spawnpoint was used!\n");
- self.send_spawn = time;
- self.nextthink = time;
}
void relocate_spawnpoint()
e.solid = SOLID_TRIGGER;
}
- self.send_spawn = -1;
- self.think = Spawn_Think;
- self.nextthink = time;
+ //self.send_spawn = -1;
+ //self.think = Spawn_Think;
+ //self.nextthink = time;
- Net_LinkEntity(self, FALSE, 0, Spawn_Send);
+ Net_LinkEntity(self, FALSE, 0, SpawnPoint_Send);
}
void spawnfunc_info_player_survivor (void)
if(spot.target == "")
return '-1 0 0';
- if(clienttype(self) == CLIENTTYPE_REAL)
+ if(IS_REAL_CLIENT(self))
{
if(spot.restriction == 1)
return '-1 0 0';