cvar_t sv_gameplayfix_unstickentities = {0, "sv_gameplayfix_unstickentities", "1", "hack to check if entities are crossing world collision hull and try to move them to the right position"};
cvar_t sv_gameplayfix_fixedcheckwatertransition = {0, "sv_gameplayfix_fixedcheckwatertransition", "1", "fix two very stupid bugs in SV_CheckWaterTransition when watertype is CONTENTS_EMPTY (the bugs causes waterlevel to be 1 on first frame, -1 on second frame - the fix makes it 0 on both frames)"};
cvar_t sv_gravity = {CVAR_NOTIFY, "sv_gravity","800", "how fast you fall (512 = roughly earth gravity)"};
+cvar_t sv_init_frame_count = {0, "sv_init_frame_count", "2", "number of frames to run to allow everything to settle before letting clients connect"};
cvar_t sv_idealpitchscale = {0, "sv_idealpitchscale","0.8", "how much to look up/down slopes and stairs when not using freelook"};
cvar_t sv_jumpstep = {CVAR_NOTIFY, "sv_jumpstep", "0", "whether you can step up while jumping"};
cvar_t sv_jumpvelocity = {0, "sv_jumpvelocity", "270", "cvar that can be used by QuakeC code for jump velocity"};
Cvar_RegisterVariable (&sv_gameplayfix_unstickentities);
Cvar_RegisterVariable (&sv_gameplayfix_fixedcheckwatertransition);
Cvar_RegisterVariable (&sv_gravity);
+ Cvar_RegisterVariable (&sv_init_frame_count);
Cvar_RegisterVariable (&sv_idealpitchscale);
Cvar_RegisterVariable (&sv_jumpstep);
Cvar_RegisterVariable (&sv_jumpvelocity);
==================
*/
-void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int volume, float attenuation, qboolean reliable, float speed)
+void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int nvolume, float attenuation, qboolean reliable, float speed)
{
prvm_prog_t *prog = SVVM_prog;
sizebuf_t *dest;
dest = (reliable ? &sv.reliable_datagram : &sv.datagram);
- if (volume < 0 || volume > 255)
+ if (nvolume < 0 || nvolume > 255)
{
- Con_Printf ("SV_StartSound: volume = %i\n", volume);
+ Con_Printf ("SV_StartSound: volume = %i\n", nvolume);
return;
}
speed4000 = (int)floor(speed * 4000.0f + 0.5f);
field_mask = 0;
- if (volume != DEFAULT_SOUND_PACKET_VOLUME)
+ if (nvolume != DEFAULT_SOUND_PACKET_VOLUME)
field_mask |= SND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
field_mask |= SND_ATTENUATION;
MSG_WriteByte (dest, svc_sound);
MSG_WriteByte (dest, field_mask);
if (field_mask & SND_VOLUME)
- MSG_WriteByte (dest, volume);
+ MSG_WriteByte (dest, nvolume);
if (field_mask & SND_ATTENUATION)
MSG_WriteByte (dest, (int)(attenuation*64));
if (field_mask & SND_SPEEDUSHORT4000)
==================
*/
-void SV_StartPointSound (vec3_t origin, const char *sample, int volume, float attenuation, float speed)
+void SV_StartPointSound (vec3_t origin, const char *sample, int nvolume, float attenuation, float speed)
{
int sound_num, field_mask, i, speed4000;
- if (volume < 0 || volume > 255)
+ if (nvolume < 0 || nvolume > 255)
{
- Con_Printf ("SV_StartPointSound: volume = %i\n", volume);
+ Con_Printf ("SV_StartPointSound: volume = %i\n", nvolume);
return;
}
speed4000 = (int)(speed * 40.0f);
field_mask = 0;
- if (volume != DEFAULT_SOUND_PACKET_VOLUME)
+ if (nvolume != DEFAULT_SOUND_PACKET_VOLUME)
field_mask |= SND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
field_mask |= SND_ATTENUATION;
MSG_WriteByte (&sv.datagram, svc_sound);
MSG_WriteByte (&sv.datagram, field_mask);
if (field_mask & SND_VOLUME)
- MSG_WriteByte (&sv.datagram, volume);
+ MSG_WriteByte (&sv.datagram, nvolume);
if (field_mask & SND_ATTENUATION)
MSG_WriteByte (&sv.datagram, (int)(attenuation*64));
if (field_mask & SND_SPEEDUSHORT4000)
MSG_WriteString (&client->netconnection->message,message);
SV_StopDemoRecording(client); // to split up demos into different files
- if(sv_autodemo_perclient.integer && client->netconnection)
+ if(sv_autodemo_perclient.integer)
{
char demofile[MAX_OSPATH];
char ipaddress[MAX_QPATH];
- size_t i;
+ size_t j;
// start a new demo file
LHNETADDRESS_ToString(&(client->netconnection->peeraddress), ipaddress, sizeof(ipaddress), true);
- for(i = 0; ipaddress[i]; ++i)
- if(!isalnum(ipaddress[i]))
- ipaddress[i] = '-';
+ for(j = 0; ipaddress[j]; ++j)
+ if(!isalnum(ipaddress[j]))
+ ipaddress[j] = '-';
dpsnprintf (demofile, sizeof(demofile), "%s_%s_%d_%s.dem", Sys_TimeString (sv_autodemo_perclient_nameformat.string), sv.worldbasename, PRVM_NUM_FOR_EDICT(client->edict), ipaddress);
SV_StartDemoRecording(client, demofile, -1);
if(client->sv_demo_file != NULL)
{
- int i;
+ int k;
static char buf[NET_MAXMESSAGE];
sizebuf_t sb;
sb.data = (unsigned char *) buf;
sb.maxsize = sizeof(buf);
- i = 0;
- while(MakeDownloadPacket(sv.csqc_progname, svs.csqc_progdata, sv.csqc_progsize, sv.csqc_progcrc, i++, &sb, sv.protocol))
+ k = 0;
+ while(MakeDownloadPacket(sv.csqc_progname, svs.csqc_progdata, sv.csqc_progsize, sv.csqc_progcrc, k++, &sb, sv.protocol))
SV_WriteDemoMessage(client, &sb, false);
}
if(client->netconnection && client->netconnection->crypto.authenticated)
{
- Con_Printf("%s connection to %s has been established: client is %s@%.*s, I am %.*s@%.*s\n",
+ Con_Printf("%s connection to %s has been established: client is %s@%s%.*s, I am %.*s@%s%.*s\n",
client->netconnection->crypto.use_aes ? "Encrypted" : "Authenticated",
client->netconnection->address,
client->netconnection->crypto.client_idfp[0] ? client->netconnection->crypto.client_idfp : "-",
+ (client->netconnection->crypto.client_issigned || !client->netconnection->crypto.client_keyfp[0]) ? "" : "~",
crypto_keyfp_recommended_length, client->netconnection->crypto.client_keyfp[0] ? client->netconnection->crypto.client_keyfp : "-",
crypto_keyfp_recommended_length, client->netconnection->crypto.server_idfp[0] ? client->netconnection->crypto.server_idfp : "-",
+ (client->netconnection->crypto.server_issigned || !client->netconnection->crypto.server_keyfp[0]) ? "" : "~",
crypto_keyfp_recommended_length, client->netconnection->crypto.server_keyfp[0] ? client->netconnection->crypto.server_keyfp : "-"
);
}
}
// or not seen by random tracelines
- if (sv_cullentities_trace.integer && !isbmodel && sv.worldmodel->brush.TraceLineOfSight && !r_trippy.integer)
+ if (sv_cullentities_trace.integer && !isbmodel && sv.worldmodel && sv.worldmodel->brush.TraceLineOfSight && !r_trippy.integer)
{
int samples =
s->number <= svs.maxclients
if (name == NULL)
name = "";
// always point the string back at host_client->name to keep it safe
- strlcpy (host_client->name, name, sizeof (host_client->name));
+ //strlcpy (host_client->name, name, sizeof (host_client->name));
+ if (name != host_client->name) // prevent buffer overlap SIGABRT on Mac OSX
+ strlcpy (host_client->name, name, sizeof (host_client->name));
PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name);
if (strcmp(host_client->old_name, host_client->name))
{
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));
+ //strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
+ if (model != host_client->playermodel) // prevent buffer overlap SIGABRT on Mac OSX
+ strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
PRVM_serveredictstring(host_client->edict, playermodel) = PRVM_SetEngineString(prog, host_client->playermodel);
// NEXUIZ_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));
+ //strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
+ if (skin != host_client->playerskin) // prevent buffer overlap SIGABRT on Mac OSX
+ strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
PRVM_serveredictstring(host_client->edict, playerskin) = PRVM_SetEngineString(prog, host_client->playerskin);
// TODO: add an extension name for this [1/17/2008 Black]
// run two frames to allow everything to settle
sv.time = 1.0001;
- for (i = 0;i < 2;i++)
+ for (i = 0;i < sv_init_frame_count.integer;i++)
{
sv.frametime = 0.1;
SV_Physics ();
}
+ // Once all init frames have been run, we consider svqc code fully initialized.
+ prog->inittime = realtime;
+
if (cls.state == ca_dedicated)
Mod_PurgeUnused();
PRVM_serveredictstring(e, crypto_idfp) = PRVM_SetEngineString(prog, svs.clients[num].netconnection->crypto.client_idfp);
else
PRVM_serveredictstring(e, crypto_idfp) = 0;
+ PRVM_serveredictfloat(e, crypto_idfp_signed) = (svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.client_issigned);
if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.client_keyfp[0])
PRVM_serveredictstring(e, crypto_keyfp) = PRVM_SetEngineString(prog, svs.clients[num].netconnection->crypto.client_keyfp);
else