+// $Id$
//
-// C Interface: special
+// SuperTux - A Jump'n Run
+// Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
//
-// Description:
-//
-//
-// Author: Tobias Glaesser <tobi.web@gmx.de>, (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
-#define NUM_BULLETS 3
+// 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
-#include <SDL.h>
+#include "SDL.h"
+
#include "bitmask.h"
-#include "type.h"
+#include "special/base.h"
+#include "video/surface.h"
#include "collision.h"
+#include "player.h"
+#include "math/physic.h"
+
+/* Upgrade types: */
+
+enum UpgradeKind {
+ UPGRADE_GROWUP,
+ UPGRADE_FIREFLOWER,
+ UPGRADE_ICEFLOWER,
+ UPGRADE_STAR,
+ UPGRADE_1UP
+};
+
+void load_special_gfx();
+void free_special_gfx();
+
+class Upgrade : public MovingObject
+{
+public:
+ UpgradeKind kind;
+ Direction dir;
+ Physic physic;
-typedef struct upgrade_type
- {
- int alive;
- int kind;
- float x;
- float y;
- float xm;
- float ym;
- float width;
- float height;
- unsigned int updated;
- itop_type it;
- }
-upgrade_type;
+ Upgrade(const Vector& pos, Direction dir, UpgradeKind kind);
+ virtual ~Upgrade();
+
+ virtual void action(float frame_ratio);
+ virtual void draw(DrawingContext& context);
-typedef struct bullet_type
- {
- int alive;
- float x;
- float y;
- float xm;
- float ym;
- float width;
- float height;
- unsigned int updated;
- itop_type it;
- }
-bullet_type;
+ virtual void collision(const MovingObject& other, int);
+ void collision(void* p_c_object, int c_object, CollisionType type);
-texture_type img_bullet;
-bitmask* bm_bullet;
+private:
+ void bump(Player* player);
+};
-void create_special_bitmasks();
+enum BulletsKind {
+ FIRE_BULLET,
+ ICE_BULLET
+};
-texture_type img_golden_herring;
+class Bullet : public MovingObject
+{
+public:
+ Bullet(const Vector& pos, float xm, int dir,
+ int kind);
+
+ virtual void action(float frame_ratio);
+ virtual void draw(DrawingContext& context);
+ void collision(int c_object);
-void upgrade_init(upgrade_type *pupgrade);
-void upgrade_action(upgrade_type *pupgrade);
-void upgrade_draw(upgrade_type *pupgrade);
-void upgrade_collision(upgrade_type *pupgrade, void* p_c_object, int c_object);
+ virtual void collision(const MovingObject& other_object, int type);
-void bullet_init(bullet_type *pbullet);
-void bullet_action(bullet_type *pbullet);
-void bullet_draw(bullet_type *pbullet);
-void bullet_collision(bullet_type *pbullet, int c_object);
+ int kind;
+
+private:
+ int life_count;
+ Physic physic;
+};
#endif /*SUPERTUX_SPECIAL_H*/