*/
void SV_Init (void)
{
+ // init the csqc progs cvars, since they are updated/used by the server code
+ // TODO: fix this since this is a quick hack to make some of [515]'s broken code run ;) [9/13/2006 Black]
+ extern cvar_t csqc_progname; //[515]: csqc crc check and right csprogs name according to progs.dat
+ extern cvar_t csqc_progcrc;
+ Cvar_RegisterVariable (&csqc_progname);
+ Cvar_RegisterVariable (&csqc_progcrc);
+
Cmd_AddCommand("sv_saveentfile", SV_SaveEntFile_f, "save map entities to .ent file (to allow external editing)");
Cvar_RegisterVariable (&sv_maxvelocity);
Cvar_RegisterVariable (&sv_gravity);
==============================================================================
*/
-extern cvar_t csqc_progname; //[515]: csqc crc check and right csprogs name according to progs.dat
-extern cvar_t csqc_progcrc;
/*
================
SV_SendServerinfo
MSG_WriteString (&client->netconnection->message,message);
//[515]: init csprogs according to version of svprogs, check the crc, etc.
- if (FS_FileExists(csqc_progname.string))
+ if (sv.csqc_progcrc >= 0)
{
prvm_eval_t *val;
- MSG_WriteByte (&client->netconnection->message, svc_stufftext);
+ Con_DPrintf("sending csqc info to client (\"%s\" with crc %i)\n", sv.csqc_progname, sv.csqc_progcrc);
//[515]: init stufftext string (it is sent before svc_serverinfo)
val = PRVM_GETGLOBALFIELDVALUE(PRVM_ED_FindGlobalOffset("SV_InitCmd"));
+ MSG_WriteByte (&client->netconnection->message, svc_stufftext);
+ MSG_WriteString (&client->netconnection->message, va("csqc_progname %s\n", sv.csqc_progname));
+ MSG_WriteByte (&client->netconnection->message, svc_stufftext);
+ MSG_WriteString (&client->netconnection->message, va("csqc_progcrc %i\n", sv.csqc_progcrc));
if (val)
- MSG_WriteString (&client->netconnection->message, va("csqc_progcrc %i\n%s\n", csqc_progcrc.integer, PRVM_GetString(val->string)));
- else
- MSG_WriteString (&client->netconnection->message, va("csqc_progcrc %i\n", csqc_progcrc.integer));
+ {
+ MSG_WriteByte (&client->netconnection->message, svc_stufftext);
+ MSG_WriteString (&client->netconnection->message, va("%s\n", PRVM_GetString(val->string)));
+ }
}
MSG_WriteByte (&client->netconnection->message, svc_serverinfo);
else
{
// PROTOCOL_DARKPLACES5 and later support packet size limiting of updates
- maxrate = bound(NET_MINRATE, sv_maxrate.integer, NET_MAXRATE);
+ maxrate = max(NET_MINRATE, sv_maxrate.integer);
if (sv_maxrate.integer != maxrate)
Cvar_SetValueQuick(&sv_maxrate, maxrate);
// this rate limiting does not understand sys_ticrate 0
// (but no one should be running that on a server!)
rate = bound(NET_MINRATE, client->rate, maxrate);
- rate = (int)(client->rate * sys_ticrate.value);
+ rate = (int)(rate * sys_ticrate.value);
maxsize = bound(100, rate, 1400);
maxsize2 = 1400;
}
int eval_Version;
int eval_customizeentityforclient;
int eval_dphitcontentsmask;
+// DRESK - Support for Entity Contents Transition Event
+int eval_contentstransition;
int gval_trace_dpstartcontents;
int gval_trace_dphitcontents;
eval_Version = PRVM_ED_FindFieldOffset("Version");
eval_customizeentityforclient = PRVM_ED_FindFieldOffset("customizeentityforclient");
eval_dphitcontentsmask = PRVM_ED_FindFieldOffset("dphitcontentsmask");
+ // DRESK - Support for Entity Contents Transition Event
+ eval_contentstransition = PRVM_ED_FindFieldOffset("contentstransition");
// LordHavoc: allowing QuakeC to override the player movement code
SV_PlayerPhysicsQC = PRVM_ED_FindFunction ("SV_PlayerPhysics");
{ev_string, "playerskin"},
{ev_function, "SendEntity"},
{ev_function, "customizeentityforclient"},
+ // DRESK - Support for Entity Contents Transition Event
+ {ev_function, "contentstransition"},
};
void SV_VM_Setup(void)
{
+ extern cvar_t csqc_progname; //[515]: csqc crc check and right csprogs name according to progs.dat
+ extern cvar_t csqc_progcrc;
unsigned char *csprogsdata;
fs_offset_t csprogsdatasize;
- unsigned int csprogsdatacrc;
PRVM_Begin;
PRVM_InitProg( PRVM_SERVERPROG );
// allocate the mempools
+ // TODO: move the magic numbers/constants into #defines [9/13/2006 Black]
prog->progs_mempool = Mem_AllocPool("Server Progs", 0, NULL);
prog->builtins = vm_sv_builtins;
prog->numbuiltins = vm_sv_numbuiltins;
PRVM_End;
// see if there is a csprogs.dat installed, and if so, set the csqc_progcrc accordingly, this will be sent to connecting clients to tell them to only load a matching csprogs.dat file
- csprogsdatacrc = 0;
+ sv.csqc_progcrc = -1;
+ sv.csqc_progname[0] = 0;
csprogsdata = FS_LoadFile(csqc_progname.string, tempmempool, true, &csprogsdatasize);
if (csprogsdata)
{
- csprogsdatacrc = CRC_Block(csprogsdata, csprogsdatasize);
+ strlcpy(sv.csqc_progname, csqc_progname.string, sizeof(sv.csqc_progname));
+ sv.csqc_progcrc = CRC_Block(csprogsdata, csprogsdatasize);
Mem_Free(csprogsdata);
+ Con_DPrintf("server detected csqc progs file \"%s\" with crc %i\n", sv.csqc_progname, sv.csqc_progcrc);
}
- Cvar_SetValueQuick(&csqc_progcrc, csprogsdatacrc);
}
void SV_VM_Begin(void)