00001
00002
00003
00004
00005
00006
00007
00008 #ifndef GAMEMGR_H_
00009 #define GAMEMGR_H_
00010 #include <const.h>
00011 #include <enums.h>
00012 #include <buildings.h>
00013
00014 namespace FastEcslent {
00015
00016 typedef struct {
00017 int gas;
00018 int minerals;
00019 } Resources;
00020
00021 typedef struct {
00022 int minerals;
00023 int gas;
00024 int supply;
00025 int buildTime;
00026 int HotKey;
00027 int transportSize;
00028 int sightRange;
00029
00030
00031 int hitPoints;
00032 float armor;
00033 float damage;
00034 int targetPriority;
00035 float cooldown;
00036 float range;
00037
00038
00039 float speed;
00040 float acc;
00041 float dec;
00042 float rotSpeed;
00043 float collisionRadius;
00044
00045 bool neededTypes[NENTITYTYPES];
00046 bool buildableEntities[NENTITYTYPES];
00047 int nNeededTypes;
00048
00049 } GameEntTypeProperties;
00050
00051
00052 class Engine;
00053
00054 class GameMgr : public Mgr {
00055
00056 private:
00057 int mineralPatchID;
00058 bool mineralPatchInit;
00059 bool initMining;
00060 std::vector<MineralPatch*> mineralPatches;
00061
00062 public:
00063
00064 Options options;
00065
00066 int popCap[NPLAYERS];
00067 int pop[NPLAYERS];
00068 int currentPopCap[NPLAYERS];
00069 int currentEntityCounts[NPLAYERS][NENTITYTYPES];
00070 Entity *playerEnts[NPLAYERS][PerPlayerMaxEnts];
00071 int playerNEnts[NPLAYERS];
00072
00073 GameEntTypeProperties entTypeData[NENTITYTYPES];
00074 Resources resources[NPLAYERS];
00075
00076 GameMgr();
00077 GameMgr(Engine *eng, Options opts);
00078
00079 void init();
00080 virtual void loadLevel();
00081 void tick(double dtime);
00082
00083 bool preReqExists(Player playerId, EntityType entType);
00084 bool preReqResources(Player playerId, EntityType entType);
00085 bool preReqEntities(Player playerId, EntityType entType);
00086 bool consumeResources(Player playerId, EntityType entityType);
00087 bool returnResources(Player playerId, EntityType entityType);
00088 bool notExceedPopCap(Identity entId);
00089 void setupEntityBuildTimes();
00090 void setupEntitySupply();
00091 void setupEntityBuildables();
00092
00093
00094 void WaterCraft();
00095 void makeBaseForSidePlayer(Side side, Player player, Ogre::Vector3 location, float offset, float yawOffset);
00096 std::vector<Entity*> createNEntitiesRadial(EntityType entType, int n, Side side, Player player, Ogre::Vector3 location, float offset, float yawOffset, int yawOffsetMultiplier = 1);
00097 void createMineralPatch(int n, Side side, Player player, Ogre::Vector3 location, float offset, float yawOffset, int yawOffsetMultiplier = 1);
00098 void startMining(Side side, Player player);
00099 Entity* findClosestEntityOfTypeWithinDistance(EntityType entityType, Ogre::Vector3 pos, float distance, Side side, Player player);
00100
00101
00102
00103 void game0();
00104 void tester();
00105 void clearClient();
00106
00107 MineralPatch* getMineralPatch(int id);
00108 MineralPatch* initMineralPatch();
00109 };
00110
00111 }
00112
00113
00114 #endif