Ryan was right, Tux was firing from the head :D
[supertux.git] / src / gameobjs.h
index 660d2f6..b6cec55 100644 (file)
@@ -110,7 +110,7 @@ class FloatingScore : public GameObject
 /* Trampoline */
 struct TrampolineData
 {
-  int power;
+  float power;
 };
 
 class Trampoline : public GameObject
@@ -131,15 +131,63 @@ class Trampoline : public GameObject
   void collision(void *p_c_object, int c_object, CollisionType type);
 
   Physic physic;
+  enum { M_NORMAL, M_HELD } mode;
 
  private:
-  int power;
+  float power;
   unsigned int frame;
 };
 
-
 void load_object_gfx();
 
+
+class ObjectManager
+{
+ private:
+  ObjectManager();
+  ~ObjectManager();
+
+  static ObjectManager* instance_;
+
+  // XXX Objects will have to be split up into two categories:
+  //  - Drawn before tux
+  //  - Drawn after tux
+  // Eventually Player should be a part of ObjectManager
+
+  std::vector<BadGuy*> badguys;
+  std::vector<Trampoline> trampolines;
+  std::vector<BouncyDistro> bouncy_distros;
+  std::vector<BrokenBrick> broken_bricks;
+  std::vector<BouncyBrick> bouncy_bricks;
+  //std::vector<Upgrade> upgrades;
+  //std::vector<Bullet> bullets;
+
+  void load_badguys(std::string filename);
+
+ public:
+  static ObjectManager* instance() { return instance_ ? instance_ : instance_ = new ObjectManager(); }
+  static void destroy_instance() { delete instance_; instance_ = 0; }
+
+  void draw_bg();
+  void draw_fg();
+  void actions();
+  
+/*  Object* get(unsigned int id) {
+    if(id < badguys.size())
+      {
+        return badguys[id]; 
+      }
+    else
+      {
+        // Never return 0, but return the 0th tile instead so that
+        // user code doesn't have to check for NULL pointers all over
+        // the place
+        return badguys[0]; 
+      } 
+  }
+*/
+};
+
 #endif 
 
 /* Local Variables: */