Added some new conditions to the bumping code: Only bump objects which can slide (alive robots and players) and added a count making sure this function can never get stuck in an infinite loop

This commit is contained in:
zicodxx 2011-01-24 20:45:59 +01:00
parent 273d0b0dbe
commit 54097a9a3e

View file

@ -501,7 +501,7 @@ void do_physics_sim(object *obj)
* 1) object_intersects_wall() does not say how far we went inside the wall which is why we use while to move out until we do not intersect anymore. This should be improved so we only move one time.
* 2) we move the object towards segment center. Depending on the level architecture this is safe. However this will heavily influence velocity and reduce sliding speed near joining edges. Also depending on velocity it's still possible we might not pass an endge leading into another segment since we are pulled back to the old one.
*/
if ((obj->type == OBJ_PLAYER || obj->type == OBJ_ROBOT) && !(obj->flags&OF_SHOULD_BE_DEAD))
if (obj->type == OBJ_PLAYER || obj->type == OBJ_ROBOT)
while (object_intersects_wall(obj) && bumpcount++ < 64)
{
vms_vector center,bump_vec;