- // remove the onground flag for non-players
- if (check->v.movetype != MOVETYPE_WALK)
- check->v.flags = (int)check->v.flags & ~FL_ONGROUND;
-
- VectorCopy (check->v.origin, entorigin);
- VectorCopy (check->v.origin, moved_from[num_moved]);
- VectorCopy (check->v.angles, entangles);
- VectorCopy (check->v.angles, angled_from[num_moved]);
- moved_edict[num_moved] = check;
- num_moved++;
-
- // calculate destination position
- VectorSubtract (check->v.origin, pusher->v.origin, org);
- org2[0] = DotProduct (org, forward);
- org2[1] = -DotProduct (org, right);
- org2[2] = DotProduct (org, up);
- VectorSubtract (org2, org, move);
-
- // try moving the contacted entity
- savesolid = pusher->v.solid; // LordHavoc: restore to correct solid type
- pusher->v.solid = SOLID_NOT;
- SV_PushEntity (check, move);
- pusher->v.solid = savesolid; // LordHavoc: restore to correct solid type
-
- VectorAdd (check->v.angles, amove, check->v.angles);
-
- // 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)
- { // corpse
- check->v.mins[0] = check->v.mins[1] = 0;
- VectorCopy (check->v.mins, check->v.maxs);
- continue;
- }
-
- VectorCopy (entorigin, check->v.origin);
- VectorCopy (entangles, check->v.angles);
- SV_LinkEdict (check, true);
-
- VectorCopy (pushorigin, pusher->v.origin);
- VectorCopy (pushangles, pusher->v.angles);
- SV_LinkEdict (pusher, false);
- pusher->v.ltime -= movetime;
-
- // 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
- num_moved--; // LordHavoc: pop off check, because it was already restored
- for (i=0 ; i<num_moved ; i++)
+ VectorCopy (check->fields.server->origin, check->priv.server->moved_from);
+ VectorCopy (check->fields.server->angles, check->priv.server->moved_fromangles);
+ sv.moved_edicts[num_moved++] = check;
+
+ // try moving the contacted entity
+ pusher->fields.server->solid = SOLID_NOT;
+ trace = SV_PushEntity (check, move);
+ // FIXME: turn players specially
+ check->fields.server->angles[1] += trace.fraction * moveangle[1];
+ pusher->fields.server->solid = savesolid; // was SOLID_BSP
+
+ // if it is still inside the pusher, block
+ if (SV_ClipMoveToEntity(pusher, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, 0, SUPERCONTENTS_SOLID).startsolid)
+ {
+ // try moving the contacted entity a tiny bit further to account for precision errors
+ vec3_t move2;
+ pusher->fields.server->solid = SOLID_NOT;
+ VectorScale(move, 1.1, move2);
+ VectorCopy (check->priv.server->moved_from, check->fields.server->origin);
+ VectorCopy (check->priv.server->moved_fromangles, check->fields.server->angles);
+ SV_PushEntity (check, move2);
+ pusher->fields.server->solid = savesolid;
+ if (SV_ClipMoveToEntity(pusher, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, 0, SUPERCONTENTS_SOLID).startsolid)