cvar_t sv_cullentities_trace_prediction = {0, "sv_cullentities_trace_prediction", "1", "also trace from the predicted player position"};
cvar_t sv_cullentities_trace_prediction_time = {0, "sv_cullentities_trace_prediction_time", "0.2", "how many seconds of prediction to use"};
cvar_t sv_cullentities_trace_entityocclusion = {0, "sv_cullentities_trace_entityocclusion", "0", "also check if doors and other bsp models are in the way"};
-cvar_t sv_cullentities_trace_samples = {0, "sv_cullentities_trace_samples", "1", "number of samples to test for entity culling"};
+cvar_t sv_cullentities_trace_samples = {0, "sv_cullentities_trace_samples", "2", "number of samples to test for entity culling"};
cvar_t sv_cullentities_trace_samples_extra = {0, "sv_cullentities_trace_samples_extra", "2", "number of samples to test for entity culling when the entity affects its surroundings by e.g. dlight"};
cvar_t sv_cullentities_trace_samples_players = {0, "sv_cullentities_trace_samples_players", "8", "number of samples to test for entity culling when the entity is a player entity"};
cvar_t sv_debugmove = {CVAR_NOTIFY, "sv_debugmove", "0", "disables collision detection optimizations for debugging purposes"};
cvar_t sv_gameplayfix_droptofloorstartsolid_nudgetocorrect = {0, "sv_gameplayfix_droptofloorstartsolid_nudgetocorrect", "1", "tries to nudge stuck items and monsters out of walls before droptofloor is performed"};
cvar_t sv_gameplayfix_easierwaterjump = {0, "sv_gameplayfix_easierwaterjump", "1", "changes water jumping to make it easier to get out of water (exactly like in QuakeWorld)"};
cvar_t sv_gameplayfix_findradiusdistancetobox = {0, "sv_gameplayfix_findradiusdistancetobox", "1", "causes findradius to check the distance to the corner of a box rather than the center of the box, makes findradius detect bmodels such as very large doors that would otherwise be unaffected by splash damage"};
+cvar_t sv_gameplayfix_gravityunaffectedbyticrate = {0, "sv_gameplayfix_gravityunaffectedbyticrate", "0", "fix some ticrate issues in physics."};
cvar_t sv_gameplayfix_grenadebouncedownslopes = {0, "sv_gameplayfix_grenadebouncedownslopes", "1", "prevents MOVETYPE_BOUNCE (grenades) from getting stuck when fired down a downward sloping surface"};
cvar_t sv_gameplayfix_multiplethinksperframe = {0, "sv_gameplayfix_multiplethinksperframe", "1", "allows entities to think more often than the server framerate, primarily useful for very high fire rate weapons"};
-cvar_t sv_gameplayfix_slidemoveprojectiles = {0, "sv_gameplayfix_slidemoveprojectiles", "1", "allows MOVETYPE_FLY/FLYMISSILE/TOSS/BOUNCE/BOUNCEMISSILE entities to finish their move in a frame even if they hit something, fixes 'gravity accumulation' bug for grenades on steep slopes"};
cvar_t sv_gameplayfix_noairborncorpse = {0, "sv_gameplayfix_noairborncorpse", "1", "causes entities (corpses, items, etc) sitting ontop of moving entities (players) to fall when the moving entity (player) is no longer supporting them"};
cvar_t sv_gameplayfix_noairborncorpse_allowsuspendeditems = {0, "sv_gameplayfix_noairborncorpse_allowsuspendeditems", "1", "causes entities sitting ontop of objects that are instantaneously remove to float in midair (special hack to allow a common level design trick for floating items)"};
+cvar_t sv_gameplayfix_nudgeoutofsolid = {0, "sv_gameplayfix_nudgeoutofsolid", "1", "attempts to fix physics errors (where an object ended up in solid for some reason)"};
+cvar_t sv_gameplayfix_nudgeoutofsolid_bias = {0, "sv_gameplayfix_nudgeoutofsolid_bias", "0", "over-correction on nudgeoutofsolid logic, to prevent constant contact"};
+cvar_t sv_gameplayfix_q2airaccelerate = {0, "sv_gameplayfix_q2airaccelerate", "0", "Quake2-style air acceleration"};
cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1", "fixes a bug in Quake that made setmodel always set the entity box to ('-16 -16 -16', '16 16 16') rather than properly checking the model box, breaks some poorly coded mods"};
+cvar_t sv_gameplayfix_slidemoveprojectiles = {0, "sv_gameplayfix_slidemoveprojectiles", "1", "allows MOVETYPE_FLY/FLYMISSILE/TOSS/BOUNCE/BOUNCEMISSILE entities to finish their move in a frame even if they hit something, fixes 'gravity accumulation' bug for grenades on steep slopes"};
cvar_t sv_gameplayfix_stepdown = {0, "sv_gameplayfix_stepdown", "0", "attempts to step down stairs, not just up them (prevents the familiar thud..thud..thud.. when running down stairs and slopes)"};
cvar_t sv_gameplayfix_stepwhilejumping = {0, "sv_gameplayfix_stepwhilejumping", "1", "applies step-up onto a ledge even while airborn, useful if you would otherwise just-miss the floor when running across small areas with gaps (for instance running across the moving platforms in dm2, or jumping to the megahealth and red armor in dm2 rather than using the bridge)"};
cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1", "causes pointcontents (used to determine if you are in a liquid) to check bmodel entities as well as the world model, so you can swim around in (possibly moving) water bmodel entities"};
cvar_t sv_gameplayfix_upwardvelocityclearsongroundflag = {0, "sv_gameplayfix_upwardvelocityclearsongroundflag", "1", "prevents monsters, items, and most other objects from being stuck to the floor when pushed around by damage, and other situations in mods"};
-cvar_t sv_gameplayfix_gravityunaffectedbyticrate = {0, "sv_gameplayfix_gravityunaffectedbyticrate", "0", "fix some ticrate issues in physics."};
-cvar_t sv_gameplayfix_q2airaccelerate = {0, "sv_gameplayfix_q2airaccelerate", "0", "Quake2-style air acceleration"};
+cvar_t sv_gameplayfix_downtracesupportsongroundflag = {0, "sv_gameplayfix_downtracesupportsongroundflag", "1", "prevents very short moves from clearing onground (which may make the player stick to the floor at high netfps)"};
cvar_t sv_gravity = {CVAR_NOTIFY, "sv_gravity","800", "how fast you fall (512 = roughly earth gravity)"};
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 (sv_gameplayfix_stepwhilejumping must also be 1)"};
{ev_vector, "glowmod"},
{ev_vector, "movement"},
{ev_vector, "punchvector"},
+
+ // physics
+ //{ev_float, "solid"},
+ //{ev_float, "movetype"},
+ //{ev_float, "modelindex"},
+ {ev_vector, "mass"},
+ //{ev_vector, "origin"},
+ //{ev_vector, "velocity"},
+ //{ev_vector, "axis_forward"},
+ //{ev_vector, "axis_left"},
+ //{ev_vector, "axis_up"},
+ //{ev_vector, "spinvelocity"},
+ //{ev_vector, "angles"},
+ //{ev_vector, "avelocity"},
+
};
Cvar_RegisterVariable (&sv_gameplayfix_droptofloorstartsolid_nudgetocorrect);
Cvar_RegisterVariable (&sv_gameplayfix_easierwaterjump);
Cvar_RegisterVariable (&sv_gameplayfix_findradiusdistancetobox);
+ Cvar_RegisterVariable (&sv_gameplayfix_gravityunaffectedbyticrate);
Cvar_RegisterVariable (&sv_gameplayfix_grenadebouncedownslopes);
Cvar_RegisterVariable (&sv_gameplayfix_multiplethinksperframe);
- Cvar_RegisterVariable (&sv_gameplayfix_slidemoveprojectiles);
Cvar_RegisterVariable (&sv_gameplayfix_noairborncorpse);
Cvar_RegisterVariable (&sv_gameplayfix_noairborncorpse_allowsuspendeditems);
+ Cvar_RegisterVariable (&sv_gameplayfix_nudgeoutofsolid);
+ Cvar_RegisterVariable (&sv_gameplayfix_nudgeoutofsolid_bias);
+ Cvar_RegisterVariable (&sv_gameplayfix_q2airaccelerate);
Cvar_RegisterVariable (&sv_gameplayfix_setmodelrealbox);
+ Cvar_RegisterVariable (&sv_gameplayfix_slidemoveprojectiles);
Cvar_RegisterVariable (&sv_gameplayfix_stepdown);
Cvar_RegisterVariable (&sv_gameplayfix_stepwhilejumping);
Cvar_RegisterVariable (&sv_gameplayfix_swiminbmodels);
Cvar_RegisterVariable (&sv_gameplayfix_upwardvelocityclearsongroundflag);
- Cvar_RegisterVariable (&sv_gameplayfix_gravityunaffectedbyticrate);
- Cvar_RegisterVariable (&sv_gameplayfix_q2airaccelerate);
+ Cvar_RegisterVariable (&sv_gameplayfix_downtracesupportsongroundflag);
Cvar_RegisterVariable (&sv_gravity);
Cvar_RegisterVariable (&sv_idealpitchscale);
Cvar_RegisterVariable (&sv_jumpstep);
SZ_Clear (&client->netconnection->message);
MSG_WriteByte (&client->netconnection->message, svc_print);
- dpsnprintf (message, sizeof (message), "\nServer: %s build %s (progs %i crc)", gamename, buildstring, prog->filecrc);
+ dpsnprintf (message, sizeof (message), "\nServer: %s build %s (progs %i crc)\n", gamename, buildstring, prog->filecrc);
MSG_WriteString (&client->netconnection->message,message);
SV_StopDemoRecording(client); // to split up demos into different files
// clear movement info until client enters the new level properly
memset(&client->cmd, 0, sizeof(client->cmd));
client->movesequence = 0;
+ client->movement_highestsequence_seen = 0;
+ memset(&client->movement_count, 0, sizeof(client->movement_count));
#ifdef NUM_PING_TIMES
for (i = 0;i < NUM_PING_TIMES;i++)
client->ping_times[i] = 0;
// LordHavoc: this could kill tags attached to an invisible entity, I
// just hope we never have to support that case
i = (int)ent->fields.server->modelindex;
- modelindex = (i >= 1 && i < MAX_MODELS && ent->fields.server->model && *PRVM_GetString(ent->fields.server->model)) ? i : 0;
+ modelindex = (i >= 1 && i < MAX_MODELS && ent->fields.server->model && *PRVM_GetString(ent->fields.server->model) && sv.models[i]) ? i : 0;
flags = 0;
i = (int)(PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.glow_size)->_float * 0.25f);
// calculate the visible box of this entity (don't use the physics box
// as that is often smaller than a model, and would not count
// specialvisibilityradius)
- if ((model = sv.models[modelindex]) && (model->type != mod_null))
+ if ((model = SV_GetModelByIndex(modelindex)) && (model->type != mod_null))
{
float scale = cs->scale * (1.0f / 16.0f);
if (cs->angles[0] || cs->angles[2]) // pitch and roll
VectorMA(cs->origin, scale, model->rotatedmins, cullmins);
VectorMA(cs->origin, scale, model->rotatedmaxs, cullmaxs);
}
- else if (cs->angles[1])
+ else if (cs->angles[1] || ((effects | model->effects) & EF_ROTATE))
{
VectorMA(cs->origin, scale, model->yawmins, cullmins);
VectorMA(cs->origin, scale, model->yawmaxs, cullmaxs);
matrix4x4_t matrix, imatrix;
dp_model_t *model;
prvm_edict_t *touch;
- prvm_edict_t *touchedicts[MAX_EDICTS];
- unsigned int modelindex;
+ static prvm_edict_t *touchedicts[MAX_EDICTS];
vec3_t boxmins, boxmaxs;
vec3_t clipboxmins, clipboxmaxs;
vec3_t endpoints[MAX_LINEOFSIGHTTRACES];
touch = touchedicts[touchindex];
if (touch->fields.server->solid != SOLID_BSP)
continue;
- modelindex = (unsigned int)touch->fields.server->modelindex;
- if (!modelindex)
- continue;
- if (modelindex >= MAX_MODELS)
- continue; // error?
- model = sv.models[(int)touch->fields.server->modelindex];
- if (!model->brush.TraceLineOfSight)
+ model = SV_GetModelFromEdict(touch);
+ if (!model || !model->brush.TraceLineOfSight)
continue;
// skip obviously transparent entities
alpha = PRVM_EDICTFIELDVALUE(touch, prog->fieldoffsets.alpha)->_float;
for (touchindex = 0;touchindex < numtouchedicts;touchindex++)
{
touch = touchedicts[touchindex];
- modelindex = (unsigned int)touch->fields.server->modelindex;
- model = sv.models[(int)touch->fields.server->modelindex];
- // get the entity matrix
- pitchsign = (model->type == mod_alias) ? -1 : 1;
- Matrix4x4_CreateFromQuakeEntity(&matrix, touch->fields.server->origin[0], touch->fields.server->origin[1], touch->fields.server->origin[2], pitchsign * touch->fields.server->angles[0], touch->fields.server->angles[1], touch->fields.server->angles[2], 1);
- Matrix4x4_Invert_Simple(&imatrix, &matrix);
- // see if the ray hits this entity
- Matrix4x4_Transform(&imatrix, eye, starttransformed);
- Matrix4x4_Transform(&imatrix, endpoints[traceindex], endtransformed);
- if (!model->brush.TraceLineOfSight(model, starttransformed, endtransformed))
+ model = SV_GetModelFromEdict(touch);
+ if(model && model->brush.TraceLineOfSight)
{
- blocked++;
- break;
+ // get the entity matrix
+ pitchsign = SV_GetPitchSign(touch);
+ Matrix4x4_CreateFromQuakeEntity(&matrix, touch->fields.server->origin[0], touch->fields.server->origin[1], touch->fields.server->origin[2], pitchsign * touch->fields.server->angles[0], touch->fields.server->angles[1], touch->fields.server->angles[2], 1);
+ Matrix4x4_Invert_Simple(&imatrix, &matrix);
+ // see if the ray hits this entity
+ Matrix4x4_Transform(&imatrix, eye, starttransformed);
+ Matrix4x4_Transform(&imatrix, endpoints[traceindex], endtransformed);
+ if (!model->brush.TraceLineOfSight(model, starttransformed, endtransformed))
+ {
+ blocked++;
+ break;
+ }
}
}
// check if the ray was blocked
if (!s->modelindex && s->specialvisibilityradius == 0)
return;
- isbmodel = (model = sv.models[s->modelindex]) != NULL && model->name[0] == '*';
+ isbmodel = (model = SV_GetModelByIndex(s->modelindex)) != NULL && model->name[0] == '*';
// viewmodels don't have visibility checking
if (s->viewmodelforclient)
{
extension = FS_FileExtension(host_client->download_name);
// host_client is asking to download a specified file
- if (developer.integer >= 100)
- Con_Printf("Download request for %s by %s\n", host_client->download_name, host_client->name);
+ if (developer_extra.integer)
+ Con_DPrintf("Download request for %s by %s\n", host_client->download_name, host_client->name);
if(is_csqc)
{
int SV_ParticleEffectIndex(const char *name)
{
int i, argc, linenumber, effectnameindex;
+ int filepass;
fs_offset_t filesize;
unsigned char *filedata;
const char *text, *textstart, *textend;
char argv[16][1024];
+ char filename[MAX_QPATH];
if (!sv.particleeffectnamesloaded)
{
sv.particleeffectnamesloaded = true;
memset(sv.particleeffectname, 0, sizeof(sv.particleeffectname));
for (i = 0;i < EFFECT_TOTAL;i++)
strlcpy(sv.particleeffectname[i], standardeffectnames[i], sizeof(sv.particleeffectname[i]));
- filedata = FS_LoadFile("effectinfo.txt", tempmempool, true, &filesize);
- if (filedata)
+ for (filepass = 0;;filepass++)
{
+ if (filepass == 0)
+ dpsnprintf(filename, sizeof(filename), "effectinfo.txt");
+ else if (filepass == 1)
+ dpsnprintf(filename, sizeof(filename), "maps/%s_effectinfo.txt", sv.name);
+ else
+ break;
+ filedata = FS_LoadFile(filename, tempmempool, true, &filesize);
+ if (!filedata)
+ continue;
textstart = (const char *)filedata;
textend = (const char *)filedata + filesize;
text = textstart;
// if we run out of names, abort
if (effectnameindex == SV_MAX_PARTICLEEFFECTNAME)
{
- Con_Printf("effectinfo.txt:%i: too many effects!\n", linenumber);
+ Con_Printf("%s:%i: too many effects!\n", filename, linenumber);
break;
}
}
return 0;
}
+dp_model_t *SV_GetModelByIndex(int modelindex)
+{
+ return (modelindex > 0 && modelindex < MAX_MODELS) ? sv.models[modelindex] : NULL;
+}
+
+dp_model_t *SV_GetModelFromEdict(prvm_edict_t *ed)
+{
+ int modelindex;
+ if (!ed || ed->priv.server->free)
+ return NULL;
+ modelindex = (int)ed->fields.server->modelindex;
+ return (modelindex > 0 && modelindex < MAX_MODELS) ? sv.models[modelindex] : NULL;
+}
+
/*
================
SV_CreateBaseline
svs.csqc_progdata = NULL;
svs.csqc_progdata_deflated = NULL;
- Con_Print("Loading csprogs.dat\n");
-
sv.csqc_progname[0] = 0;
svs.csqc_progdata = FS_LoadFile(csqc_progname.string, sv_mempool, false, &progsize);
if(progsize > 0)
{
size_t deflated_size;
-
+
sv.csqc_progsize = (int)progsize;
sv.csqc_progcrc = CRC_Block(svs.csqc_progdata, progsize);
strlcpy(sv.csqc_progname, csqc_progname.string, sizeof(sv.csqc_progname));
- Con_Printf("server detected csqc progs file \"%s\" with size %i and crc %i\n", sv.csqc_progname, sv.csqc_progsize, sv.csqc_progcrc);
+ Con_DPrintf("server detected csqc progs file \"%s\" with size %i and crc %i\n", sv.csqc_progname, sv.csqc_progsize, sv.csqc_progcrc);
- Con_Print("Compressing csprogs.dat\n");
+ Con_DPrint("Compressing csprogs.dat\n");
//unsigned char *FS_Deflate(const unsigned char *data, size_t size, size_t *deflated_size, int level, mempool_t *mempool);
svs.csqc_progdata_deflated = FS_Deflate(svs.csqc_progdata, progsize, &deflated_size, -1, sv_mempool);
svs.csqc_progsize_deflated = (int)deflated_size;
if(svs.csqc_progdata_deflated)
{
- Con_Printf("Deflated: %g%%\n", 100.0 - 100.0 * (deflated_size / (float)progsize));
+ Con_DPrintf("Deflated: %g%%\n", 100.0 - 100.0 * (deflated_size / (float)progsize));
Con_DPrintf("Uncompressed: %u\nCompressed: %u\n", (unsigned)sv.csqc_progsize, (unsigned)svs.csqc_progsize_deflated);
}
else
- Con_Printf("Cannot compress - need zlib for this. Using uncompressed progs only.\n");
+ Con_DPrintf("Cannot compress - need zlib for this. Using uncompressed progs only.\n");
}
}
if(sv.active)
{
SV_VM_Begin();
+ World_End(&sv.world);
if(prog->funcoffsets.SV_Shutdown)
{
func_t s = prog->funcoffsets.SV_Shutdown;
// clear world interaction links
//
World_SetSize(&sv.world, sv.worldmodel->name, sv.worldmodel->normalmins, sv.worldmodel->normalmaxs);
+ World_Start(&sv.world);
strlcpy(sv.sound_precache[0], "", sizeof(sv.sound_precache[0]));
ed->fields.server->nextthink = -1;
ed->fields.server->solid = 0;
+ VM_RemoveEdictSkeleton(ed);
+ World_Physics_RemoveFromEntity(&sv.world, ed);
+ World_Physics_RemoveJointFromEntity(&sv.world, ed);
+
// make sure csqc networking is aware of the removed entity
e = PRVM_NUM_FOR_EDICT(ed);
sv.csqcentityversion[e] = 0;