00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef ENEMYMANAGER_H
00025 #define ENEMYMANGER_H
00026
00027
00028 #include <list>
00029 #include <string>
00030 #include <bitset>
00031 #include <log4cxx/logger.h>
00032
00033
00034 #include "Enemy_Help.hpp"
00035 #include "Enemy.hpp"
00036 #include "Ally.hpp"
00037 #include "Player.hpp"
00038 #include "PowerUp.hpp"
00039 #include "XML-Errors.hpp"
00040
00044 class CEnemyManager
00045 {
00046 struct S_no_fight
00047 {
00048 int begin, end;
00049 };
00050
00051 struct less_S_no_fight
00052 : public std::binary_function<S_no_fight, S_no_fight, bool>
00053 {
00054 bool operator()(const S_no_fight& x, const S_no_fight& y) const {return x.begin < y.begin;}
00055 };
00056
00057 std::bitset<(SCREEN_X_SIZE - HUD_SIZE_X)> m_owned_enemy;
00058 std::bitset<(SCREEN_X_SIZE - HUD_SIZE_X)> m_owned_ally;
00059 std::bitset<(SCREEN_X_SIZE - HUD_SIZE_X)> m_bs_empty;
00060
00061 std::list<ANPC*> m_ActiveEnemys;
00062 std::list<ANPC*> m_PassiveEnemys;
00063
00064 std::list<S_no_fight> m_no_fight;
00065
00066 std::list<ANPC*> m_ActiveAllys;
00067 std::list<ANPC*> m_PassiveAllys;
00068
00069 std::list<projectileData> m_regProjectiles_Ally;
00070 std::list<projectileData> m_regProjectiles_Enemy;
00071
00072 std::list<CPowerUp*> m_PowerUps;
00073
00074 std::list<ANPC*>::iterator m_NextToEvaluate_Enemy;
00075 std::list<ANPC*>::iterator m_NextToEvaluate_Ally;
00076
00077 std::list<SInfo*> m_Infos;
00078
00079
00080 int m_max_power;
00081 int m_activePower;
00082 float m_fancy[(SCREEN_X_SIZE - HUD_SIZE_X)];
00083 int m_activeWave;
00084
00085
00086 bool* p_blend;
00087 std::list<SInfo*>* p_Infos;
00088
00089 AI_parameter* parameter;
00090
00091 strength m_strength[10];
00092
00093 global_data_pointers m_Data;
00094
00095 CPlayer *player;
00096
00097 log4cxx::LoggerPtr log_;
00098
00099 errorCode readFile(std::string filename);
00100
00101 errorCode readParameter(std::string filename);
00102
00103 void registerProjectiles(std::list<ANPC*>& source, std::list<projectileData>& dest);
00104 void registerProjectiles();
00105
00106 void update_owned(std::list<ANPC*>& source, std::bitset<(SCREEN_X_SIZE - HUD_SIZE_X)>& dest);
00107 void update_owned();
00108
00109
00110 public:
00111 CEnemyManager()
00112 : m_max_power(4),
00113 parameter(NULL),
00114 player(NULL),
00115 log_(log4cxx::Logger::getLogger("EnemyManager"))
00116 {}
00117
00118 bool reset();
00119 int clearPowerups();
00120 bool init(std::string filename_waves, std::string filename_parameter, global_data_pointers Data, CPlayer *player, bool* play_Info, std::list<SInfo*>* Infos);
00121 bool update();
00122 bool hasWon()
00123 {if (m_ActiveEnemys.size() == 0 && m_PassiveEnemys.size() == 0 && m_Infos.size() == 0 && !*p_blend) return true; return false;}
00124 strength* getStrength(int level);
00125
00126 };
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 #endif