X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=sv_phys.c;h=ab3e7d9cadb957aa2e6160a2fb142b268fcef9ec;hb=4be2a5bf75beb62b1644dec10195d5321ef71b4d;hp=de66811ac91633a402de1d5e6a774ad5d3dbc291;hpb=056b0de3110de03acd8113e41145a914cdc7b90f;p=xonotic%2Fdarkplaces.git diff --git a/sv_phys.c b/sv_phys.c index de66811a..ab3e7d9c 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -121,7 +121,7 @@ trace_t SV_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int dp_model_t *model; // list of entities to test for collisions int numtouchedicts; - prvm_edict_t *touchedicts[MAX_EDICTS]; + static prvm_edict_t *touchedicts[MAX_EDICTS]; //return SV_TraceBox(start, vec3_origin, vec3_origin, end, type, passedict, hitsupercontentsmask); @@ -266,7 +266,7 @@ trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ dp_model_t *model; // list of entities to test for collisions int numtouchedicts; - prvm_edict_t *touchedicts[MAX_EDICTS]; + static prvm_edict_t *touchedicts[MAX_EDICTS]; #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND vec3_t end; vec_t len = 0; @@ -445,7 +445,7 @@ trace_t SV_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co dp_model_t *model; // list of entities to test for collisions int numtouchedicts; - prvm_edict_t *touchedicts[MAX_EDICTS]; + static prvm_edict_t *touchedicts[MAX_EDICTS]; #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND vec3_t end; vec_t len = 0; @@ -636,7 +636,7 @@ int SV_PointSuperContents(const vec3_t point) int frame; // list of entities to test for collisions int numtouchedicts; - prvm_edict_t *touchedicts[MAX_EDICTS]; + static prvm_edict_t *touchedicts[MAX_EDICTS]; // get world supercontents at this point if (sv.worldmodel && sv.worldmodel->PointSuperContents) @@ -713,7 +713,8 @@ void SV_LinkEdict_TouchAreaGrid_Call(prvm_edict_t *touch, prvm_edict_t *ent) void SV_LinkEdict_TouchAreaGrid(prvm_edict_t *ent) { int i, numtouchedicts, old_self, old_other; - prvm_edict_t *touch, *touchedicts[MAX_EDICTS]; + prvm_edict_t *touch; + static prvm_edict_t *touchedicts[MAX_EDICTS]; if (ent == prog->edicts) return; // don't add the world @@ -823,8 +824,8 @@ void SV_LinkEdict (prvm_edict_t *ent) { if (model != NULL) { - if (!model->TraceBox && developer.integer >= 1) - Con_Printf("edict %i: SOLID_BSP with non-collidable model\n", PRVM_NUM_FOR_EDICT(ent)); + if (!model->TraceBox) + Con_DPrintf("edict %i: SOLID_BSP with non-collidable model\n", PRVM_NUM_FOR_EDICT(ent)); if (ent->fields.server->angles[0] || ent->fields.server->angles[2] || ent->fields.server->avelocity[0] || ent->fields.server->avelocity[2]) { @@ -1555,7 +1556,7 @@ void SV_PushMove (prvm_edict_t *pusher, float movetime) dp_model_t *pushermodel; trace_t trace, trace2; matrix4x4_t pusherfinalmatrix, pusherfinalimatrix; - unsigned short moved_edicts[MAX_EDICTS]; + static unsigned short moved_edicts[MAX_EDICTS]; if (!pusher->fields.server->velocity[0] && !pusher->fields.server->velocity[1] && !pusher->fields.server->velocity[2] && !pusher->fields.server->avelocity[0] && !pusher->fields.server->avelocity[1] && !pusher->fields.server->avelocity[2]) { @@ -1967,8 +1968,8 @@ qboolean SV_UnstickEntity (prvm_edict_t *ent) Con_DPrintf("Unstuck entity %i (classname \"%s\") with offset %f %f %f.\n", (int)PRVM_EDICT_TO_PROG(ent), PRVM_GetString(ent->fields.server->classname), offset[0], offset[1], offset[2]); return true; case UNSTICK_STUCK: - if (developer.integer >= 100) - Con_Printf("Stuck entity %i (classname \"%s\").\n", (int)PRVM_EDICT_TO_PROG(ent), PRVM_GetString(ent->fields.server->classname)); + if (developer_extra.integer) + Con_DPrintf("Stuck entity %i (classname \"%s\").\n", (int)PRVM_EDICT_TO_PROG(ent), PRVM_GetString(ent->fields.server->classname)); return false; default: Con_Printf("SV_UnstickEntityReturnOffset returned a value outside its enum.\n"); @@ -2157,7 +2158,7 @@ Only used by players */ void SV_WalkMove (prvm_edict_t *ent) { - int clip, oldonground, originalmove_clip, originalmove_flags, originalmove_groundentity, hitsupercontentsmask; + int clip, oldonground, originalmove_clip, originalmove_flags, originalmove_groundentity, hitsupercontentsmask, type; vec3_t upmove, downmove, start_origin, start_velocity, stepnormal, originalmove_origin, originalmove_velocity; trace_t downtrace, trace; qboolean applygravity; @@ -2183,8 +2184,27 @@ void SV_WalkMove (prvm_edict_t *ent) clip = SV_FlyMove (ent, sv.frametime, applygravity, NULL, hitsupercontentsmask); + if(sv_gameplayfix_downtracesupportsongroundflag.integer) + if(!(clip & 1)) + { + // only try this if there was no floor in the way in the trace (no, + // this check seems to be not REALLY necessary, because if clip & 1, + // our trace will hit that thing too) + VectorSet(upmove, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2] + 1); + VectorSet(downmove, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2] - 1); + if (ent->fields.server->movetype == MOVETYPE_FLYMISSILE) + type = MOVE_MISSILE; + else if (ent->fields.server->solid == SOLID_TRIGGER || ent->fields.server->solid == SOLID_NOT) + type = MOVE_NOMONSTERS; // only clip against bmodels + else + type = MOVE_NORMAL; + trace = SV_TraceBox(upmove, ent->fields.server->mins, ent->fields.server->maxs, downmove, type, ent, SV_GenericHitSuperContentsMask(ent)); + if(trace.fraction < 1 && trace.plane.normal[2] > 0.7) + clip |= 1; // but we HAVE found a floor + } + // if the move did not hit the ground at any point, we're not on ground - if (!(clip & 1)) + if(!(clip & 1)) ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND; SV_CheckVelocity(ent);