SBSPSS/Utils/MapEdit/LayerThing.h

128 lines
3.9 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"
2001-04-07 23:05:33 +02:00
#include "GUILayerThing.h"
#include "GUILayerThingPos.h"
2001-03-21 00:06:17 +01:00
#include "Elem.h"
2001-04-07 23:05:33 +02:00
#include "ExportHdr.h" // For thing data struct
2001-03-21 00:06:17 +01:00
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
struct sLayerThing
2001-03-22 21:49:58 +01:00
{
2001-03-29 19:59:01 +02:00
GString Name;
CList<CPoint> XY;
int ElemID;
sLayerThingData Data;
2001-03-22 21:49:58 +01:00
2001-03-29 19:59:01 +02:00
bool operator==(const char *Name1) {return (Name==Name1);}
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,
2001-03-29 19:59:01 +02:00
MouseModeNew,
2001-03-22 21:49:58 +01:00
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-04-19 17:36:49 +02:00
int GetWidth();
int GetHeight();
2001-05-05 23:18:12 +02:00
virtual void LoadGfx(CCore *Core) {if (ThingBank->NeedLoad()) ThingBank->LoadAllSets(Core);}
2001-03-29 19:59:01 +02:00
virtual void GUIThingDefClear(){};
2001-03-31 17:40:20 +02:00
virtual void GUIThingUpdate(bool OnlySel=false){};
virtual void GUIThingUpdateList(CComboBox &List,bool OnlySel=false);
virtual void GUIThingPointUpdate(bool OnlySel=false){};
virtual void GUIThingPointUpdateList(CListBox &List,bool OnlySel=false);
2001-03-22 21:49:58 +01:00
2001-03-21 00:06:17 +01:00
virtual void Load(CFile *File,int Version);
2001-03-29 19:59:01 +02:00
virtual void LoadThing(CFile *File,int Version,sLayerThing &ThisThing);
2001-04-30 23:49:54 +02:00
virtual void LoadOldThing(CFile *File,sLayerThing &ThisThing)=0;
2001-03-29 19:59:01 +02:00
virtual void LoadThingNames(CFile *File,int Version);
2001-03-21 00:06:17 +01:00
virtual void Save(CFile *File);
2001-03-29 19:59:01 +02:00
virtual void SaveThing(CFile *File,sLayerThing &ThisThing);
virtual void SaveThingNames(CFile *File);
2001-03-26 23:29:09 +02:00
virtual void LoadThingScript(const char *Filename);
2001-04-30 23:49:54 +02:00
virtual void LoadDefThing(const char *Name,sLayerThing &ThisDef)=0;
2001-03-21 00:06:17 +01:00
virtual void Export(CCore *Core,CExport &Exp);
2001-04-23 16:51:44 +02:00
virtual void ExportThing(CCore *Core,CExport &Exp,sLayerThing &ThisThing);
virtual void ExportThingData(CCore *Core,CExport &Exp,sLayerThing &ThisThing,sLayerThingData &OutThing){}
2001-03-29 19:59:01 +02:00
virtual void ExportThingNames(CExport &Exp);
2001-03-21 00:06:17 +01:00
2001-05-09 23:56:48 +02:00
virtual bool CanMirror(){return(false);}
virtual bool CanRotate(){return(false);}
2001-03-21 00:06:17 +01:00
// 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-29 19:59:01 +02:00
virtual int FindDefThing(const char *Name);
virtual void SetCursor(const char *Name);
2001-04-07 23:05:33 +02:00
virtual void RenderThing(CCore *Core,Vector3 &CamPos,sLayerThing &ThisThing,bool Render3d,bool Selected);
2001-03-22 21:49:58 +01:00
int CheckThing(CPoint &Pos);
void AddThing(CPoint &Pos);
2001-03-29 19:59:01 +02:00
int SelectThing(CPoint &Pos);
int SelectThing(int Idx);
void DeleteThing();
2001-04-07 23:05:33 +02:00
void GotoThing(CCore *Core);
2001-03-22 21:49:58 +01:00
int CheckThingPoint(CPoint &Pos);
void AddThingPoint(CPoint &Pos);
2001-03-29 19:59:01 +02:00
int SelectThingPoint(CPoint &Pos);
2001-03-22 21:49:58 +01:00
void UpdatePos(CPoint &Pos,int Thing,int PosNo,bool Recurs=false);
2001-03-29 19:59:01 +02:00
void MovePoint(int Dir);
void DeletePoint();
void Cancel();
2001-04-07 23:05:33 +02:00
virtual void SetThingParams(sLayerThing &Thing){}
2001-03-21 00:06:17 +01:00
2001-03-26 23:29:09 +02:00
CIni ThingScript;
2001-03-22 21:49:58 +01:00
CElemBank *ThingBank;
2001-03-29 19:59:01 +02:00
CList<sLayerThing> DefList;
2001-03-22 21:49:58 +01:00
CList<sLayerThing> ThingList;
2001-03-29 19:59:01 +02:00
int CurrentDefThing;
int CurrentThing,CurrentThingPoint;
2001-03-21 00:06:17 +01:00
MouseMode Mode;
2001-03-29 19:59:01 +02:00
sLayerThing Cursor;
2001-03-31 17:40:20 +02:00
bool DrawPoints;
2001-04-07 23:05:33 +02:00
CGUILayerThing GUIThing;
CGuiLayerThingPos GUIThingPos;
2001-03-21 00:06:17 +01:00
};
/*****************************************************************************/
#endif