Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

objmgr.h

Go to the documentation of this file.
00001 #ifndef __OBJMGR_H
00002 #define __OBJMGR_H
00003 
00004 class ObjectManager;
00005 
00006 #include <list>
00007 #include "object.h"
00008 #include "graphics.h"
00009 #include "main_char.h"
00010 #include "ufo.h"
00011 #include "crosshair.h"
00012 #include "explode.h"
00013 #include "bearspawn.h"
00014 #include "subworld.h"
00015 
00016 enum objecttype { OT_MAINCHAR, OT_CROSSHAIR, OT_UFO, OT_EXPLODE, OT_BEAR, OT_BEARSPAWN, OT_UNKNOWN };
00017 
00018 class ObjectManager {
00019 public:
00020         ObjectManager();
00021         ~ObjectManager();
00022 
00023         void AddObject(GameObject *, objecttype = OT_UNKNOWN);
00024         GameObject* AddObject(objecttype);
00025         GameObject* GetObject(objecttype);
00026         MainChar* GetMainChar() { return ((MainChar *)(GetObject(OT_MAINCHAR))); }
00027         Crosshair* GetCrosshair() { return ((Crosshair *)(GetObject(OT_CROSSHAIR))); }
00028         GameObject* FindFirstCollision(Rect &R, bool exclude = true);
00029                         
00030         vector<Rect> &draw(Graphics &);
00031         void think();
00032         void animate();
00033         void update();
00034         void recenter();
00035 
00036         struct Object {
00037                 GameObject *obj;
00038                 objecttype type;
00039         };
00040 
00041         vector<Rect> &GetDrawList() { return object_draw_list; }
00042 
00043         void SetSubWorld (SubWorld *s) { currentSubWorld = s; }
00044         SubWorld *GetSubWorld() const { return currentSubWorld; }
00045 private:
00046         void AddToAnyObjectList(list<Object *>&, Object *);
00047         void AddToObjectList(Object *);
00048         
00049         list  <Object *> object_list;
00050         vector<Rect> object_draw_list;
00051                 
00052         // Quick reference to objects
00053         MainChar *mainchar;
00054         Crosshair *crosshair;
00055 
00056         SubWorld *currentSubWorld;      // ref to the subworld
00057 };
00058 
00059 #endif
00060 

Generated on Sun Dec 8 12:02:20 2002 for nnc by doxygen1.3-rc1