When sliding along a wall keep wall_part sane to ensure good velocity for slide

This commit is contained in:
zicodxx 2011-04-07 22:49:39 +02:00
parent 357e1b0144
commit 82edf638fe
2 changed files with 5 additions and 0 deletions

View file

@ -3,6 +3,7 @@ D1X-Rebirth Changelog
20110407
--------
3d/draw.c, 3d/interp.c, 3d/rod.c, arch/ogl/ogl.c, include/3d.h, include/ogl_init.h, main/endlevel.c, main/gamesave.c, main/lighting.c, main/lighting.h, main/menu.c, main/morph.c, main/multi.c, main/object.c, main/object.h, main/playsave.c, main/playsave.h, main/polyobj.c, main/polyobj.h, main/render.c, main/state.c, main/terrain.c: Made lighting code work with actual RGB values and added feature to let certain objects emit colored dynamic light as well as let mine flash red when control center destroyed (OpenGL-only at the moment)
main/physics.c: When sliding along a wall keep wall_part sane to ensure good velocity for slide
20110405
--------

View file

@ -596,6 +596,10 @@ void do_physics_sim(object *obj)
wall_part = vm_vec_dot(&hit_info.hit_wallnorm,&obj->mtype.phys_info.velocity);
// if wall_part, make sure the value is sane enough to get usable velocity computed
if (wall_part < 0 && wall_part > -f1_0) wall_part = -f1_0;
if (wall_part > 0 && wall_part < f1_0) wall_part = f1_0;
if (obj->mtype.phys_info.flags & PF_BOUNCE) //bounce off wall
wall_part *= 2; //Subtract out wall part twice to achieve bounce