SBSPSS/Utils/MapEdit/Layer.h

126 lines
3.7 KiB
C
Raw Normal View History

2000-09-25 17:43:52 +02:00
/******************/
/*** Layer Core ***/
/******************/
#ifndef __LAYER_HEADER__
#define __LAYER_HEADER__
#include <Vector>
2000-12-04 17:47:34 +01:00
#include <Vector3.h>
2000-11-02 16:46:17 +01:00
#include "Map.h"
2000-12-29 23:20:38 +01:00
#include "Select.h"
2000-12-06 20:29:40 +01:00
#include "LayerDef.h"
2000-09-25 17:43:52 +02:00
2000-11-03 23:40:41 +01:00
/*****************************************************************************/
2001-01-23 22:53:48 +01:00
struct sLayerInfoTable
2000-11-03 23:40:41 +01:00
{
2001-01-23 22:53:48 +01:00
LAYER_TYPE Type;
LAYER_SUBTYPE SubType;
char *Name;
bool DeleteFlag;
float ScaleFactor;
bool Render3dFlag;
bool ResizeFlag;
2001-02-07 22:31:31 +01:00
bool ExportFlag;
2001-03-01 18:28:20 +01:00
int SubView;
2001-01-23 22:53:48 +01:00
2000-11-03 23:40:41 +01:00
};
2001-01-23 22:53:48 +01:00
/*****************************************************************************/
enum LAYER_ENUMS
2000-11-30 23:17:55 +01:00
{
2001-01-23 22:53:48 +01:00
SELECT_BUFFER_SIZE=16,
2001-02-09 22:17:01 +01:00
TileLayerMinWidth=32,
TileLayerMinHeight=22,
2000-11-30 23:17:55 +01:00
};
2000-09-25 17:43:52 +02:00
/*****************************************************************************/
2000-11-02 16:46:17 +01:00
class CCore;
2000-11-24 23:34:20 +01:00
class CExport;
2000-09-25 17:43:52 +02:00
class CLayer
{
public:
2001-03-01 18:28:20 +01:00
CLayer();
2000-11-07 21:38:19 +01:00
virtual ~CLayer(){};
2000-09-25 17:43:52 +02:00
2001-03-26 23:29:09 +02:00
void InitLayer(sLayerDef &LayerDef);
2001-01-23 22:53:48 +01:00
static sLayerInfoTable InfoTable[];
static int InfoTableSize;
static int GetLayerIdx(int Type,int SubType);
2001-03-26 23:29:09 +02:00
static CLayer *NewLayer(sLayerDef &Def);
static CLayer *LoadLayer(CFile *File,int Version);
2001-03-27 18:26:43 +02:00
char *GetName() {return(InfoTable[TableIdx].Name);}
2001-03-26 23:29:09 +02:00
bool CanDelete() {return(InfoTable[TableIdx].DeleteFlag);}
float GetScaleFactor() {return(InfoTable[TableIdx].ScaleFactor);}
bool GetRender3dFlag() {return(InfoTable[TableIdx].Render3dFlag);}
bool GetResizeFlag() {return(InfoTable[TableIdx].ResizeFlag);}
bool CanExport() {return(InfoTable[TableIdx].ExportFlag);}
bool IsUnique() {return(!(InfoTable[TableIdx].ExportFlag));}
int GetSubViewType() {return((InfoTable[TableIdx].SubView));}
2001-01-23 22:53:48 +01:00
2001-03-01 18:28:20 +01:00
virtual void InitSubView(CCore *Core){};
virtual CLayer *GetSubView() {return(SubView);}
2001-03-26 23:29:09 +02:00
virtual void SetVisible(bool f) {LayerDef.VisibleFlag=f;}
virtual bool IsVisible() {return(LayerDef.VisibleFlag);}
virtual int GetType() {return(LayerDef.Type);}
virtual int GetSubType() {return(LayerDef.SubType);}
2001-05-05 23:18:12 +02:00
virtual void LoadGfx(CCore *Core)=0;
2000-09-25 17:43:52 +02:00
2001-03-13 22:00:34 +01:00
virtual void Render(CCore *Core,Vector3 &CamPos,bool Is3d){};
2001-04-05 16:20:56 +02:00
virtual void Render4TGA(const char *Filename){}
2001-03-13 22:00:34 +01:00
virtual void RenderGrid(CCore *Core,Vector3 &CamPos,bool Active);
virtual void RenderSelection(CCore *Core,Vector3 &ThisCam){};
virtual void RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d){};
virtual void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos);
virtual void GUIInit(CCore *Core){};
virtual void GUIKill(CCore *Core){};
virtual void GUIUpdate(CCore *Core){};
virtual void GUIChanged(CCore *Core){};
2000-11-02 16:46:17 +01:00
2001-03-26 23:29:09 +02:00
virtual int GetWidth() {return(LayerDef.Width);}
virtual int GetHeight() {return(LayerDef.Height);}
2000-11-30 23:17:55 +01:00
virtual void CheckLayerSize(int Width,int Height){};
2001-03-26 23:29:09 +02:00
virtual void Validate(CCore *Core){};
2001-03-05 21:49:46 +01:00
virtual bool Resize(int Width,int Height) {return(false);}
2000-11-17 22:36:13 +01:00
2001-03-26 23:29:09 +02:00
virtual void Load(CFile *File,int Version);
virtual void Save(CFile *File);
2000-11-20 21:33:42 +01:00
2000-11-29 18:07:57 +01:00
virtual void Export(CCore *Core,CExport &Exp)=0;
2000-11-24 23:34:20 +01:00
2001-03-05 21:49:46 +01:00
virtual Vector3 &GetCam() {return(LayerCam);}
2001-01-21 19:04:00 +01:00
2000-11-15 22:22:40 +01:00
// Functions
2001-03-01 18:28:20 +01:00
virtual bool LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag){return(false);}
virtual bool RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag){return(false);}
virtual bool MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos){return(false);}
virtual bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0){return(false);};
2000-12-11 22:29:59 +01:00
2000-11-07 21:38:19 +01:00
protected:
2001-01-23 22:53:48 +01:00
2001-03-26 23:29:09 +02:00
// Saved Vars
sLayerDef LayerDef;
// Static Quick Vars
int TableIdx;
// float ScaleFactor;
// bool Render3dFlag;
// bool ResizeFlag;
2000-12-29 23:20:38 +01:00
CSelect Selection;
2001-03-01 18:28:20 +01:00
CLayer *SubView;
2001-03-05 21:49:46 +01:00
Vector3 LayerCam;
2000-09-25 17:43:52 +02:00
};
2000-11-02 16:46:17 +01:00
2000-09-25 17:43:52 +02:00
/*****************************************************************************/
#endif