From 036093249d30159bdbca628a8c12dad390d938fd Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Thu, 25 Nov 2004 13:15:57 +0000 Subject: [PATCH] added missing time calculation to slopes SVN-Revision: 2185 --- lib/app/tinygettext.cpp | 1 + lib/special/collision.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/app/tinygettext.cpp b/lib/app/tinygettext.cpp index fb88278b7..91c29b720 100644 --- a/lib/app/tinygettext.cpp +++ b/lib/app/tinygettext.cpp @@ -16,6 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#include #include #include diff --git a/lib/special/collision.cpp b/lib/special/collision.cpp index 1589a6e47..d391ce581 100644 --- a/lib/special/collision.cpp +++ b/lib/special/collision.cpp @@ -108,11 +108,15 @@ Collision::rectangle_aatriangle(CollisionHit& hit, const Rectangle& rect, break; } - float depth = -(normal * p1) - c; + float n_p1 = -(normal * p1); + float depth = n_p1 - c; if(depth < 0) return false; - if(depth < hit.depth) { + float time = depth / -(normal * movement); + if(time < hit.time) { + printf("Time: %f.\n", time); hit.depth = depth; + hit.time = time; hit.normal = normal; } -- 2.11.0