X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fspecial.h;h=550e2a4240451fe56d1611a02769a221f4a1922d;hb=3369ed08e4b7126af560dc5f9c3442fc76b43ab4;hp=dfec8a4726c7816f657c563b3cb7ba0af0a32d1b;hpb=1b892d1a9a93b4dc3e6b69410208ca7eca336413;p=supertux.git diff --git a/src/special.h b/src/special.h index dfec8a472..550e2a424 100644 --- a/src/special.h +++ b/src/special.h @@ -1,17 +1,21 @@ +// $Id$ // -// C Interface: special +// SuperTux - A Jump'n Run +// Copyright (C) 2003 Tobias Glaesser // -// Description: -// -// -// Author: Tobias Glaesser , (C) 2004 -// -// Copyright: See COPYING file that comes with this distribution +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. // +// This program is distributed in the hope that it will be useful, +// 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. // - -#define BULLET_STARTING_YM 1 -#define BULLET_XM 5 +// 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. #ifndef SUPERTUX_SPECIAL_H #define SUPERTUX_SPECIAL_H @@ -19,15 +23,16 @@ #include #include "bitmask.h" #include "type.h" -#include "texture.h" +#include "screen/texture.h" #include "collision.h" #include "player.h" #include "physic.h" /* Upgrade types: */ -enum { +enum UpgradeKind { UPGRADE_GROWUP, + UPGRADE_FIREFLOWER, UPGRADE_ICEFLOWER, UPGRADE_HERRING, UPGRADE_1UP @@ -36,45 +41,48 @@ enum { void load_special_gfx(); void free_special_gfx(); -class Upgrade +class Upgrade : public MovingObject { public: - int kind; - int dir; - base_type base; - base_type old_base; + UpgradeKind kind; + Direction dir; Physic physic; - void init(float x, float y, int dir, int kind); - void action(double frame_ratio); - void draw(); - void collision(void* p_c_object, int c_object); + Upgrade(const Vector& pos, Direction dir, UpgradeKind kind); + virtual ~Upgrade(); + + virtual void action(float frame_ratio); + virtual void draw(DrawingContext& context); + + virtual void collision(const MovingObject& other, int); + void collision(void* p_c_object, int c_object, CollisionType type); 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(); + void bump(Player* player); }; -class Bullet +enum BulletsKind { + FIRE_BULLET, + ICE_BULLET +}; + +class Bullet : public MovingObject { - public: - base_type base; - base_type old_base; +public: + Bullet(const Vector& pos, float xm, int dir, + int kind); - void init(float x, float y, float xm, int dir); - void action(double frame_ratio); - void draw(); + virtual void action(float frame_ratio); + virtual void draw(DrawingContext& context); void collision(int c_object); + 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*/