From 112a9d7d586803192d6d39d3dd5a44b71cfdaf62 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Thu, 7 Apr 2011 22:49:42 +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 24ee2314c..2ac093d0b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D2X-Rebirth Changelog 20110407 -------- 3d/draw.c, 3d/interp.c, 3d/rod.c, arch/ogl/ogl.c, include/3d.h, include/interp.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 6174bade9..8890b3f41 100644 --- a/main/physics.c +++ b/main/physics.c @@ -609,6 +609,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 (forcefield_bounce || (obj->mtype.phys_info.flags & PF_BOUNCE)) { //bounce off wall wall_part *= 2; //Subtract out wall part twice to achieve bounce