yeti cleanup and death animation rework, hitbox fix ups
[supertux.git] / src / collision.cpp
index cce522d..bc38f83 100644 (file)
@@ -1,7 +1,7 @@
 //  $Id$
-// 
+//
 //  SuperTux
-//  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
 //
 //  This program is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU General Public License
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 //  GNU General Public License for more details.
-// 
+//
 //  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 <config.h>
 
-#include "collision.h"
+#include "collision.hpp"
 
 #include <algorithm>
 #include <iostream>
 #include <stdio.h>
 #include <float.h>
 #include <math.h>
-#include "math/vector.h"
-#include "math/aatriangle.h"
-#include "math/rect.h"
-#include "collision_hit.h"
+#include "math/vector.hpp"
+#include "math/aatriangle.hpp"
+#include "math/rect.hpp"
+#include "collision_hit.hpp"
 
 static const float DELTA = .0001;
 
 bool
+Collision::intersects(const Rect& r1, const Rect& r2)
+{
+  if(r1.p2.x < r2.p1.x || r1.p1.x > r2.p2.x)
+    return false;
+  if(r1.p2.y < r2.p1.y || r1.p1.y > r2.p2.y)
+    return false;
+
+  return true;
+}
+
+bool
 Collision::rectangle_rectangle(CollisionHit& hit, const Rect& r1,
     const Vector& movement, const Rect& r2)
 {