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-03-01 18:28:20 +01:00
|
|
|
#include "MapEdit.h"
|
2001-02-09 22:17:01 +01:00
|
|
|
#include "LayerList.h"
|
|
|
|
#include "LayerTileGUI.h"
|
|
|
|
|
2001-03-01 18:28:20 +01:00
|
|
|
#include "Layer.h"
|
|
|
|
#include "LayerTile.h"
|
|
|
|
|
2001-03-05 21:49:46 +01:00
|
|
|
const s32 FileVersion=4;
|
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
|
|
|
|
2001-03-05 21:49:46 +01:00
|
|
|
const Vector3 DefaultCamPos(0.0f,0.0f,0.9f);
|
|
|
|
|
2000-09-22 17:11:29 +02:00
|
|
|
/*****************************************************************************/
|
2000-09-22 23:19:46 +02:00
|
|
|
class CMapEditView;
|
2001-03-01 18:28:20 +01:00
|
|
|
|
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();
|
2001-03-01 18:28:20 +01:00
|
|
|
bool New();
|
2000-11-20 21:33:42 +01:00
|
|
|
void Load(CFile *File);
|
|
|
|
void Save(CFile *File);
|
2001-03-01 18:28:20 +01:00
|
|
|
bool Question(char *Txt);
|
|
|
|
void Render(bool ForceRender=FALSE);
|
2001-02-14 23:35:47 +01:00
|
|
|
void RenderLayers();
|
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-03-01 18:28:20 +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);
|
2001-02-14 23:35:47 +01:00
|
|
|
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);
|
2001-03-01 18:28:20 +01:00
|
|
|
void Command(int CmdMsg,int Param0=0,int Param1=0);
|
2000-09-22 23:19:46 +02:00
|
|
|
|
2001-03-01 18:28:20 +01:00
|
|
|
// Subview & TileBank
|
|
|
|
CTileBank *GetTileBank() {return(ActionLayer->GetTileBank());}
|
|
|
|
void ToggleSubView();
|
2001-03-05 21:49:46 +01:00
|
|
|
// CLayer *FindSubView(int Type);
|
|
|
|
bool IsSubView() {return(CurrentLayer!=Layer[ActiveLayer]);}
|
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();
|
2001-03-01 18:28:20 +01:00
|
|
|
int GetLayerCount() {return(Layer.size());}
|
|
|
|
CLayer *GetLayer(int i) {return(Layer[i]);}
|
2000-09-22 17:11:29 +02:00
|
|
|
|
2000-11-14 16:03:04 +01:00
|
|
|
// Grid
|
2001-03-01 18:28:20 +01:00
|
|
|
void ToggleGrid();
|
|
|
|
bool IsGridOn() {return(GridFlag);}
|
2000-11-14 16:03:04 +01:00
|
|
|
|
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-03-01 18:28:20 +01:00
|
|
|
int SetActionLayer(CLayerTile *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
|
|
|
|
2001-02-16 19:23:01 +01:00
|
|
|
void ResetView();
|
|
|
|
|
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;
|
2001-03-05 21:49:46 +01:00
|
|
|
Vector3 MapCam;
|
2000-12-04 17:47:34 +01:00
|
|
|
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-03-01 18:28:20 +01:00
|
|
|
CLayer *CurrentLayer;
|
|
|
|
CLayerTile *ActionLayer;
|
2000-10-27 02:06:19 +02:00
|
|
|
int ActiveLayer;
|
2000-09-22 23:19:46 +02:00
|
|
|
|
2001-03-01 18:28:20 +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
|
|
|
|
2001-03-01 18:28:20 +01:00
|
|
|
bool SpareFlag;
|
|
|
|
bool GridFlag;
|
|
|
|
bool Is3dFlag;
|
2000-11-15 22:22:40 +01:00
|
|
|
|
2000-09-22 17:11:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
#endif
|