00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MAP_H
00023 #define MAP_H
00024
00025 #include "ground.h"
00026 #include "sky.h"
00027 #include "water.h"
00028 #include "../graphic/surface.h"
00029 #include "../graphic/sprite.h"
00030 #include "../graphic/text.h"
00031 #include "../include/base.h"
00032 #include "../object/physical_obj.h"
00033
00034 extern const uint MAX_WIND_OBJECTS;
00035
00036 class Map{
00037 private:
00038 Text * author_info1;
00039 Text * author_info2;
00040
00041 public:
00042 Map();
00043 ~Map();
00044
00045 Ground ground;
00046 Sky sky;
00047 double dst_min_entre_vers;
00048 Water water;
00049
00050 std::list<Rectanglei> *to_redraw;
00051 std::list<Rectanglei> *to_redraw_now;
00052 std::list<Rectanglei> *to_redraw_particles;
00053 std::list<Rectanglei> *to_redraw_particles_now;
00054
00055 public:
00056 void Reset();
00057 void Refresh();
00058 void FreeMem();
00059 void Draw();
00060 void DrawWater();
00061 void DrawSky();
00062 void DrawAuthorName();
00063
00064
00065 void ToRedrawOnMap(Rectanglei r);
00066 void ToRedrawOnScreen(Rectanglei r);
00067
00068
00069 bool EstDansVide (int x, int y);
00070 bool LigneH_EstDansVide (int left, int y, int right);
00071 bool LigneV_EstDansVide (int x, int top, int bottom);
00072 bool RectEstDansVide (const Rectanglei &rect);
00073 bool ParanoiacRectIsInVacuum (const Rectanglei &rect);
00074
00075
00076
00077 bool EstDansVide_haut (const PhysicalObj &obj, int dx, int dy);
00078 bool EstDansVide_bas (const PhysicalObj &obj, int dx, int dy);
00079 bool IsInVacuum_left (const PhysicalObj &obj, int dx, int dy);
00080 bool IsInVacuum_right (const PhysicalObj &obj, int dx, int dy);
00081
00082
00083 bool EstHorsMondeX (int x) const;
00084 bool EstHorsMondeY (int x) const;
00085 bool EstHorsMondeXlarg (int x, uint larg) const;
00086 bool EstHorsMondeYhaut (int x, uint haut) const;
00087 bool EstHorsMondeXY (int x, int y) const;
00088 bool EstHorsMonde (const Point2i &pos) const;
00089
00090
00091 bool EstOuvert() const { return ground.EstOuvert(); }
00092
00093
00094 void Dig(const Point2i position, const Surface& alpha_sur);
00095
00096 void Dig(const Point2i center, const uint radius);
00097
00098
00099 void PutSprite(const Point2i pos, Sprite* spr);
00100
00101 void MergeSprite(const Point2i pos, Sprite* spr);
00102
00103
00104 int GetWidth() const { return ground.GetSizeX(); }
00105 int GetHeight() const { return ground.GetSizeY(); }
00106 Point2i GetSize() const{ return ground.GetSize(); }
00107 private:
00108 void SwitchDrawingCache();
00109 void SwitchDrawingCacheParticles();
00110 void OptimizeCache(std::list<Rectanglei>& rectangleCache);
00111 };
00112
00113 extern Map world;
00114 #endif