if (volume < 0 || volume > 255)
{
- Con_Printf ("SV_StartSound: volume = %i", volume);
+ Con_Printf ("SV_StartSound: volume = %i\n", volume);
return;
}
if (attenuation < 0 || attenuation > 4)
{
- Con_Printf ("SV_StartSound: attenuation = %f", attenuation);
+ Con_Printf ("SV_StartSound: attenuation = %f\n", attenuation);
return;
}
if (channel < 0 || channel > 7)
{
- Con_Printf ("SV_StartSound: channel = %i", channel);
+ Con_Printf ("SV_StartSound: channel = %i\n", channel);
return;
}
// edicts get reallocated on level changes, so we need to update it here
client->edict = PRVM_EDICT_NUM((client - svs.clients) + 1);
- // if client is a botclient coming from a level change, we need to set up
- // client info that normally requires networking
- if (!client->netconnection)
- {
- // set up the edict
- PRVM_ED_ClearEdict(client->edict);
-
- // copy spawn parms out of the client_t
- for (i=0 ; i< NUM_SPAWN_PARMS ; i++)
- (&prog->globals.server->parm1)[i] = host_client->spawn_parms[i];
-
- // call the spawn function
- host_client->clientconnectcalled = true;
- prog->globals.server->time = sv.time;
- prog->globals.server->self = PRVM_EDICT_TO_PROG(client->edict);
- PRVM_ExecuteProgram (prog->globals.server->ClientConnect, "QC function ClientConnect is missing");
- PRVM_ExecuteProgram (prog->globals.server->PutClientInServer, "QC function PutClientInServer is missing");
- host_client->spawned = true;
- return;
- }
+ // clear cached stuff that depends on the level
+ client->weaponmodel[0] = 0;
+ client->weaponmodelindex = 0;
// LordHavoc: clear entityframe tracking
client->latestframenum = 0;
client->spawn_parms[i] = (&prog->globals.server->parm1)[i];
}
+ // set up the entity for this client (including .colormap, .team, etc)
+ PRVM_ED_ClearEdict(client->edict);
+
// don't call SendServerinfo for a fresh botclient because its fields have
// not been set up by the qc yet
if (client->netconnection)
// specialvisibilityradius)
if ((model = sv.models[modelindex]))
{
+ float scale = cs.scale * (1.0f / 16.0f);
if (cs.angles[0] || cs.angles[2]) // pitch and roll
{
- VectorAdd(cs.origin, model->rotatedmins, cullmins);
- VectorAdd(cs.origin, model->rotatedmaxs, cullmaxs);
+ VectorMA(cs.origin, scale, model->rotatedmins, cullmins);
+ VectorMA(cs.origin, scale, model->rotatedmaxs, cullmaxs);
}
else if (cs.angles[1])
{
- VectorAdd(cs.origin, model->yawmins, cullmins);
- VectorAdd(cs.origin, model->yawmaxs, cullmaxs);
+ VectorMA(cs.origin, scale, model->yawmins, cullmins);
+ VectorMA(cs.origin, scale, model->yawmaxs, cullmaxs);
}
else
{
- VectorAdd(cs.origin, model->normalmins, cullmins);
- VectorAdd(cs.origin, model->normalmaxs, cullmaxs);
+ VectorMA(cs.origin, scale, model->normalmins, cullmins);
+ VectorMA(cs.origin, scale, model->normalmaxs, cullmaxs);
}
}
else
if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_punchvector)))
VectorCopy(val->vector, punchvector);
- // FIXME: cache weapon model name and index in client struct to save time
+ // cache weapon model name and index in client struct to save time
// (this search can be almost 1% of cpu time!)
s = PRVM_GetString(ent->fields.server->weaponmodel);
if (strcmp(s, client->weaponmodel))
ent->fields.server = (void *)((unsigned char *)prog->edictsfields + i * prog->edict_size);
}*/
- // fix up client->edict pointers for returning clients right away...
- for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
- host_client->edict = PRVM_EDICT_NUM(i + 1);
-
sv.datagram.maxsize = sizeof(sv.datagram_buf);
sv.datagram.cursize = 0;
sv.datagram.data = sv.datagram_buf;
// serverflags are for cross level information (sigils)
prog->globals.server->serverflags = svs.serverflags;
+ // we need to reset the spawned flag on all connected clients here so that
+ // their thinks don't run during startup (before PutClientInServer)
+ // we also need to set up the client entities now
+ // 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->edict = PRVM_EDICT_NUM(i + 1);
+ PRVM_ED_ClearEdict(host_client->edict);
+ }
+
// load replacement entity file if found
entities = NULL;
if (sv_entpatch.integer)
sv.state = ss_active;
prog->allowworldwrites = false;
- // we need to reset the spawned flag on all connected clients here so that
- // their thinks don't run during startup (before PutClientInServer)
- for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
- host_client->spawned = false;
-
// run two frames to allow everything to settle
for (i = 0;i < 2;i++)
{
if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE)
SV_CreateBaseline ();
-// send serverinfo to all connected clients
- // (note this also handles botclients coming back from a level change)
+// send serverinfo to all connected clients, and set up botclients coming back from a level change
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
- if (host_client->active)
+ {
+ if (!host_client->active)
+ continue;
+ if (host_client->netconnection)
SV_SendServerinfo(host_client);
+ else
+ {
+ int j;
+ // if client is a botclient coming from a level change, we need to
+ // set up client info that normally requires networking
+
+ // copy spawn parms out of the client_t
+ for (j=0 ; j< NUM_SPAWN_PARMS ; j++)
+ (&prog->globals.server->parm1)[j] = host_client->spawn_parms[j];
+
+ // call the spawn function
+ host_client->clientconnectcalled = true;
+ prog->globals.server->time = sv.time;
+ prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
+ PRVM_ExecuteProgram (prog->globals.server->ClientConnect, "QC function ClientConnect is missing");
+ PRVM_ExecuteProgram (prog->globals.server->PutClientInServer, "QC function PutClientInServer is missing");
+ host_client->spawned = true;
+ }
+ }
Con_DPrint("Server spawned.\n");
NetConn_Heartbeat (2);
val->_float = svs.clients[num].colors;
// NEXUIZ_PLAYERMODEL and NEXUIZ_PLAYERSKIN
if( eval_playermodel )
- PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string = PRVM_SetEngineString(svs.clients[num].playermodel);
+ PRVM_GETEDICTFIELDVALUE(e, eval_playermodel)->string = PRVM_SetEngineString(svs.clients[num].playermodel);
if( eval_playerskin )
- PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string = PRVM_SetEngineString(svs.clients[num].playerskin);
+ PRVM_GETEDICTFIELDVALUE(e, eval_playerskin)->string = PRVM_SetEngineString(svs.clients[num].playerskin);
}
}
int eval_button6;
int eval_button7;
int eval_button8;
+int eval_button9;
+int eval_button10;
+int eval_button11;
+int eval_button12;
+int eval_button13;
+int eval_button14;
+int eval_button15;
+int eval_button16;
int eval_buttonuse;
int eval_buttonchat;
int eval_glow_size;
eval_button6 = PRVM_ED_FindFieldOffset("button6");
eval_button7 = PRVM_ED_FindFieldOffset("button7");
eval_button8 = PRVM_ED_FindFieldOffset("button8");
+ eval_button9 = PRVM_ED_FindFieldOffset("button9");
+ eval_button10 = PRVM_ED_FindFieldOffset("button10");
+ eval_button11 = PRVM_ED_FindFieldOffset("button11");
+ eval_button12 = PRVM_ED_FindFieldOffset("button12");
+ eval_button13 = PRVM_ED_FindFieldOffset("button13");
+ eval_button14 = PRVM_ED_FindFieldOffset("button14");
+ eval_button15 = PRVM_ED_FindFieldOffset("button15");
+ eval_button16 = PRVM_ED_FindFieldOffset("button16");
eval_buttonuse = PRVM_ED_FindFieldOffset("buttonuse");
eval_buttonchat = PRVM_ED_FindFieldOffset("buttonchat");
eval_glow_size = PRVM_ED_FindFieldOffset("glow_size");
{ev_float, "button6"},
{ev_float, "button7"},
{ev_float, "button8"},
+ {ev_float, "button9"},
+ {ev_float, "button10"},
+ {ev_float, "button11"},
+ {ev_float, "button12"},
+ {ev_float, "button13"},
+ {ev_float, "button14"},
+ {ev_float, "button15"},
+ {ev_float, "button16"},
{ev_float, "buttonchat"},
{ev_float, "buttonuse"},
{ev_float, "clientcolors"},