SBSPSS/Utils/MapEdit/LayerRGB.h

124 lines
2.8 KiB
C
Raw Normal View History

2001-07-26 22:16:11 +02:00
/*******************/
2001-07-28 18:33:48 +02:00
/*** Layer RGB ***/
2001-07-26 22:16:11 +02:00
/*******************/
2001-07-28 18:33:48 +02:00
#ifndef __LAYER_RGB_HEADER__
#define __LAYER_RGB_HEADER__
2001-07-26 22:16:11 +02:00
#include "Layer.h"
#include "MapEdit.h"
2001-07-28 18:33:48 +02:00
#include "GUILayerRGB.h"
2001-07-26 22:16:11 +02:00
#include "Elem.h"
#include "ExportHdr.h"
2001-07-28 18:33:48 +02:00
struct sRGBElem
2001-07-26 22:16:11 +02:00
{
2001-07-28 18:33:48 +02:00
u8 R,G,B;
2001-07-26 22:16:11 +02:00
};
2001-08-02 14:42:38 +02:00
struct sRGBUndo
{
bool Valid;
std::vector< std::vector<sRGBElem> > Map;
};
2001-07-26 22:16:11 +02:00
/*****************************************************************************/
class CCore;
2001-07-28 18:33:48 +02:00
class CLayerRGB : public CLayer
2001-07-26 22:16:11 +02:00
{
public:
enum
{
2001-07-28 18:33:48 +02:00
GUI_MODE_PAINT=0,
GUI_MODE_LIGHTEN,
GUI_MODE_DARKEN,
GUI_MODE_MAX
};
struct sRGBBrush
{
2001-08-02 14:42:38 +02:00
GString Name;
int W,H;
int XOfs,YOfs;
std::vector<u8> Gfx;
2001-07-26 22:16:11 +02:00
};
2001-07-28 18:33:48 +02:00
CLayerRGB(sLayerDef &Def);
CLayerRGB(CFile *File,int Version) {Load(File,Version);}
~CLayerRGB();
2001-07-26 22:16:11 +02:00
void InitLayer(sLayerDef &Def);
void Render(CCore *Core,Vector3 &CamPos,bool Is3d);
void RenderGrid(CCore *Core,Vector3 &CamPos,bool Active){};
void RenderSelection(CCore *Core,Vector3 &ThisCam){};
void RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d);
void GUIInit(CCore *Core);
void GUIKill(CCore *Core);
void GUIUpdate(CCore *Core);
void GUIChanged(CCore *Core);
void CheckLayerSize(int Width,int Height);
bool Resize(int Width,int Height);
void Load(CFile *File,int Version);
void Save(CFile *File);
void Export(CCore *Core,CExport &Exp);
2001-07-28 18:33:48 +02:00
virtual void LoadGfx(CCore *Core){}
void SetSize(int Width,int Height,BOOL ClearFlag);
void Clear();
2001-07-26 22:16:11 +02:00
// Functions
bool LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
bool RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
bool MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos);
2001-08-02 14:42:38 +02:00
bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0);
2001-07-26 22:16:11 +02:00
protected:
2001-08-02 14:42:38 +02:00
void BuildBrushList();
void LoadBrush(const char *Name);
void CreateUndo();
void Undo();
2001-08-02 20:45:20 +02:00
void BiFilter(CCore *Core);
void TriFilter(CCore *Core);
void STriFilter(CCore *Core);
void GetFilterCol(CCore *Core,int X,int Y,int &Col,int &Count);
void SetFilterCol(CCore *Core,int X,int Y,int Col,int Div);
2001-08-02 14:42:38 +02:00
2001-07-26 22:16:11 +02:00
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,bool Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
2001-07-28 18:33:48 +02:00
void Paint(CCore *Core,CPoint &CursorPos);
void Grab(CCore *Core,CPoint &CursorPos);
sRGBElem const &GetRGB(int X,int Y) {return(Map[X][Y]);}
2001-07-26 22:16:11 +02:00
2001-07-28 18:33:48 +02:00
CGUILayerRGB GUIRGB;
2001-08-02 20:45:20 +02:00
sRGBElem ShadeRGB;
2001-07-28 18:33:48 +02:00
int CurrentBrush;
int CurrentMode;
2001-08-02 14:42:38 +02:00
int CurrentRate;
2001-08-02 20:45:20 +02:00
bool SpareFlag;
2001-08-02 14:42:38 +02:00
int CurrentUndo;
2001-07-26 22:16:11 +02:00
2001-07-28 18:33:48 +02:00
int MapWidth,MapHeight;
std::vector< std::vector<sRGBElem> > Map;
2001-07-26 22:16:11 +02:00
2001-08-02 14:42:38 +02:00
std::vector<sRGBBrush> BrushList;
std::vector<sRGBUndo> UndoList;
2001-07-28 18:33:48 +02:00
CPoint LastCursPos;
static char *RGBModeName[GUI_MODE_MAX];
2001-07-26 22:16:11 +02:00
};
/*****************************************************************************/
#endif