X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fspecial.h;h=0e69b8914b2466a3ec55738e237e17e902265745;hb=c06f17a80ab84d8a26bf7c7bb381ad3f15596de8;hp=a28c7421f6141ff2b08ed252cfc9873d9661f6b1;hpb=902a1a1fe3dc37b1ce6e63f35ee93e735009e87a;p=supertux.git diff --git a/src/special.h b/src/special.h index a28c7421f..0e69b8914 100644 --- a/src/special.h +++ b/src/special.h @@ -20,13 +20,14 @@ #ifndef SUPERTUX_SPECIAL_H #define SUPERTUX_SPECIAL_H -#include +#include "SDL.h" + #include "bitmask.h" -#include "type.h" -#include "texture.h" +#include "special/base.h" +#include "video/surface.h" #include "collision.h" #include "player.h" -#include "physic.h" +#include "math/physic.h" /* Upgrade types: */ @@ -34,35 +35,30 @@ enum UpgradeKind { UPGRADE_GROWUP, UPGRADE_FIREFLOWER, UPGRADE_ICEFLOWER, - UPGRADE_HERRING, + UPGRADE_STAR, UPGRADE_1UP }; void load_special_gfx(); void free_special_gfx(); -class Upgrade : public GameObject +class Upgrade : public MovingObject { public: UpgradeKind kind; Direction dir; Physic physic; - void init(float x, float y, Direction dir, UpgradeKind kind); - void action(double frame_ratio); - void draw(); - void collision(void* p_c_object, int c_object, CollisionType type); - std::string type() { return "Upgrade"; }; + Upgrade(const Vector& pos, Direction dir, UpgradeKind kind); + virtual ~Upgrade(); - ~Upgrade() {}; + virtual void action(float frame_ratio); + virtual void draw(DrawingContext& context); -private: - /** removes the Upgrade from the global upgrade list. Note that after this - * call the class doesn't exist anymore! So don't use any member variables - * anymore then - */ - void remove_me(); + virtual void collision(const MovingObject& other, int); + void collision(void* p_c_object, int c_object, CollisionType type); +private: void bump(Player* player); }; @@ -71,27 +67,23 @@ enum BulletsKind { ICE_BULLET }; -class Bullet : public GameObject +class Bullet : public MovingObject { - public: - int life_count; - base_type base; - base_type old_base; - - int kind; +public: + Bullet(const Vector& pos, float xm, int dir, + int kind); - void init(float x, float y, float xm, Direction dir, int kind_); - void action(double frame_ratio); - void draw(); + virtual void action(float frame_ratio); + virtual void draw(DrawingContext& context); void collision(int c_object); - std::string type() { return "Bullet"; }; + virtual void collision(const MovingObject& other_object, int type); + + int kind; + private: - /** removes the Upgrade from the global upgrade list. Note that after this - * call the class doesn't exist anymore! So don't use any member variables - * anymore then - */ - void remove_me(); + int life_count; + Physic physic; }; #endif /*SUPERTUX_SPECIAL_H*/