From: Matthias Braun Date: Thu, 25 Nov 2004 13:15:57 +0000 (+0000) Subject: added missing time calculation to slopes X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=036093249d30159bdbca628a8c12dad390d938fd;p=supertux.git added missing time calculation to slopes SVN-Revision: 2185 --- 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; }