move over rewritten lispreader from tuxkart (with additional fixes), generalized...
[supertux.git] / src / object / gameobjs.h
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 //  Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 //
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License
9 //  as published by the Free Software Foundation; either version 2
10 //  of the License, or (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 // 
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 //  02111-1307, USA.
21 #ifndef SUPERTUX_GAMEOBJS_H
22 #define SUPERTUX_GAMEOBJS_H
23
24 #include "video/surface.h"
25 #include "timer.h"
26 #include "scene.h"
27 #include "math/physic.h"
28 #include "special/game_object.h"
29 #include "special/moving_object.h"
30 #include "serializable.h"
31
32 /* Bounciness of distros: */
33 #define NO_BOUNCE 0
34 #define BOUNCE 1
35
36 namespace SuperTux {
37 class Sprite;
38 }
39
40 class BouncyCoin : public GameObject
41 {
42 public:
43   BouncyCoin(const Vector& pos);
44   ~BouncyCoin();
45   virtual void action(float elapsed_time);
46   virtual void draw(DrawingContext& context);
47
48 private:
49   Sprite* sprite;
50   Vector position;
51   Timer2 timer;
52 };
53
54 class BrokenBrick : public GameObject
55 {
56 public:
57   BrokenBrick(Sprite* sprite, const Vector& pos, const Vector& movement);
58   ~BrokenBrick();
59
60   virtual void action(float elapsed_time);
61   virtual void draw(DrawingContext& context);
62
63 private:
64   Timer2 timer;
65   Sprite* sprite;
66   Vector position;
67   Vector movement;
68 };
69
70 class FloatingText : public GameObject
71 {
72 public:
73   FloatingText(const Vector& pos, const std::string& text_);
74   FloatingText(const Vector& pos, int s);  // use this for score, for instance
75   
76   virtual void action(float elapsed_time);
77   virtual void draw(DrawingContext& context);
78
79 private:
80   Vector position;
81   std::string text;
82   Timer2 timer;  
83 };
84
85 extern Sprite *img_smoke_cloud;
86
87 class SmokeCloud : public GameObject
88 {
89 public:
90   SmokeCloud(const Vector& pos);
91   
92   virtual void action(float elapsed_time);
93   virtual void draw(DrawingContext& context);
94
95 private:
96   Timer2 timer;
97   Vector position;
98 };
99
100 class Particles : public GameObject
101 {
102 public:
103   Particles(const Vector& epicenter, int min_angle, int max_angle,
104             const Vector& initial_velocity, const Vector& acceleration,
105             int number, Color color, int size, float life_time, int drawing_layer);
106   ~Particles();
107   
108   virtual void action(float elapsed_time);
109   virtual void draw(DrawingContext& context);
110
111 private:
112   Vector accel;
113   Timer2 timer;
114   bool live_forever;
115
116   Color color;
117   float size;
118   int drawing_layer;
119
120   struct Particle {
121     Vector pos, vel;
122 //     float angle;
123     };
124   std::vector <Particle*> particles;
125 };
126
127 void load_object_gfx();
128 void free_object_gfx();
129
130 #endif 
131
132 /* Local Variables: */
133 /* mode:c++ */
134 /* End: */