2000-11-02 16:46:17 +01:00
|
|
|
/******************/
|
|
|
|
/*** Map Stuph ***/
|
|
|
|
/*****************/
|
|
|
|
|
|
|
|
#ifndef __MAP_HEADER__
|
|
|
|
#define __MAP_HEADER__
|
|
|
|
|
|
|
|
#include <Vector>
|
|
|
|
|
|
|
|
struct sMapElem
|
|
|
|
{
|
2000-11-15 22:22:40 +01:00
|
|
|
int Set;
|
2000-11-02 16:46:17 +01:00
|
|
|
int Tile;
|
|
|
|
int Flags;
|
2000-12-01 22:08:54 +01:00
|
|
|
|
|
|
|
BOOL operator==(sMapElem const &v1) // Doesnt Check flags
|
|
|
|
{
|
|
|
|
return(Set==v1.Set && Tile==v1.Tile);
|
|
|
|
}
|
2000-11-02 16:46:17 +01:00
|
|
|
};
|
|
|
|
|
2000-11-17 00:08:54 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MapElemFlagMirrorX= 1<<0,
|
|
|
|
MapElemFlagMirrorY= 1<<1,
|
|
|
|
};
|
|
|
|
|
2000-11-02 16:46:17 +01:00
|
|
|
/*****************************************************************************/
|
2000-12-06 20:29:40 +01:00
|
|
|
class CFile;
|
|
|
|
class CPoint;
|
2000-11-02 16:46:17 +01:00
|
|
|
class CMap
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CMap(){};
|
|
|
|
~CMap(){};
|
|
|
|
|
2000-11-17 22:36:13 +01:00
|
|
|
int GetWidth();
|
|
|
|
int GetHeight();
|
2000-12-29 23:20:38 +01:00
|
|
|
BOOL IsValid() {return(GetHeight()!=0);}
|
2000-11-02 16:46:17 +01:00
|
|
|
|
2000-11-15 22:22:40 +01:00
|
|
|
void SetSize(int Width,int Height,BOOL Clear=FALSE);
|
2000-11-03 23:40:41 +01:00
|
|
|
void SetWidth(int Width);
|
|
|
|
void SetHeight(int Height);
|
2000-11-15 22:22:40 +01:00
|
|
|
void Clear();
|
2000-11-17 22:36:13 +01:00
|
|
|
void Delete();
|
2000-12-29 23:20:38 +01:00
|
|
|
void MirrorX(int Flag,CRect *R=NULL);
|
|
|
|
void MirrorY(int Flag,CRect *R=NULL);
|
2000-11-03 23:40:41 +01:00
|
|
|
|
2000-11-17 22:36:13 +01:00
|
|
|
sMapElem &Get(int X,int Y);
|
2000-11-29 18:07:57 +01:00
|
|
|
void Set(int X,int Y,sMapElem &Blk,BOOL Force=FALSE);
|
|
|
|
void Set(int X,int Y,CMap &Blk,BOOL Force=FALSE);
|
|
|
|
void Set(CMap &Src,int StartX,int StartY,int Width,int Height,BOOL Force=FALSE);
|
2000-12-29 23:20:38 +01:00
|
|
|
void Set(CMap &Src,CRect &Rect,BOOL Force=FALSE);
|
2001-01-02 15:34:02 +01:00
|
|
|
void Paste(CMap &Src,CRect *R);
|
2000-11-17 22:36:13 +01:00
|
|
|
|
2000-11-20 17:21:43 +01:00
|
|
|
void Resize(int Width,int Height);
|
|
|
|
|
2000-11-17 22:36:13 +01:00
|
|
|
BOOL DoesContainTile(sMapElem &Tile);
|
|
|
|
|
2001-01-23 22:53:48 +01:00
|
|
|
void Load(CFile *File,int Version);
|
2000-11-20 21:33:42 +01:00
|
|
|
void Save(CFile *File);
|
|
|
|
|
2000-11-29 18:07:57 +01:00
|
|
|
void DeleteSet(int Set);
|
|
|
|
void RemapSet(int Old,int New);
|
|
|
|
|
2000-11-20 21:33:42 +01:00
|
|
|
|
2000-12-11 22:29:59 +01:00
|
|
|
|
2000-11-17 22:36:13 +01:00
|
|
|
inline void operator=(CMap &Src)
|
|
|
|
{
|
|
|
|
int Width=Src.GetWidth();
|
|
|
|
int Height=Src.GetHeight();
|
|
|
|
Delete();
|
|
|
|
SetSize(Width,Height);
|
|
|
|
Set(Src,0,0,Width,Height);
|
|
|
|
}
|
2000-11-02 16:46:17 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
std::vector< std::vector<sMapElem> > Map;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
#endif
|