From: havoc Date: Sun, 6 Mar 2005 14:56:44 +0000 (+0000) Subject: changed waterlevel checking to use SUPERCONTENTS instead of CONTENTS, this might... X-Git-Tag: xonotic-v0.1.0preview~5131 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=d474b5b66a73bf8b639003491001c2dcbe84785e;p=xonotic%2Fdarkplaces.git changed waterlevel checking to use SUPERCONTENTS instead of CONTENTS, this might be a slight speedup (hasn't completely gotten rid of use of CONTENTS though, because that still must be reported to the QC) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5037 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sv_phys.c b/sv_phys.c index 1505372e..59c02e1e 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -459,7 +459,7 @@ int SV_FlyMove (edict_t *ent, float time, float *stepnormal) ent->v->groundentity = EDICT_TO_PROG(hackongroundentity); } */ - + /* if ((blocked & 1) == 0 && bumpcount > 1) { @@ -881,19 +881,17 @@ qboolean SV_CheckWater (edict_t *ent) ent->v->waterlevel = 0; ent->v->watertype = CONTENTS_EMPTY; - cont = SV_PointQ1Contents(point); - if (cont <= CONTENTS_WATER) + cont = SV_PointSuperContents(point); + if (cont & (SUPERCONTENTS_LIQUIDSMASK)) { - ent->v->watertype = cont; + ent->v->watertype = Mod_Q1BSP_NativeContentsFromSuperContents(NULL, cont); ent->v->waterlevel = 1; point[2] = ent->v->origin[2] + (ent->v->mins[2] + ent->v->maxs[2])*0.5; - cont = SV_PointQ1Contents(point); - if (cont <= CONTENTS_WATER) + if (SV_PointSuperContents(point) & (SUPERCONTENTS_LIQUIDSMASK)) { ent->v->waterlevel = 2; point[2] = ent->v->origin[2] + ent->v->view_ofs[2]; - cont = SV_PointQ1Contents(point); - if (cont <= CONTENTS_WATER) + if (SV_PointSuperContents(point) & (SUPERCONTENTS_LIQUIDSMASK)) ent->v->waterlevel = 3; } } @@ -1022,44 +1020,44 @@ void SV_WalkMove (edict_t *ent) if (sv_nostep.integer) return; - + // if move didn't block on a step, return if (clip & 2) { // if move was not trying to move into the step, return if (fabs(start_velocity[0]) < 0.03125 && fabs(start_velocity[1]) < 0.03125) return; - + if (ent->v->movetype != MOVETYPE_FLY) { // return if gibbed by a trigger if (ent->v->movetype != MOVETYPE_WALK) return; - + // only step up while jumping if that is enabled if (!(sv_jumpstep.integer && sv_gameplayfix_stepwhilejumping.integer)) if (!oldonground && ent->v->waterlevel == 0) return; } - + // try moving up and forward to go up a step // back to start pos VectorCopy (start_origin, ent->v->origin); VectorCopy (start_velocity, ent->v->velocity); - + // move up VectorClear (upmove); upmove[2] = sv_stepheight.value; // FIXME: don't link? SV_PushEntity(ent, upmove); - + // move forward ent->v->velocity[2] = 0; clip = SV_FlyMove (ent, sv.frametime, stepnormal); ent->v->velocity[2] += start_velocity[2]; - + SV_CheckVelocity(ent); - + // check for stuckness, possibly due to the limited precision of floats // in the clipping hulls if (clip @@ -1072,7 +1070,7 @@ void SV_WalkMove (edict_t *ent) VectorCopy(originalmove_velocity, ent->v->velocity); //clip = originalmove_clip; ent->v->flags = originalmove_flags; - ent->v->groundentity = originalmove_groundentity; + ent->v->groundentity = originalmove_groundentity; // now try to unstick if needed //clip = SV_TryUnstick (ent, oldvel); return; @@ -1114,7 +1112,7 @@ void SV_WalkMove (edict_t *ent) VectorCopy(originalmove_velocity, ent->v->velocity); //clip = originalmove_clip; ent->v->flags = originalmove_flags; - ent->v->groundentity = originalmove_groundentity; + ent->v->groundentity = originalmove_groundentity; } SV_SetOnGround (ent);