00001
00002
00003
00004
00005
00006
00007
00009
00016 #ifndef __MAP_ZONES_HEADER__
00017 #define __MAP_ZONES_HEADER__
00018
00019 #include "utils.h"
00020 #include "defs.h"
00021
00022
00023 namespace hoa_map {
00024
00025 namespace private_map {
00026
00036 class ZoneSection {
00037 public:
00038 ZoneSection(uint16 s_col, uint16 s_row, uint16 e_col, uint16 e_row) :
00039 start_row(s_row), start_col(s_col), end_row(e_row), end_col(e_col)
00040 {}
00041
00043 uint16 start_row, start_col;
00044
00046 uint16 end_row, end_col;
00047 };
00048
00049
00058 class MapZone {
00059 public:
00060 MapZone()
00061 {}
00062
00063 virtual ~MapZone()
00064 {}
00065
00066 void AddSection(ZoneSection * section);
00067
00073 bool IsInsideZone(uint16 pos_x, uint16 pos_y);
00074
00076 virtual void Update()
00077 {}
00078
00079 protected:
00081 std::vector<ZoneSection> _sections;
00082
00087 void _RandomPosition(uint16& x, uint16& y);
00088 };
00089
00090
00098 class EnemyZone : public MapZone {
00099 public:
00100 EnemyZone(uint32 regen_time, bool restrained);
00101
00102 virtual ~EnemyZone()
00103 {}
00104
00110 void AddEnemy(EnemySprite* new_enemy, MapMode* map, uint8 count = 1);
00111
00113 void EnemyDead();
00114
00116 void Update();
00117
00119
00120 bool IsRestraining() const
00121 { return _restrained; }
00123
00124 private:
00126 uint32 _regen_time;
00127
00129 uint32 _spawn_timer;
00130
00132 uint8 _active_enemies;
00133
00135 bool _restrained;
00136
00138 std::vector<EnemySprite*> _enemies;
00139 };
00140
00141 }
00142
00143 }
00144
00145 #endif // __MAP_ZONES_HEADER__