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();
}
// NEXUIZ_PLAYERMODEL
- model = PR_GetString(host_client->edict->v->playermodel);
- 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));
- host_client->edict->v->playermodel = PR_SetString(host_client->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
- skin = PR_GetString(host_client->edict->v->playerskin);
- 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));
- host_client->edict->v->playerskin = PR_SetString(host_client->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 (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)
{
- // 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)
{
- 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;
}
}
// 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