X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmoving_object.hpp;h=4cc5dc2d098ffa645f73aef43b9e2cf43d8a6889;hb=198f758764fff064a47630b5d0f1e3d6aabe95a8;hp=29e12f2c64fc3fd875f2185c8e6800be007f5824;hpb=ca86583fae991aa3280c5d70bf20dbf0504a93cb;p=supertux.git diff --git a/src/moving_object.hpp b/src/moving_object.hpp index 29e12f2c6..4cc5dc2d0 100644 --- a/src/moving_object.hpp +++ b/src/moving_object.hpp @@ -31,7 +31,7 @@ class CollisionGrid; enum CollisionGroup { /** Objects in DISABLED group are not tested for collisions */ - COLGROUP_DISABLED, + COLGROUP_DISABLED = 0, /** * "default" is moving object. MovingObjects get tested against all other * objects and against other movingobjects @@ -45,7 +45,7 @@ enum CollisionGroup { /** TODO write docu :-/ */ COLGROUP_MOVING_STATIC, /** - * Doesn't move and isn't explicitely checked for collisions with other + * Doesn't move and isn't explicitly checked for collisions with other * objects (but other objects might check with this) * The difference to COLGROUP_TOUCHABLE is that we can do multiple * collision response tests in a row which is needed for static object @@ -56,7 +56,7 @@ enum CollisionGroup { */ COLGROUP_STATIC, /** - * Isn't explicitely checked for collisions with other objects. But other + * Isn't explicitly checked for collisions with other objects. But other * objects might check with this object. * Difference to COLGROUP_STATIC is that collisions with this object are * only tested once and collision response is typically not handled @@ -87,6 +87,16 @@ public: { (void) hit; } + /** + * when 2 objects collided, we will first call the pre_collision_check + * functions of both objects that can decide on how to react to the collision. + */ + virtual bool collides(GameObject& other, const CollisionHit& hit) + { + (void) other; + (void) hit; + return true; + } /** this function is called when the object collided with any other object */ virtual HitResponse collision(GameObject& other, const CollisionHit& hit) = 0; /** called when tiles with special attributes have been touched */ @@ -111,7 +121,7 @@ public: return movement; } - /** places the moving object at a specific position. Be carefull when + /** places the moving object at a specific position. Be careful when * using this function. There are no collision detection checks performed * here so bad things could happen. */