From 82edf638fe1b5bb7681167fec6159cfe3b48e85a Mon Sep 17 00:00:00 2001 From: zicodxx Date: Thu, 7 Apr 2011 22:49:39 +0200 Subject: [PATCH] When sliding along a wall keep wall_part sane to ensure good velocity for slide --- CHANGELOG.txt | 1 + main/physics.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 38c868ac8..538487e54 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/main/physics.c b/main/physics.c index a4f512d28..5bc63de76 100644 --- a/main/physics.c +++ b/main/physics.c @@ -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