X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmoving_object.hpp;h=29e12f2c64fc3fd875f2185c8e6800be007f5824;hb=ca86583fae991aa3280c5d70bf20dbf0504a93cb;hp=e6ae48343fc5c672a1b00d2775925c93f3fcd134;hpb=5f1c84ed5ce0ab5450f92082a9aaaa9ca0effc39;p=supertux.git diff --git a/src/moving_object.hpp b/src/moving_object.hpp index e6ae48343..29e12f2c6 100644 --- a/src/moving_object.hpp +++ b/src/moving_object.hpp @@ -42,6 +42,8 @@ enum CollisionGroup { * MovingOnlyStatic objects), but is tested against all other objects. */ COLGROUP_MOVING_ONLY_STATIC, + /** TODO write docu :-/ */ + COLGROUP_MOVING_STATIC, /** * Doesn't move and isn't explicitely checked for collisions with other * objects (but other objects might check with this) @@ -63,7 +65,7 @@ enum CollisionGroup { * coins */ COLGROUP_TOUCHABLE, - + /** * Should be used for tilemaps */ @@ -79,33 +81,36 @@ class MovingObject : public GameObject public: MovingObject(); virtual ~MovingObject(); - - /** this function is called when the object collided with any other object - */ - virtual HitResponse collision(GameObject& other, - const CollisionHit& hit) = 0; + + /** this function is called when the object collided with something solid */ + virtual void collision_solid(const CollisionHit& hit) + { + (void) hit; + } + /** 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 */ virtual void collision_tile(uint32_t tile_attributes) { (void) tile_attributes; } - + const Vector& get_pos() const { return bbox.p1; } - + /** returns the bounding box of the Object */ const Rect& get_bbox() const { return bbox; } - + const Vector& get_movement() const { return movement; } - + /** places the moving object at a specific position. Be carefull when * using this function. There are no collision detection checks performed * here so bad things could happen. @@ -143,16 +148,16 @@ public: return group; } - void set_group(CollisionGroup group) - { - this->group = group; - } - protected: friend class Sector; friend class CollisionGrid; friend class Platform; - + + void set_group(CollisionGroup group) + { + this->group = group; + } + /** The bounding box of the object (as used for collision detection, this * isn't necessarily the bounding box for graphics) */