00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00033
00034 #ifndef ARMAGETRON_CMAP_H
00035 #define ARMAGETRON_CMAP_H
00036
00037 #include "cockpit/cWidgetBase.h"
00038
00039 #ifndef DEDICATED
00040
00041 #include "tList.h"
00042 #include "gWall.h"
00043 #include "ePlayer.h"
00044 #include <deque>
00045 #include <vector>
00046
00047 namespace cWidget {
00048
00050 class Map : public WithCoordinates, public WithBackground, public WithForeground {
00051 void DrawRimWalls( tList<eWallRim> &list );
00052 void DrawWalls(tList<gNetPlayerWall> &list);
00053
00054 void DrawObjects(tCoord scale);
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 void DrawMap(bool rimWalls, bool cycleWalls,
00067 double cycleSize, double border,
00068 double x, double y, double w, double h,
00069 double rw, double rh, double ix, double iy);
00070
00071
00073 typedef enum {
00074 MODE_STD,
00075 MODE_ZONE,
00076 MODE_CYCLE
00077 } mode_t;
00079 typedef enum {
00080 ROTATION_FIXED,
00081 ROTATION_SPAWN,
00082 ROTATION_CYCLE,
00083 ROTATION_CAMERA
00084 } rotation_t;
00085 mode_t m_mode;
00086 tCoord m_centre;
00087 float m_zoom;
00088 rotation_t m_rotation;
00089
00090 int m_toggleKey;
00091
00092 void ToggleMode(void);
00093
00094 class Clipper {
00095 public:
00096 virtual ~Clipper(){}
00097 virtual void Begin(Map &map, tCoord const &e1, tCoord const &e2) = 0;
00098 virtual void End() = 0;
00099 };
00100 class ClipperRect : public Clipper {
00101 public:
00102 static Clipper *create() {return new ClipperRect;}
00103 void Begin(Map &map, tCoord const &e1, tCoord const &e2);
00104 void End();
00105 };
00106 friend class ClipperRect;
00107 class ClipperCircle : public Clipper {
00108 int m_edges;
00109 void Clip(int i, tCoord const &u, tCoord const &v);
00110 public:
00111 static Clipper *create() {return new ClipperCircle;}
00112 ClipperCircle();
00113 void Begin(Map &map, tCoord const &e1, tCoord const &e2);
00114 void End();
00115 };
00116 friend class ClipperCircle;
00117 std::auto_ptr<Clipper> m_clipper;
00118
00119 class Mode {
00120 public:
00121 mode_t m_mode;
00122 rotation_t m_rotation;
00123 float m_zoom;
00124 Clipper *(*m_clipper)(void);
00125 Mode(tXmlParser::node cur);
00126 };
00127 std::vector<Mode> m_modes;
00128 int m_currentMode;
00129 void Apply(Mode const &mode);
00130 public:
00131 void HandleEvent(bool state, int id);
00132 void Render();
00133 virtual bool Process(tXmlParser::node cur);
00134
00135 Map();
00136 };
00137
00138 }
00139
00140 #endif
00141 #endif