SBSPSS/Utils/MapEdit/Core.h

147 lines
3.9 KiB
C
Raw Normal View History

2000-09-22 17:11:29 +02:00
/***********************/
/*** Map Editor Core ***/
/***********************/
#ifndef __CORE_HEADER__
#define __CORE_HEADER__
#include <Vector>
2000-12-04 17:47:34 +01:00
#include <Vector3.h>
2000-09-25 17:43:52 +02:00
#include "Layer.h"
2000-09-22 17:11:29 +02:00
2000-10-27 20:18:30 +02:00
#include "TexCache.h"
2000-10-27 02:06:19 +02:00
#include "TileSet.h"
2001-02-09 22:17:01 +01:00
#include "MApEdit.h"
#include "LayerList.h"
#include "LayerTileGUI.h"
2001-01-23 22:53:48 +01:00
const s32 FileVersion=2;
2000-09-22 17:11:29 +02:00
2000-12-29 23:20:38 +01:00
#define SCREEN_MAP_WIDTH 30
#define SCREEN_MAP_HEIGHT 20
2000-11-24 23:34:20 +01:00
2000-09-22 17:11:29 +02:00
/*****************************************************************************/
2000-09-22 23:19:46 +02:00
class CMapEditView;
2000-09-22 17:11:29 +02:00
class CCore
{
public:
CCore();
~CCore();
2000-11-02 16:46:17 +01:00
2000-11-06 21:24:11 +01:00
void Init();
2000-11-28 22:16:00 +01:00
BOOL New();
2000-11-20 21:33:42 +01:00
void Load(CFile *File);
void Save(CFile *File);
2000-12-29 23:20:38 +01:00
BOOL Question(char *Txt);
2001-02-14 23:35:47 +01:00
void Render(BOOL ForceRender=FALSE);
void RenderLayers();
void RenderTileView();
2001-02-01 23:48:22 +01:00
void Export(char *Filename);
2000-11-24 23:34:20 +01:00
2001-02-10 21:21:20 +01:00
// View Stuff
void SetView(CMapEditView *View) {CurrentView=View;}
CMapEditView *GetView() {return(CurrentView);}
2000-09-22 23:19:46 +02:00
// Control
2000-11-15 22:22:40 +01:00
void SetMode(int NewMode);
2001-02-14 23:35:47 +01:00
void LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
void MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
void RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
void MouseWheel(UINT nFlags, short zDelta, CPoint &pt);
void MouseMove(UINT nFlags, CPoint &point);
2001-02-09 22:17:01 +01:00
void Zoom(float Dst);
2000-09-22 23:19:46 +02:00
2000-11-02 16:46:17 +01:00
// TileBank
2001-01-23 22:53:48 +01:00
CTileBank &GetTileBank() {return(TileBank);}
2001-02-09 22:17:01 +01:00
void UpdateTileView(BOOL Toggle=FALSE);
2000-11-28 15:34:42 +01:00
2000-11-24 23:34:20 +01:00
CTile &GetTile(int Bank,int TileNo) {return(TileBank.GetTile(Bank,TileNo));}
2000-11-15 22:22:40 +01:00
void TileBankLoad(char *Filename);
2000-11-29 18:07:57 +01:00
void TileBankDelete();
2000-11-15 22:22:40 +01:00
void TileBankReload();
void TileBankSet();
2001-02-09 22:17:01 +01:00
void MirrorX();
void MirrorY();
void ActiveBrushLeft();
void ActiveBrushRight();
2000-11-29 18:07:57 +01:00
BOOL IsTileValid(int Set,int Tile);
2001-02-09 22:17:01 +01:00
BOOL IsTileView() {return(TileViewFlag);}
void TileBankGUIInit() {TileBank.GUIInit(this);}
2001-02-14 23:35:47 +01:00
void TileBankGUIKill() {TileBank.GUIKill(this);}
2001-02-09 22:17:01 +01:00
void TileBankGUIUpdate() {TileBank.GUIUpdate(this);}
2000-11-29 18:07:57 +01:00
2001-02-09 22:17:01 +01:00
// GUI
2000-11-17 00:08:54 +01:00
void UpdateParamBar();
2001-02-09 22:17:01 +01:00
void GUIAdd(CDialog &Dlg,int ID,bool Visible=true,bool Lock=false);
void GUIRemove(CDialog &Dlg,int ID,bool Force=false);
void GUIRemoveAll(bool Force=false);
void GUIUpdate();
void GUIChanged();
2000-11-14 16:03:04 +01:00
2000-09-22 17:11:29 +02:00
// Layers
2001-02-14 23:35:47 +01:00
int AddLayer(int Type, int SubType, int Width, int Height);
int AddLayer(CLayer *Layer);
void SetLayer(int Layer,bool Force=false);
2001-01-21 19:04:00 +01:00
void AddLayer(int Layer);
void DeleteLayer(int Layer);
2001-02-09 22:17:01 +01:00
void UpdateLayerGUI();
2000-09-22 17:11:29 +02:00
2000-11-14 16:03:04 +01:00
// Grid
2001-02-09 22:17:01 +01:00
void UpdateGrid(BOOL Toggle=FALSE);
2000-11-14 16:03:04 +01:00
BOOL IsGridOn() {return(GridFlag);}
2000-10-27 22:21:39 +02:00
// Tex Cache
2000-11-06 21:24:11 +01:00
CTexCache &GetTexCache() {return(TexCache);}
2000-10-27 22:21:39 +02:00
2000-11-02 16:46:17 +01:00
// Misc
2001-02-09 22:17:01 +01:00
void UpdateAll();
void RedrawView();
void UpdateView(Vector3 *Ofs=NULL);
2000-09-22 17:11:29 +02:00
2000-12-04 17:47:34 +01:00
Vector3 &GetCam();
Vector3 OffsetCam(Vector3 &Cam,float DivVal);
2000-11-06 21:24:11 +01:00
void SetCursorPos(CPoint &Pos) {CursorPos=Pos;}
CPoint &GetCursorPos() {return(CursorPos);}
2000-11-14 16:03:04 +01:00
2001-02-09 22:17:01 +01:00
void SetMapSize(int Width,int Height);
2001-02-14 23:35:47 +01:00
int GetMapWidth() {return(ActionLayer->GetWidth());}
int GetMapHeight() {return(ActionLayer->GetHeight());}
2000-11-20 17:21:43 +01:00
2001-02-09 22:17:01 +01:00
void Toggle2d3d();
2000-11-28 22:16:00 +01:00
int FindLayer(int Type,int SubType=-1);
2001-02-14 23:35:47 +01:00
int SetActionLayer(CLayer *Lyr) {ActionLayer=Lyr;}
2000-12-29 23:20:38 +01:00
void SetScale();
Vector3 &GetScaleVector() {return(ScaleVector);}
float GetZoomW();
float GetZoomH();
2000-12-04 17:47:34 +01:00
2001-02-09 22:17:01 +01:00
void CopySelection();
void PasteSelection();
2000-12-29 23:20:38 +01:00
2000-09-22 17:11:29 +02:00
private:
2001-02-10 21:21:20 +01:00
CMapEditView *CurrentView;
2000-10-27 02:06:19 +02:00
CPoint CurrentMousePos,LastMousePos;
2000-11-03 23:40:41 +01:00
CPoint CursorPos,LastCursorPos;
2000-12-04 17:47:34 +01:00
Vector3 MapCam,TileCam;
Vector3 MapCamOfs,TileCamOfs;
2000-12-29 23:20:38 +01:00
Vector3 ScaleVector;
2000-10-27 02:06:19 +02:00
2000-11-20 21:33:42 +01:00
std::vector<CLayer*> Layer;
2001-02-14 23:35:47 +01:00
CLayer *ActionLayer;
2000-10-27 02:06:19 +02:00
int ActiveLayer;
2000-09-22 23:19:46 +02:00
2000-11-06 21:24:11 +01:00
CTileBank TileBank;
2000-10-27 20:18:30 +02:00
CTexCache TexCache;
2000-09-22 23:19:46 +02:00
2001-02-09 22:17:01 +01:00
CLayerListGUI LayerList;
2000-11-28 00:07:07 +01:00
2000-10-31 23:37:59 +01:00
BOOL TileViewFlag;
2000-11-14 16:03:04 +01:00
BOOL GridFlag;
BOOL Is3dFlag;
2000-11-15 22:22:40 +01:00
2000-09-22 17:11:29 +02:00
};
/*****************************************************************************/
#endif