00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MINIMAP_H
00019 #define MINIMAP_H
00020
00021 #define MINI_MAP_X_SCALE 3
00022 #define MINI_MAP_Y_SCALE 3
00023
00024 #define MINI_MAP_PARTY_VIEW 4
00025
00026 #define MINI_MAP_WIDTH MAP_WIDTH/MINI_MAP_X_SCALE
00027 #define MINI_MAP_DEPTH MAP_DEPTH/MINI_MAP_Y_SCALE
00028
00029
00030 #include "constants.h"
00031 #include "location.h"
00032 #include "sdlhandler.h"
00033 #include "shape.h"
00034 #include "map.h"
00035 #include "dungeongenerator.h"
00036 #include "scourge.h"
00037 #include "math.h"
00038 #include "gui/window.h"
00039 #include "gui/canvas.h"
00040 #include "gui/widgetview.h"
00041
00042 using namespace std;
00043
00044
00045 class Shape;
00046
00047 class Scourge;
00048 class Util;
00049 class Location;
00050
00051 typedef struct _MiniMapPoint {
00052 GLfloat r, g, b;
00053 bool visible;
00054 }MiniMapPoint;
00055
00059 class MiniMap : public WidgetView {
00060 private:
00061
00062
00063
00064 MiniMapPoint pos[MINI_MAP_WIDTH][MINI_MAP_DEPTH];
00065 Scourge *scourge;
00066
00067 Window *win;
00068 Canvas *canvas;
00069
00070 GLfloat zoomFactor;
00071 int mode;
00072 bool showMiniMap;
00073 int screenHeight;
00074
00075
00076 int textureSizeH, textureSizeW;
00077 GLuint texture[1];
00078 unsigned char * textureInMemory;
00079 bool mustBuildTexture;
00080
00081
00082
00083 int effectiveWidth, effectiveHeight;
00084 int maxX, maxY;
00085 int minX, minY;
00086 float midX, midY;
00087
00088
00089 void toMiniMapCoord(int &x, int &y);
00090
00091 public:
00092 MiniMap::MiniMap();
00093 MiniMap::~MiniMap();
00094 MiniMap(Scourge *scourge);
00095
00096 void reset();
00097
00098 inline void show() { win->setVisible(true); }
00099 inline void hide() { win->setVisible(false); }
00100 inline Window *getWindow() { return win; }
00101 inline void resize(int w, int h) { win->resize(w, h); canvas->resize(w, h - 25); }
00102
00103
00104 void colorMiniMapPoint(int x, int y, Shape *shape, Location *pos);
00105 void eraseMiniMapPoint(int x, int y);
00106 void zoomIn();
00107 void zoomOut();
00108
00109 bool checkInside(int a, int b);
00110 inline void toggle(){showMiniMap = !showMiniMap;}
00111 void computeDrawValues();
00112 void updateFog(int a, int b);
00113 void buildTexture(int xCoord, int yCoord);
00114
00115 void drawWidget(Widget *w);
00116
00117
00118
00119 protected:
00120
00121 };
00122
00123 #endif