// if it is still inside the pusher, block
if (SV_TestEntityPosition (check))
{
- // fail the move
- if (check->v.mins[0] == check->v.maxs[0])
- continue;
- if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER)
+ // try moving the contacted entity a tiny bit further to account for precision errors
+ pusher->v.solid = SOLID_NOT;
+ VectorScale(move, 0.1, move);
+ trace = SV_PushEntity (check, move, vec3_origin);
+ pusher->v.solid = savesolid;
+ if (SV_TestEntityPosition (check))
{
- // corpse
- check->v.mins[0] = check->v.mins[1] = 0;
- VectorCopy (check->v.mins, check->v.maxs);
- continue;
- }
+ // still inside pusher, so it's really blocked
- VectorCopy (pushorig, pusher->v.origin);
- VectorCopy (pushang, pusher->v.angles);
- pusher->v.ltime = pushltime;
- SV_LinkEdict (pusher, false);
+ // fail the move
+ if (check->v.mins[0] == check->v.maxs[0])
+ continue;
+ if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER)
+ {
+ // corpse
+ check->v.mins[0] = check->v.mins[1] = 0;
+ VectorCopy (check->v.mins, check->v.maxs);
+ continue;
+ }
- // move back any entities we already moved
- for (i=0 ; i<num_moved ; i++)
- {
- VectorCopy (moved_from[i], moved_edict[i]->v.origin);
- VectorCopy (moved_fromangles[i], moved_edict[i]->v.angles);
- SV_LinkEdict (moved_edict[i], false);
- }
+ VectorCopy (pushorig, pusher->v.origin);
+ VectorCopy (pushang, pusher->v.angles);
+ pusher->v.ltime = pushltime;
+ SV_LinkEdict (pusher, false);
- // if the pusher has a "blocked" function, call it, otherwise just stay in place until the obstacle is gone
- if (pusher->v.blocked)
- {
- pr_global_struct->self = EDICT_TO_PROG(pusher);
- pr_global_struct->other = EDICT_TO_PROG(check);
- PR_ExecuteProgram (pusher->v.blocked, "");
+ // move back any entities we already moved
+ for (i=0 ; i<num_moved ; i++)
+ {
+ VectorCopy (moved_from[i], moved_edict[i]->v.origin);
+ VectorCopy (moved_fromangles[i], moved_edict[i]->v.angles);
+ SV_LinkEdict (moved_edict[i], false);
+ }
+
+ // if the pusher has a "blocked" function, call it, otherwise just stay in place until the obstacle is gone
+ if (pusher->v.blocked)
+ {
+ pr_global_struct->self = EDICT_TO_PROG(pusher);
+ pr_global_struct->other = EDICT_TO_PROG(check);
+ PR_ExecuteProgram (pusher->v.blocked, "");
+ }
+ return;
}
- return;
}
}
}
ent->v.waterlevel = 0;
ent->v.watertype = CONTENTS_EMPTY;
- cont = Mod_PointInLeaf(point, sv.worldmodel)->contents;
+ cont = Mod_PointContents(point, sv.worldmodel);
if (cont <= CONTENTS_WATER)
{
ent->v.watertype = cont;
ent->v.waterlevel = 1;
point[2] = ent->v.origin[2] + (ent->v.mins[2] + ent->v.maxs[2])*0.5;
- cont = Mod_PointInLeaf(point, sv.worldmodel)->contents;
+ cont = Mod_PointContents(point, sv.worldmodel);
if (cont <= CONTENTS_WATER)
{
ent->v.waterlevel = 2;
point[2] = ent->v.origin[2] + ent->v.view_ofs[2];
- cont = Mod_PointInLeaf(point, sv.worldmodel)->contents;
+ cont = Mod_PointContents(point, sv.worldmodel);
if (cont <= CONTENTS_WATER)
ent->v.waterlevel = 3;
}
// check for stuckness, possibly due to the limited precision of floats
// in the clipping hulls
- /*
if (clip
&& fabs(oldorg[1] - ent->v.origin[1]) < 0.03125
&& fabs(oldorg[0] - ent->v.origin[0]) < 0.03125)
// stepping up didn't make any progress
clip = SV_TryUnstick (ent, oldvel);
- */
// extra friction based on view angle
if (clip & 2 && sv_wallfriction.integer)
if (downtrace.plane.normal[2] > 0.7)
{
- if (ent->v.solid == SOLID_BSP)
+ // LordHavoc: disabled this so you can walk on monsters/players
+ //if (ent->v.solid == SOLID_BSP)
{
ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
ent->v.groundentity = EDICT_TO_PROG(downtrace.ent);
Player character actions
================
*/
-void SV_Physics_Client (edict_t *ent, int num)
+void SV_Physics_Client (edict_t *ent, int num)
{
- if ( ! svs.clients[num-1].active )
+ if (!svs.clients[num-1].active)
return; // unconnected slot
-//
-// call standard client pre-think
-//
+ // call standard client pre-think
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(ent);
PR_ExecuteProgram (pr_global_struct->PlayerPreThink, "QC function PlayerPreThink is missing");
-//
-// do a move
-//
+ // do a move
SV_CheckVelocity (ent);
-//
-// decide which move function to call
-//
+ // decide which move function to call
switch ((int)ent->v.movetype)
{
case MOVETYPE_NONE:
Host_Error ("SV_Physics_client: bad movetype %i", (int)ent->v.movetype);
}
-//
-// call standard player post-think
-//
+ // call standard player post-think
SV_LinkEdict (ent, true);
pr_global_struct->time = sv.time;
*/
void SV_CheckWaterTransition (edict_t *ent)
{
- int cont;
- cont = Mod_PointInLeaf(ent->v.origin, sv.worldmodel)->contents;
+ int cont;
+ cont = Mod_PointContents(ent->v.origin, sv.worldmodel);
if (!ent->v.watertype)
{
// just spawned here
if (cont <= CONTENTS_WATER)
{
- if (ent->v.watertype == CONTENTS_EMPTY)
+ if (ent->v.watertype == CONTENTS_EMPTY && cont != CONTENTS_LAVA)
// just crossed into water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
}
else
{
- if (ent->v.watertype != CONTENTS_EMPTY)
+ if (ent->v.watertype != CONTENTS_EMPTY && ent->v.watertype != CONTENTS_LAVA)
// just crossed into water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
{
if (flags & FL_FLY)
fall = false;
- else if ((flags & FL_SWIM) && Mod_PointInLeaf(ent->v.origin, sv.worldmodel)->contents != CONTENTS_EMPTY)
+ else if ((flags & FL_SWIM) && Mod_PointContents(ent->v.origin, sv.worldmodel) != CONTENTS_EMPTY)
fall = false;
}
if (fall && (flags & FL_ONGROUND) && ent->v.groundentity == 0)