cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1"};
cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1"};
+cvar_t sv_progs = {0, "sv_progs", "progs.dat" };
+
server_t sv;
server_static_t svs;
Cvar_RegisterVariable (&sv_protocolname);
Cvar_RegisterVariable (&sv_ratelimitlocalplayer);
Cvar_RegisterVariable (&sv_maxrate);
+ Cvar_RegisterVariable (&sv_progs);
SV_Phys_Init();
SV_World_Init();
client->entitydatabase5 = EntityFrame5_AllocDatabase(sv_clients_mempool);
MSG_WriteByte (&client->message, svc_print);
- snprintf (message, sizeof (message), "\002\nServer: %s build %s (progs %i crc)", gamename, buildstring, pr_crc);
+ dpsnprintf (message, sizeof (message), "\002\nServer: %s build %s (progs %i crc)", gamename, buildstring, pr_crc);
MSG_WriteString (&client->message,message);
MSG_WriteByte (&client->message, svc_serverinfo);
int e, i;
float f;
edict_t *ent;
+ eval_t *val;
entity_state_t cs;
// send all entities that touch the pvs
numsendentities = 0;
if (GETEDICTFIELDVALUE(ent, eval_glow_trail)->_float)
cs.flags |= RENDER_GLOWTRAIL;
+ // don't need to init cs.colormod because the defaultstate did that for us
+ //cs.colormod[0] = cs.colormod[1] = cs.colormod[2] = 32;
+ val = GETEDICTFIELDVALUE(ent, eval_colormod);
+ if (val->vector[0] || val->vector[1] || val->vector[2])
+ {
+ i = val->vector[0] * 32.0f;cs.colormod[0] = bound(0, i, 255);
+ i = val->vector[1] * 32.0f;cs.colormod[1] = bound(0, i, 255);
+ i = val->vector[2] * 32.0f;cs.colormod[2] = bound(0, i, 255);
+ }
+
cs.modelindex = 0;
i = (int)ent->v->modelindex;
if (i >= 1 && i < MAX_MODELS && *PR_GetString(ent->v->model))
client_t *client;
eval_t *val;
char *name;
+ char *model;
+ char *skin;
// check for changes to be sent over the reliable streams
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
}
+ // NEXUIZ_PLAYERMODEL
+ if( eval_playermodel ) {
+ model = PR_GetString(GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string);
+ if (model == NULL)
+ model = "";
+ // always point the string back at host_client->name to keep it safe
+ strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
+ GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string = PR_SetString(host_client->playermodel);
+ }
+
+ // NEXUIZ_PLAYERSKIN
+ if( eval_playerskin ) {
+ skin = PR_GetString(GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string);
+ if (skin == NULL)
+ skin = "";
+ // always point the string back at host_client->name to keep it safe
+ strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
+ GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string = PR_SetString(host_client->playerskin);
+ }
+
// frags
host_client->frags = (int)host_client->edict->v->frags;
if (host_client->old_frags != host_client->frags)
{
if (precachemode)
{
- if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4 || sv.protocol == PROTOCOL_DARKPLACES5)
+ if (sv.state != ss_loading && (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4 || sv.protocol == PROTOCOL_DARKPLACES5))
{
- // not able to precache during game
- if (precachemode == 2 && sv.state != ss_loading)
- {
- Con_Printf("SV_ModelIndex(\"%s\"): precache_model can only be done in spawn functions\n", filename);
- return 0;
- }
+ Con_Printf("SV_ModelIndex(\"%s\"): precache_model can only be done in spawn functions\n", filename);
+ return 0;
}
- else
+ if (precachemode == 1)
+ Con_Printf("SV_ModelIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename);
+ strlcpy(sv.model_precache[i], filename, sizeof(sv.model_precache[i]));
+ sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, false);
+ if (sv.protocol == PROTOCOL_DARKPLACES6 && sv.state != ss_loading)
{
- // able to precache during game
- if (precachemode == 1)
- Con_Printf("SV_ModelIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename);
- strlcpy(sv.model_precache[i], filename, sizeof(sv.model_precache[i]));
- sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, false);
- if (sv.state != ss_loading)
- {
- MSG_WriteByte(&sv.reliable_datagram, svc_precache);
- MSG_WriteShort(&sv.reliable_datagram, i);
- MSG_WriteString(&sv.reliable_datagram, filename);
- }
- return i;
+ MSG_WriteByte(&sv.reliable_datagram, svc_precache);
+ MSG_WriteShort(&sv.reliable_datagram, i);
+ MSG_WriteString(&sv.reliable_datagram, filename);
}
+ return i;
}
Con_Printf("SV_ModelIndex(\"%s\"): not precached\n", filename);
return 0;
if (!strcmp(sv.model_precache[i], filename))
return i;
}
- if (precachemode)
- Con_Printf("SV_ModelIndex(\"%s\"): i == MAX_MODELS\n", filename);
- else
- Con_Printf("SV_ModelIndex(\"%s\"): not precached\n", filename);
+ Con_Printf("SV_ModelIndex(\"%s\"): i (%i) == MAX_MODELS (%i)\n", filename, i, MAX_MODELS);
return 0;
}
char filename[MAX_QPATH];
if (!s || !*s)
return 0;
+ // testing
+ //if (precachemode == 2)
+ // return 0;
strlcpy(filename, s, sizeof(filename));
for (i = 1;i < limit;i++)
{
if (!sv.sound_precache[i][0])
{
- if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4 || sv.protocol == PROTOCOL_DARKPLACES5)
+ if (precachemode)
{
- // not able to precache during game
- if (precachemode == 2 && sv.state != ss_loading)
+ if (sv.state != ss_loading && (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4 || sv.protocol == PROTOCOL_DARKPLACES5))
{
Con_Printf("SV_SoundIndex(\"%s\"): precache_sound can only be done in spawn functions\n", filename);
return 0;
}
- }
- else
- {
- // able to precache during game
- if (precachemode)
+ if (precachemode == 1)
+ Con_Printf("SV_SoundIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename);
+ strlcpy(sv.sound_precache[i], filename, sizeof(sv.sound_precache[i]));
+ if (sv.protocol == PROTOCOL_DARKPLACES6 && sv.state != ss_loading)
{
- if (precachemode == 1)
- Con_Printf("SV_SoundIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename);
- strlcpy(sv.sound_precache[i], filename, sizeof(sv.sound_precache[i]));
MSG_WriteByte(&sv.reliable_datagram, svc_precache);
MSG_WriteShort(&sv.reliable_datagram, i + 32768);
MSG_WriteString(&sv.reliable_datagram, filename);
- return i;
}
+ return i;
}
Con_Printf("SV_SoundIndex(\"%s\"): not precached\n", filename);
return 0;
if (!strcmp(sv.sound_precache[i], filename))
return i;
}
- if (precachemode)
- Con_Printf("SV_SoundIndex(\"%s\"): i == MAX_SOUNDS\n", filename);
- else
- Con_Printf("SV_SoundIndex(\"%s\"): not precached\n", filename);
+ Con_Printf("SV_SoundIndex(\"%s\"): i (%i) == MAX_SOUNDS (%i)\n", filename, i, MAX_SOUNDS);
return 0;
}
Con_DPrintf("SpawnServer: %s\n", server);
- snprintf (modelname, sizeof(modelname), "maps/%s.bsp", server);
+ if (cls.state != ca_dedicated)
+ SCR_BeginLoadingPlaque();
+
+ dpsnprintf (modelname, sizeof(modelname), "maps/%s.bsp", server);
worldmodel = Mod_ForName(modelname, false, true, true);
if (!worldmodel || !worldmodel->TraceBox)
{
//
if (coop.integer)
Cvar_SetValue ("deathmatch", 0);
- current_skill = bound(0, (int)(skill.value + 0.5), 3);
-
- Cvar_SetValue ("skill", (float)current_skill);
+ // LordHavoc: it can be useful to have skills outside the range 0-3...
+ //current_skill = bound(0, (int)(skill.value + 0.5), 3);
+ //Cvar_SetValue ("skill", (float)current_skill);
+ current_skill = (int)(skill.value + 0.5);
//
// set up the new server
}
// load progs to get entity field count
- PR_LoadProgs ();
+ PR_LoadProgs ( sv_progs.string );
// allocate server memory
// start out with just enough room for clients and a reasonable estimate of entities
strlcpy(sv.model_precache[1], sv.modelname, sizeof(sv.model_precache[1]));
for (i = 1;i < sv.worldmodel->brush.numsubmodels;i++)
{
- snprintf(sv.model_precache[i+1], sizeof(sv.model_precache[i+1]), "*%i", i);
+ dpsnprintf(sv.model_precache[i+1], sizeof(sv.model_precache[i+1]), "*%i", i);
sv.models[i+1] = Mod_ForName (sv.model_precache[i+1], false, false, false);
}