4 // Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
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.
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.
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
22 #ifndef SUPERTUX_GAMEOBJS_H
23 #define SUPERTUX_GAMEOBJS_H
30 #include "collision.h"
32 enum ObjectType { OBJ_NONE, OBJ_BADGUY, OBJ_TRAMPOLINE };
42 ObjectData(ObjectData* pobject)
43 : x((int)pobject->x), y((int)pobject->y), type(pobject->type), type_specific(pobject->type_specific) {};
44 ObjectData(int x_, int y_, ObjectType type_, T type_specific_)
45 : x(x_), y(y_), type(type_), type_specific(type_specific_) {};
48 : x(0), y(0), type(OBJ_NONE), type_specific() {};
51 /* Bounciness of distros: */
55 class BouncyDistro : public GameObject
59 void init(float x, float y);
60 void action(double frame_ratio);
62 std::string type() { return "BouncyDistro"; };
65 extern Surface* img_distro[4];
67 #define BOUNCY_BRICK_MAX_OFFSET 8
68 #define BOUNCY_BRICK_SPEED 0.9
72 class BrokenBrick : public GameObject
78 void init(Tile* tile, float x, float y, float xm, float ym);
79 void action(double frame_ratio);
81 std::string type() { return "BrokenBrick"; };
84 class BouncyBrick : public GameObject
91 void init(float x, float y);
92 void action(double frame_ratio);
94 std::string type() { return "BouncyBrick"; };
97 class FloatingScore : public GameObject
103 void init(float x, float y, int s);
104 void action(double frame_ratio);
106 std::string type() { return "FloatingScore"; };
111 struct TrampolineData
116 class Trampoline : public GameObject
119 void init(float x, float y);
120 void action(double frame_ratio);
122 std::string type() { return "Trampoline"; };
124 Trampoline(ObjectData<TrampolineData> data)
126 power = data.type_specific.power;
128 init(data.x, data.y);
131 void collision(void *p_c_object, int c_object, CollisionType type);
134 enum { M_NORMAL, M_HELD } mode;
142 void load_object_gfx();
146 /* Local Variables: */