SBSPSS/Utils/MapEdit/LayerThing.h

93 lines
2.4 KiB
C
Raw Normal View History

2001-03-22 21:49:58 +01:00
/*******************/
/*** Layer Thing ***/
/*******************/
2001-03-21 00:06:17 +01:00
2001-03-22 21:49:58 +01:00
#ifndef __LAYER_THING_HEADER__
#define __LAYER_THING_HEADER__
2001-03-21 00:06:17 +01:00
#include "Layer.h"
#include "MapEdit.h"
#include "GUIToolbar.h"
#include "Elem.h"
/*****************************************************************************/
2001-03-22 21:49:58 +01:00
struct sLayerThing
2001-03-21 00:06:17 +01:00
{
2001-03-22 21:49:58 +01:00
std::vector<CPoint> XY;
int Type;
int SubType;
int Spare[8];
bool operator==(sLayerThing const &v1)
{
if (XY[0]!=v1.XY[0]) return(false);
return(true);
}
2001-03-21 00:06:17 +01:00
};
/*****************************************************************************/
2001-03-26 23:29:09 +02:00
class CIni;
2001-03-22 21:49:58 +01:00
class CLayerThing : public CLayer
2001-03-21 00:06:17 +01:00
{
public:
enum MouseMode
{
2001-03-22 21:49:58 +01:00
MouseModeNormal=0,
MouseModePoints,
2001-03-21 00:06:17 +01:00
};
2001-03-22 21:49:58 +01:00
CLayerThing(){};
2001-03-26 23:29:09 +02:00
CLayerThing(sLayerDef &Def); // New Layer
CLayerThing(CFile *File,int Version) {Load(File,Version);}
2001-03-22 21:49:58 +01:00
~CLayerThing();
2001-03-21 00:06:17 +01:00
2001-03-26 23:29:09 +02:00
void InitLayer(sLayerDef &Def);
2001-03-21 00:06:17 +01:00
virtual void InitSubView(CCore *Core);
virtual void Render(CCore *Core,Vector3 &CamPos,bool Is3d);
void RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d);
virtual void GUIInit(CCore *Core);
virtual void GUIKill(CCore *Core);
virtual void GUIUpdate(CCore *Core);
virtual void GUIChanged(CCore *Core);
2001-03-22 21:49:58 +01:00
int GetWidth() {return(Width);}
int GetHeight() {return(Height);}
2001-03-21 00:06:17 +01:00
virtual void Load(CFile *File,int Version);
virtual void Save(CFile *File);
2001-03-26 23:29:09 +02:00
virtual void LoadThingScript(const char *Filename);
2001-03-21 00:06:17 +01:00
virtual void Export(CCore *Core,CExport &Exp);
// Functions
virtual bool LButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFlag);
virtual bool RButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFlag);
virtual bool MouseMove(CCore *Core,UINT nFlags, CPoint &point);
virtual bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0);
protected:
2001-03-22 21:49:58 +01:00
void RenderThing(CCore *Core,Vector3 &CamPos,sLayerThing &ThisThing,bool Render3d,bool Selected);
int CheckThing(CPoint &Pos);
void AddThing(CPoint &Pos);
void SelectThing(CPoint &Pos);
int CheckThingPoint(CPoint &Pos);
void AddThingPoint(CPoint &Pos);
void SelectThingPoint(CPoint &Pos);
void UpdatePos(CPoint &Pos,int Thing,int PosNo,bool Recurs=false);
2001-03-21 00:06:17 +01:00
2001-03-22 21:49:58 +01:00
int Width,Height;
2001-03-26 23:29:09 +02:00
CIni ThingScript;
2001-03-22 21:49:58 +01:00
CElemBank *ThingBank;
CList<sLayerThing> ThingList;
int CurrentThing,CurrentPoint;
2001-03-21 00:06:17 +01:00
MouseMode Mode;
};
/*****************************************************************************/
#endif