Cvar_RegisterVariable (&sv_edgefriction);
Cvar_RegisterVariable (&sv_stopspeed);
Cvar_RegisterVariable (&sv_maxspeed);
+ Cvar_RegisterVariable (&sv_maxairspeed);
Cvar_RegisterVariable (&sv_accelerate);
Cvar_RegisterVariable (&sv_idealpitchscale);
Cvar_RegisterVariable (&sv_aim);
return;
}
FS_StripExtension(sv.worldmodel->name, basename, sizeof(basename));
- FS_WriteFile(va("%s.ent", basename), sv.worldmodel->brush.entities, strlen(sv.worldmodel->brush.entities));
+ FS_WriteFile(va("%s.ent", basename), sv.worldmodel->brush.entities, (fs_offset_t)strlen(sv.worldmodel->brush.entities));
}
int sound_num, field_mask, i, ent;
if (volume < 0 || volume > 255)
- Host_Error ("SV_StartSound: volume = %i", volume);
+ {
+ Con_Printf ("SV_StartSound: volume = %i", volume);
+ return;
+ }
if (attenuation < 0 || attenuation > 4)
- Host_Error ("SV_StartSound: attenuation = %f", attenuation);
+ {
+ Con_Printf ("SV_StartSound: attenuation = %f", attenuation);
+ return;
+ }
if (channel < 0 || channel > 7)
- Host_Error ("SV_StartSound: channel = %i", channel);
+ {
+ Con_Printf ("SV_StartSound: channel = %i", channel);
+ return;
+ }
if (sv.datagram.cursize > MAX_PACKETFRAGMENT-21)
return;
for (e = 1, ent = PRVM_NEXT_EDICT(prog->edicts);e < prog->num_edicts;e++, ent = PRVM_NEXT_EDICT(ent))
{
sendentitiesindex[e] = NULL;
- if (ent->priv.server->free)
+ // the 2 billion unit check is actually to detect NAN origins (we really don't want to send those)
+ if (ent->priv.server->free || VectorLength2(ent->fields.server->origin) > 2000000000.0*2000000000.0)
continue;
cs = defaultstate;
// stuff the sigil bits into the high bits of items for sbar, or else
// mix in items2
val = PRVM_GETEDICTFIELDVALUE(ent, eval_items2);
- if (val)
+ if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE)
items = (int)ent->fields.server->items | ((int)val->_float << 23);
else
items = (int)ent->fields.server->items | ((int)prog->globals.server->serverflags << 28);
*/
void SV_SendReconnect (void)
{
- char data[128];
- sizebuf_t msg;
+ qbyte data[128];
+ sizebuf_t msg;
msg.data = data;
msg.cursize = 0;
{
prvm_edict_t *ent;
int i;
- qbyte *entities;
+ char *entities;
model_t *worldmodel;
char modelname[sizeof(sv.modelname)];
memset (&sv, 0, sizeof(sv));
+ SV_VM_Setup();
+
+ sv.active = true;
+
strlcpy (sv.name, server, sizeof (sv.name));
sv.protocol = Protocol_EnumForName(sv_protocolname.string);
sv.protocol = PROTOCOL_QUAKE;
}
- SV_VM_Setup();
-
SV_VM_Begin();
// load progs to get entity field count
// progs fields, often accessed by server
prog->edictsfields = PR_Alloc(prog->max_edicts * prog->edict_size);*/
// used by PushMove to move back pushed entities
- sv.moved_edicts = PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
+ sv.moved_edicts = (prvm_edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
/*for (i = 0;i < prog->max_edicts;i++)
{
ent = prog->edicts + i;
//prog->num_edicts = svs.maxclients+1;
sv.state = ss_loading;
+ prog->allowworldwrites = true;
sv.paused = false;
*prog->time = sv.time = 1.0;
// load replacement entity file if found
entities = NULL;
if (sv_entpatch.integer)
- entities = FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true);
+ entities = (char *)FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true);
if (entities)
{
Con_Printf("Loaded maps/%s.ent\n", sv.name);
// LordHavoc: clear world angles (to fix e3m3.bsp)
VectorClear(prog->edicts->fields.server->angles);
- sv.active = true;
-
// all setup is completed, any further precache statements are errors
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++)
prvm_edict_t *ent;
PRVM_Free( sv.moved_edicts );
- sv.moved_edicts = PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
+ sv.moved_edicts = (prvm_edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
// links don't survive the transition, so unlink everything
for (i = 0, ent = prog->edicts;i < prog->max_edicts;i++, ent++)
e->fields.server->colormap = num + 1;
e->fields.server->team = (svs.clients[num].colors & 15) + 1;
// set netname/clientcolors back to client values so that
- // DP_SV_CLIENTNAME and DPV_SV_CLIENTCOLORS will not immediately
+ // DP_SV_CLIENTNAME and DP_SV_CLIENTCOLORS will not immediately
// reset them
e->fields.server->netname = PRVM_SetEngineString(svs.clients[num].name);
if ((val = PRVM_GETEDICTFIELDVALUE(e, eval_clientcolors)))