// Look for clients who have spawned
playing = false;
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
- if(host_client->spawned)
+ if(host_client->begun)
if(host_client->netconnection)
playing = true;
if(sv.time < 10)
PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name);
if (strcmp(host_client->old_name, host_client->name))
{
- if (host_client->spawned)
+ if (host_client->begun)
SV_BroadcastPrintf("%s ^7changed name to %s\n", host_client->old_name, host_client->name);
strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name));
// send notification to all clients
PRVM_serveredictstring(host_client->edict, playerskin) = PRVM_SetEngineString(prog, host_client->playerskin);
if (strcmp(host_client->old_skin, host_client->playerskin))
{
- //if (host_client->spawned)
+ //if (host_client->begun)
// SV_BroadcastPrintf("%s changed skin to %s\n", host_client->name, host_client->playerskin);
strlcpy(host_client->old_skin, host_client->playerskin, sizeof(host_client->old_skin));
/*// send notification to all clients
*/
static void Host_PreSpawn_f (void)
{
- if (host_client->spawned)
+ if (host_client->prespawned)
{
- Con_Print("prespawn not valid -- already spawned\n");
+ Con_Print("prespawn not valid -- already prespawned\n");
return;
}
+ host_client->prespawned = true;
if (host_client->netconnection)
{
client_t *client;
int stats[MAX_CL_STATS];
+ if (!host_client->prespawned)
+ {
+ Con_Print("Spawn not valid -- not yet prespawned\n");
+ return;
+ }
if (host_client->spawned)
{
Con_Print("Spawn not valid -- already spawned\n");
return;
}
+ host_client->spawned = true;
// reset name change timer again because they might want to change name
// again in the first 5 seconds after connecting
*/
static void Host_Begin_f (void)
{
- host_client->spawned = true;
+ if (!host_client->spawned)
+ {
+ Con_Print("Begin not valid -- not yet spawned\n");
+ return;
+ }
+ if (host_client->begun)
+ {
+ Con_Print("Begin not valid -- already begun\n");
+ return;
+ }
+ host_client->begun = true;
// LordHavoc: note: this code also exists in SV_DropClient
if (sv.loadgame)
return true;
}
}
- if (client->spawned)
+ if (client->begun)
{
// client crashed and is coming back,
// keep their stuff intact
// if client is already spawned, re-send the
// serverinfo message as they'll need it to play
- if (client->spawned)
+ if (client->begun)
SV_SendServerinfo(client);
return true;
}
}
if (host_client)
{
- if ((ret = NetConn_ReceivedMessage(host_client->netconnection, data, length, sv.protocol, host_client->spawned ? net_messagetimeout.value : net_connecttimeout.value)) == 2)
+ if ((ret = NetConn_ReceivedMessage(host_client->netconnection, data, length, sv.protocol, host_client->begun ? net_messagetimeout.value : net_connecttimeout.value)) == 2)
{
SV_ReadClientMessage();
return ret;
qboolean active;
/// false = don't do ClientDisconnect on drop
qboolean clientconnectcalled;
- /// false = don't send datagrams
+ /// false = don't allow spawn
+ qboolean prespawned;
+ /// false = don't allow begin
qboolean spawned;
+ /// false = don't send datagrams
+ qboolean begun;
/// 1 = send svc_serverinfo and advance to 2, 2 doesn't send, then advances to 0 (allowing unlimited sending) when prespawn is received
int sendsignon;
MSG_WriteByte (&client->netconnection->message, svc_signonnum);
MSG_WriteByte (&client->netconnection->message, 1);
+ client->prespawned = false; // need prespawn, spawn, etc
client->spawned = false; // need prespawn, spawn, etc
+ client->begun = false; // need prespawn, spawn, etc
client->sendsignon = 1; // send this message, and increment to 2, 2 will be set to 0 by the prespawn command
// clear movement info until client enters the new level properly
strlcpy(client->name, "unconnected", sizeof(client->name));
strlcpy(client->old_name, "unconnected", sizeof(client->old_name));
+ client->prespawned = false;
client->spawned = false;
+ client->begun = false;
client->edict = PRVM_EDICT_NUM(clientnum+1);
if (client->netconnection)
client->netconnection->message.allowoverflow = true; // we can catch it
if (client->netconnection)
SV_SendServerinfo (client);
else
- client->spawned = true;
+ client->prespawned = client->spawned = client->begun = true;
}
return;
for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
{
- if (!client->spawned || !client->netconnection || client->unreliablemsg.cursize + sv.datagram.cursize > client->unreliablemsg.maxsize || client->unreliablemsg_splitpoints >= (int)(sizeof(client->unreliablemsg_splitpoint)/sizeof(client->unreliablemsg_splitpoint[0])))
+ if (!client->begun || !client->netconnection || client->unreliablemsg.cursize + sv.datagram.cursize > client->unreliablemsg.maxsize || client->unreliablemsg_splitpoints >= (int)(sizeof(client->unreliablemsg_splitpoint)/sizeof(client->unreliablemsg_splitpoint[0])))
continue;
SZ_Write(&client->unreliablemsg, sv.datagram.data, sv.datagram.cursize);
client->unreliablemsg_splitpoint[client->unreliablemsg_splitpoints++] = client->unreliablemsg.cursize;
msg.cursize = 0;
msg.allowoverflow = false;
- if (host_client->spawned)
+ if (host_client->begun)
{
// the player is in the game
MSG_WriteByte (&msg, svc_time);
PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name);
if (strcmp(host_client->old_name, host_client->name))
{
- if (host_client->spawned)
+ if (host_client->begun)
SV_BroadcastPrintf("%s ^7changed name to %s\n", host_client->old_name, host_client->name);
strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name));
// send notification to all clients
// frags
host_client->frags = (int)PRVM_serveredictfloat(host_client->edict, frags);
if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
- if(!host_client->spawned && host_client->netconnection)
+ if(!host_client->begun && host_client->netconnection)
host_client->frags = -666;
if (host_client->old_frags != host_client->frags)
{
}
for (j = 0, client = svs.clients;j < svs.maxclients;j++, client++)
- if (client->netconnection && (client->spawned || client->clientconnectcalled)) // also send MSG_ALL to people who are past ClientConnect, but not spawned yet
+ if (client->netconnection && (client->begun || client->clientconnectcalled)) // also send MSG_ALL to people who are past ClientConnect, but not spawned yet
SZ_Write (&client->netconnection->message, sv.reliable_datagram.data, sv.reliable_datagram.cursize);
SZ_Clear (&sv.reliable_datagram);
// and we need to set the ->edict pointers to point into the progs edicts
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
{
- host_client->spawned = false;
+ host_client->begun = false;
host_client->edict = PRVM_EDICT_NUM(i + 1);
PRVM_ED_ClearEdict(prog, host_client->edict);
}
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(ClientConnect), "QC function ClientConnect is missing");
prog->ExecuteProgram(prog, PRVM_serverfunction(PutClientInServer), "QC function PutClientInServer is missing");
- host_client->spawned = true;
+ host_client->begun = true;
}
}
playing = false;
if (sv.active)
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
- if(host_client->spawned)
+ if(host_client->begun)
if(host_client->netconnection)
playing = true;
if(sv.time < 10)
{
prvm_prog_t *prog = SVVM_prog;
// don't do physics on disconnected clients, FrikBot relies on this
- if (!host_client->spawned)
+ if (!host_client->begun)
return;
// make sure the velocity is sane (not a NaN)
{
prvm_prog_t *prog = SVVM_prog;
// don't do physics on disconnected clients, FrikBot relies on this
- if (!host_client->spawned)
+ if (!host_client->begun)
return;
// make sure the velocity is sane (not a NaN)
{
prvm_prog_t *prog = SVVM_prog;
// don't do physics on disconnected clients, FrikBot relies on this
- if (!host_client->spawned)
+ if (!host_client->begun)
{
memset(&host_client->cmd, 0, sizeof(host_client->cmd));
return;
if (sv_numreadmoves < 1)
return;
// only start accepting input once the player is spawned
- if (!host_client->spawned)
+ if (!host_client->begun)
return;
#if DEBUGMOVES
Con_Printf("SV_ExecuteClientMoves: read %i moves at sv.time %f\n", sv_numreadmoves, (float)sv.time);
// if the client hasn't progressed through signons yet,
// ignore any clc_ackframes we get (they're probably from the
// previous level)
- if (host_client->spawned && host_client->latestframenum < num)
+ if (host_client->begun && host_client->latestframenum < num)
{
int i;
for (i = host_client->latestframenum + 1;i < num;i++)