Let navigate through the worldmap using Tux keys as well.
[supertux.git] / src / collision.h
index 3f6db25..85b89d7 100644 (file)
 #ifndef SUPERTUX_COLLISION_H
 #define SUPERTUX_COLLISION_H
 
-#include "type.h"
+#include "special/base.h"
+
+using namespace SuperTux;
 
 class Tile;
-class World;
 
 /* Collision objects */
 enum
 {
   CO_BULLET,
   CO_BADGUY,
-  CO_PLAYER
+  CO_PLAYER,
+  CO_TRAMPOLINE,
+  CO_FLYING_PLATFORM
 };
 
 enum CollisionType {
@@ -40,11 +43,11 @@ enum CollisionType {
     COLLISION_SQUISH
 };
 
-bool rectcollision(base_type* one, base_type* two);
-bool rectcollision_offset(base_type* one, base_type* two, float off_x, float off_y);
+bool rectcollision(const base_type& one, const base_type& two);
+bool rectcollision_offset(const base_type& one, const base_type& two, float off_x, float off_y);
 
 void collision_swept_object_map(base_type* old, base_type* current);
-bool collision_object_map(base_type* object);
+bool collision_object_map(const base_type& object);
 
 /** Return a pointer to the tile at the given x/y coordinates */
 Tile* gettile(float x, float y);
@@ -53,7 +56,17 @@ Tile* gettile(float x, float y);
 bool  issolid(float x, float y);
 bool  isbrick(float x, float y);
 bool  isice(float x, float y);
+bool  isspike(float x, float y);
 bool  isfullbox(float x, float y);
 
+typedef void* (*tiletestfunction)(Tile* tile);
+/** invokes the function for each tile the baserectangle collides with. The
+ * function aborts and returns true as soon as the tiletestfunction returns
+ * != 0 then this value is returned. returns 0 if all tests failed.
+ */
+void* collision_func(const base_type& base, tiletestfunction* function);
+
+Tile* collision_goal(const base_type& base);
+
 #endif /*SUPERTUX_COLLISION_H*/