This commit is contained in:
parent
e2dba7722f
commit
72651463f8
@ -15,10 +15,12 @@
|
|||||||
#include "MainFrm.h"
|
#include "MainFrm.h"
|
||||||
|
|
||||||
#include "NewMapGUI.h"
|
#include "NewMapGUI.h"
|
||||||
|
#include "AddLayerDlg.h"
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "LayerTile.h"
|
#include "LayerTile.h"
|
||||||
|
#include "LayerCollision.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include "ExportAGB.h"
|
#include "ExportAGB.h"
|
||||||
@ -30,7 +32,15 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CCore::CCore()
|
CCore::CCore()
|
||||||
{
|
{
|
||||||
|
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
|
CMultiBar *ParamBar=Frm->GetParamBar();
|
||||||
|
|
||||||
CurrentMousePos=CPoint(0,0);
|
CurrentMousePos=CPoint(0,0);
|
||||||
|
|
||||||
|
// Add default param bar items
|
||||||
|
ParamBar->RemoveAll();
|
||||||
|
ParamBar->Add(Frm->GetLayerList(),IDD_LAYER_LIST_DIALOG,TRUE,TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -43,14 +53,8 @@ int ListSize=Layer.size();
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::Init()
|
void CCore::Init()
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
|
||||||
CMultiBar *ParamBar=Frm->GetParamBar();
|
|
||||||
|
|
||||||
ParamBar->RemoveAll();
|
|
||||||
// Add default param bar items
|
|
||||||
ParamBar->Add(Frm->GetLayerList(),IDD_LAYER_LIST_DIALOG,TRUE,TRUE);
|
|
||||||
UpdateParamBar();
|
UpdateParamBar();
|
||||||
UpdateAll(NULL);
|
// UpdateAll(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -61,10 +65,6 @@ int Width,Height;
|
|||||||
Dlg.m_Width=TileLayerMinWidth;
|
Dlg.m_Width=TileLayerMinWidth;
|
||||||
Dlg.m_Height=TileLayerMinHeight;
|
Dlg.m_Height=TileLayerMinHeight;
|
||||||
|
|
||||||
Dlg.m_Back=TRUE;
|
|
||||||
Dlg.m_Mid=TRUE;
|
|
||||||
Dlg.m_Fore=FALSE;
|
|
||||||
|
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
if (Dlg.DoModal()!=IDOK) return FALSE;
|
if (Dlg.DoModal()!=IDOK) return FALSE;
|
||||||
#endif
|
#endif
|
||||||
@ -72,11 +72,12 @@ int Width,Height;
|
|||||||
Height=Dlg.m_Height;
|
Height=Dlg.m_Height;
|
||||||
|
|
||||||
// Create Tile Layers
|
// Create Tile Layers
|
||||||
// Type Width Height Scale 3d? Resizable?
|
// Type Width Height Scale 3d? Resizable?
|
||||||
if (Dlg.m_Back) Layer.push_back(new CLayerTile( LAYERTILE_BACK, 32, 32, 4.0f, FALSE, FALSE));
|
// AddLayer(LAYER_TYPE_TILE,LAYERTILE_BACK,32,32);
|
||||||
if (Dlg.m_Mid) Layer.push_back(new CLayerTile( LAYERTILE_MID, Width, Height, 2.0f, FALSE, TRUE));
|
// AddLayer(LAYER_TYPE_TILE,LAYERTILE_MID, Width, Height);
|
||||||
Layer.push_back(new CLayerTile( LAYERTILE_ACTION, Width, Height, 1.0f, TRUE, TRUE));
|
AddLayer(LAYER_TYPE_TILE,LAYERTILE_ACTION, Width, Height);
|
||||||
if (Dlg.m_Fore) Layer.push_back(new CLayerTile( LAYERTILE_FORE, Width, Height, 0.5f, FALSE, TRUE));
|
// AddLayer(LAYER_TYPE_COLLISION,-1, Width, Height);
|
||||||
|
// AddLayer(LAYER_TYPE_TILE,LAYERTILE_FORE, Width, Height);
|
||||||
|
|
||||||
ActiveLayer=FindActionLayer();
|
ActiveLayer=FindActionLayer();
|
||||||
MapCam.Zero();
|
MapCam.Zero();
|
||||||
@ -89,30 +90,31 @@ int Width,Height;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void CCore::Load(CFile *File)
|
void CCore::Load(CFile *File)
|
||||||
{
|
{
|
||||||
float Version;
|
int Version;
|
||||||
|
|
||||||
File->Read(&Version,sizeof(float));
|
File->Read(&Version,sizeof(int));
|
||||||
TRACE1("Load Version %g\n",Version);
|
if (Version>100000) Version=1; // Check fix for changing version to int from float
|
||||||
|
|
||||||
if (Version>=1.0)
|
if (Version<FileVersion)
|
||||||
{
|
|
||||||
File->Read(&MapCam,sizeof(Vector3));
|
|
||||||
File->Read(&MapCamOfs,sizeof(Vector3));
|
|
||||||
File->Read(&TileCam,sizeof(Vector3));
|
|
||||||
File->Read(&TileCamOfs,sizeof(Vector3));
|
|
||||||
|
|
||||||
File->Read(&TileViewFlag,sizeof(BOOL));
|
|
||||||
File->Read(&GridFlag,sizeof(BOOL));
|
|
||||||
File->Read(&Is3dFlag,sizeof(BOOL));
|
|
||||||
}
|
|
||||||
if (Version>=1.1)
|
|
||||||
{
|
{
|
||||||
|
CString mexstr;
|
||||||
|
mexstr.Format("Old File Format\n\nPlease re-save\n");
|
||||||
|
AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACE1("Load Version %i\n",Version);
|
||||||
|
|
||||||
|
File->Read(&MapCam,sizeof(Vector3));
|
||||||
|
File->Read(&MapCamOfs,sizeof(Vector3));
|
||||||
|
File->Read(&TileCam,sizeof(Vector3));
|
||||||
|
File->Read(&TileCamOfs,sizeof(Vector3));
|
||||||
|
|
||||||
|
File->Read(&TileViewFlag,sizeof(BOOL));
|
||||||
|
File->Read(&GridFlag,sizeof(BOOL));
|
||||||
|
File->Read(&Is3dFlag,sizeof(BOOL));
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
int LayerCount;
|
int LayerCount;
|
||||||
@ -127,7 +129,10 @@ int LayerCount;
|
|||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case LAYER_TYPE_TILE:
|
case LAYER_TYPE_TILE:
|
||||||
Layer.push_back(new CLayerTile(File,Version));
|
AddLayer(new CLayerTile(File,Version));
|
||||||
|
break;
|
||||||
|
case LAYER_TYPE_COLLISION:
|
||||||
|
AddLayer(new CLayerCollision(File,Version));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -144,14 +149,14 @@ int MapHeight=Layer[FindActionLayer()]->GetHeight();
|
|||||||
}
|
}
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
// MapCam.Zero();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::Save(CFile *File)
|
void CCore::Save(CFile *File)
|
||||||
{
|
{
|
||||||
// Version 1
|
// Version 1
|
||||||
File->Write(&FileVersion,sizeof(float));
|
File->Write(&FileVersion,sizeof(int));
|
||||||
|
|
||||||
File->Write(&MapCam,sizeof(Vector3));
|
File->Write(&MapCam,sizeof(Vector3));
|
||||||
File->Write(&MapCamOfs,sizeof(Vector3));
|
File->Write(&MapCamOfs,sizeof(Vector3));
|
||||||
@ -230,11 +235,8 @@ void CCore::RenderTileView(CMapEditView *View)
|
|||||||
{
|
{
|
||||||
Vector3 &ThisCam=GetCam();
|
Vector3 &ThisCam=GetCam();
|
||||||
|
|
||||||
TileBank.RenderSet(this,ThisCam,Is3dFlag);
|
GetTileBank().RenderSet(this,ThisCam,Is3dFlag);
|
||||||
|
GetTileBank().FindCursorPos(this,View,GetCam(),CurrentMousePos);
|
||||||
|
|
||||||
// Get Cursor Pos
|
|
||||||
TileBank.FindCursorPos(this,View,GetCam(),CurrentMousePos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -243,9 +245,7 @@ Vector3 &ThisCam=GetCam();
|
|||||||
void CCore::SetMode(int NewMode)
|
void CCore::SetMode(int NewMode)
|
||||||
{
|
{
|
||||||
BOOL RedrawFlag=FALSE;
|
BOOL RedrawFlag=FALSE;
|
||||||
|
|
||||||
RedrawFlag=Layer[ActiveLayer]->SetMode(NewMode);
|
RedrawFlag=Layer[ActiveLayer]->SetMode(NewMode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -256,9 +256,9 @@ BOOL RedrawFlag=FALSE;
|
|||||||
if (TileViewFlag)
|
if (TileViewFlag)
|
||||||
{
|
{
|
||||||
if (nFlags & MK_RBUTTON)
|
if (nFlags & MK_RBUTTON)
|
||||||
RedrawFlag=TileBank.SelectCancel();
|
RedrawFlag=GetTileBank().SelectCancel();
|
||||||
else
|
else
|
||||||
RedrawFlag=TileBank.SelectL(DownFlag);
|
RedrawFlag=GetTileBank().SelectL(DownFlag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -267,7 +267,7 @@ BOOL RedrawFlag=FALSE;
|
|||||||
RedrawFlag=Layer[ActiveLayer]->LButtonControl(this,View,nFlags,CursorPos,DownFlag);
|
RedrawFlag=Layer[ActiveLayer]->LButtonControl(this,View,nFlags,CursorPos,DownFlag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TileBank.SetActiveBrushL();
|
GetTileBank().SetActiveBrushL();
|
||||||
|
|
||||||
if (RedrawFlag) View->Invalidate();
|
if (RedrawFlag) View->Invalidate();
|
||||||
}
|
}
|
||||||
@ -285,9 +285,9 @@ BOOL RedrawFlag=FALSE;
|
|||||||
if (TileViewFlag)
|
if (TileViewFlag)
|
||||||
{
|
{
|
||||||
if (nFlags & MK_LBUTTON)
|
if (nFlags & MK_LBUTTON)
|
||||||
RedrawFlag=TileBank.SelectCancel();
|
RedrawFlag=GetTileBank().SelectCancel();
|
||||||
else
|
else
|
||||||
RedrawFlag=TileBank.SelectR(DownFlag);
|
RedrawFlag=GetTileBank().SelectR(DownFlag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -296,7 +296,7 @@ BOOL RedrawFlag=FALSE;
|
|||||||
RedrawFlag=Layer[ActiveLayer]->RButtonControl(this,View,nFlags,CursorPos,DownFlag);
|
RedrawFlag=Layer[ActiveLayer]->RButtonControl(this,View,nFlags,CursorPos,DownFlag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TileBank.SetActiveBrushR();
|
GetTileBank().SetActiveBrushR();
|
||||||
|
|
||||||
if (RedrawFlag) View->Invalidate();
|
if (RedrawFlag) View->Invalidate();
|
||||||
}
|
}
|
||||||
@ -429,19 +429,87 @@ CLayerList *List=(CLayerList*)Frm->GetDialog(IDD_LAYER_LIST_DIALOG);
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
bool IsCol=Layer[NewLayer]->GetType()==LAYER_TYPE_COLLISION;
|
||||||
|
TileBank.SetCollision(IsCol);
|
||||||
ActiveLayer=NewLayer;
|
ActiveLayer=NewLayer;
|
||||||
|
UpdateParamBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
CLayer *CCore::AddLayer(CLayer *NewLayer)
|
||||||
|
{
|
||||||
|
int ListSize=Layer.size();
|
||||||
|
int NewIdx=CLayer::GetLayerIdx(NewLayer->GetType(),NewLayer->GetSubType());
|
||||||
|
int Idx=ListSize;
|
||||||
|
|
||||||
|
TRACE3("Add Layer %i %i @ %i\n",NewLayer->GetType(),NewLayer->GetSubType(),NewIdx);
|
||||||
|
|
||||||
|
for (Idx=0; Idx<ListSize; Idx++)
|
||||||
|
{
|
||||||
|
int ListIdx=CLayer::GetLayerIdx(Layer[Idx]->GetType(),Layer[Idx]->GetSubType());
|
||||||
|
if (NewIdx<ListIdx) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Layer.insert(Layer.begin() + Idx,NewLayer);
|
||||||
|
|
||||||
|
return(NewLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CCore::AddLayer(int Type, int SubType, int Width, int Height)
|
||||||
|
{
|
||||||
|
CLayer *Layer;
|
||||||
|
switch (Type)
|
||||||
|
{
|
||||||
|
case LAYER_TYPE_TILE:
|
||||||
|
Layer=AddLayer(new CLayerTile(SubType, Width,Height));
|
||||||
|
break;
|
||||||
|
case LAYER_TYPE_COLLISION:
|
||||||
|
Layer=AddLayer(new CLayerCollision(SubType, Width,Height));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(!"AddLayer - Invalid Layer Type");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::AddLayer(int CurrentLayer)
|
void CCore::AddLayer(int CurrentLayer)
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
std::vector<int> List;
|
||||||
CMultiBar *ParamBar=Frm->GetParamBar();
|
CAddLayerDlg Dlg;
|
||||||
CLayerList *List=(CLayerList*)Frm->GetDialog(IDD_LAYER_LIST_DIALOG);
|
int NewLayerId=0;
|
||||||
|
int Sel;
|
||||||
|
|
||||||
|
|
||||||
|
// Build Unused List
|
||||||
|
Dlg.Sel=&Sel;
|
||||||
|
Sel=0;
|
||||||
|
for (int i=0; i<CLayer::InfoTableSize; i++)
|
||||||
|
{
|
||||||
|
if (FindLayer(CLayer::InfoTable[i].Type,CLayer::InfoTable[i].SubType)==-1)
|
||||||
|
{
|
||||||
|
List.push_back(i);
|
||||||
|
Dlg.StrList.push_back(CLayer::InfoTable[i].Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Dlg.DoModal()!=IDOK) return;
|
||||||
|
|
||||||
|
NewLayerId=List[Sel];
|
||||||
|
|
||||||
|
TRACE2("Add Layer %i %s\n",NewLayerId,CLayer::InfoTable[NewLayerId].Name);
|
||||||
|
|
||||||
|
int Width=Layer[FindActionLayer()]->GetWidth();
|
||||||
|
int Height=Layer[FindActionLayer()]->GetHeight();
|
||||||
|
|
||||||
|
AddLayer(CLayer::InfoTable[NewLayerId].Type,CLayer::InfoTable[NewLayerId].SubType,Width,Height);
|
||||||
|
|
||||||
TRACE1("Add Layer %i\n",CurrentLayer);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,12 +535,12 @@ void CCore::DeleteLayer(int CurrentLayer)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::UpdateGrid(CMapEditView *View,BOOL Toggle)
|
void CCore::UpdateGrid(CMapEditView *View,BOOL Toggle)
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
//CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
CToolBar *ToolBar=Frm->GetToolBar();
|
//CToolBar *ToolBar=Frm->GetToolBar();
|
||||||
|
|
||||||
if (Toggle) GridFlag=!GridFlag;
|
if (Toggle) GridFlag=!GridFlag;
|
||||||
|
|
||||||
ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_GRID,GridFlag);
|
// ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_GRID,GridFlag);
|
||||||
UpdateView(View);
|
UpdateView(View);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,14 +635,14 @@ void CCore::MirrorY(CMapEditView *View)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::ActiveBrushLeft(CMapEditView *View)
|
void CCore::ActiveBrushLeft(CMapEditView *View)
|
||||||
{
|
{
|
||||||
TileBank.SetActiveBrushL();
|
GetTileBank().SetActiveBrushL();
|
||||||
UpdateView(View);
|
UpdateView(View);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::ActiveBrushRight(CMapEditView *View)
|
void CCore::ActiveBrushRight(CMapEditView *View)
|
||||||
{
|
{
|
||||||
TileBank.SetActiveBrushR();
|
GetTileBank().SetActiveBrushR();
|
||||||
UpdateView(View);
|
UpdateView(View);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,7 +744,7 @@ Vector3 &ThisCam=GetCam();
|
|||||||
if (ThisCam.y<0) ThisCam.y=0;
|
if (ThisCam.y<0) ThisCam.y=0;
|
||||||
}
|
}
|
||||||
if (ThisCam.z<0.1) ThisCam.z=0.1f;
|
if (ThisCam.z<0.1) ThisCam.z=0.1f;
|
||||||
TRACE1("ZoomVal %f\n",ThisCam.z);
|
// TRACE1("ZoomVal %f\n",ThisCam.z);
|
||||||
|
|
||||||
UpdateView(View);
|
UpdateView(View);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "TexCache.h"
|
#include "TexCache.h"
|
||||||
#include "TileSet.h"
|
#include "TileSet.h"
|
||||||
|
|
||||||
const float FileVersion=1.01f;
|
const s32 FileVersion=2;
|
||||||
|
|
||||||
#define SCREEN_MAP_WIDTH 30
|
#define SCREEN_MAP_WIDTH 30
|
||||||
#define SCREEN_MAP_HEIGHT 20
|
#define SCREEN_MAP_HEIGHT 20
|
||||||
@ -47,11 +47,11 @@ public:
|
|||||||
void Zoom(CMapEditView *View,float Dst);
|
void Zoom(CMapEditView *View,float Dst);
|
||||||
|
|
||||||
// TileBank
|
// TileBank
|
||||||
|
CTileBank &GetTileBank() {return(TileBank);}
|
||||||
void UpdateTileView(CMapEditView *View,BOOL Toggle=FALSE);
|
void UpdateTileView(CMapEditView *View,BOOL Toggle=FALSE);
|
||||||
|
|
||||||
void UpdateTileViewGUI() {TileBank.UpdateGUI(this,TileViewFlag);}
|
void UpdateTileViewGUI() {TileBank.UpdateGUI(this,TileViewFlag);}
|
||||||
|
|
||||||
CTileBank &GetTileBank() {return(TileBank);}
|
|
||||||
CTile &GetTile(int Bank,int TileNo) {return(TileBank.GetTile(Bank,TileNo));}
|
CTile &GetTile(int Bank,int TileNo) {return(TileBank.GetTile(Bank,TileNo));}
|
||||||
void TileBankLoad(char *Filename);
|
void TileBankLoad(char *Filename);
|
||||||
void TileBankDelete();
|
void TileBankDelete();
|
||||||
@ -63,11 +63,12 @@ public:
|
|||||||
void ActiveBrushRight(CMapEditView *View);
|
void ActiveBrushRight(CMapEditView *View);
|
||||||
BOOL IsTileValid(int Set,int Tile);
|
BOOL IsTileValid(int Set,int Tile);
|
||||||
|
|
||||||
|
|
||||||
// Param Bar
|
// Param Bar
|
||||||
void UpdateParamBar();
|
void UpdateParamBar();
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
|
void AddLayer(int Type, int SubType, int Width, int Height);
|
||||||
|
CLayer *AddLayer(CLayer *Layer);
|
||||||
void SetLayer(int Layer);
|
void SetLayer(int Layer);
|
||||||
void AddLayer(int Layer);
|
void AddLayer(int Layer);
|
||||||
void DeleteLayer(int Layer);
|
void DeleteLayer(int Layer);
|
||||||
|
@ -8,11 +8,51 @@
|
|||||||
#include <gl\gl.h>
|
#include <gl\gl.h>
|
||||||
#include <gl\glu.h>
|
#include <gl\glu.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
|
#include "LayerDef.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
sLayerInfoTable CLayer::InfoTable[]=
|
||||||
|
{
|
||||||
|
//Type SubType Name delete?Scale 3d Resizable
|
||||||
|
{LAYER_TYPE_TILE, LAYERTILE_BACK, "Back", true, 4.0f, false, false},
|
||||||
|
{LAYER_TYPE_TILE, LAYERTILE_MID, "Mid", true, 2.0f, false, true},
|
||||||
|
{LAYER_TYPE_TILE, LAYERTILE_ACTION, "Action", false, 1.0f, true, true},
|
||||||
|
{LAYER_TYPE_TILE, LAYERTILE_FORE, "Fore", true, 0.5f, false, true},
|
||||||
|
{LAYER_TYPE_COLLISION, LAYER_SUBTYPE_NONE, "Collision", true, 1.0f, false, true},
|
||||||
|
};
|
||||||
|
|
||||||
|
int CLayer::InfoTableSize=sizeof(InfoTable)/sizeof(sLayerInfoTable);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayer::SetDefaultParams()
|
||||||
|
{
|
||||||
|
int Idx=CLayer::GetLayerIdx(GetType(),GetSubType());
|
||||||
|
|
||||||
|
ScaleFactor=InfoTable[Idx].ScaleFactor;
|
||||||
|
ResizeFlag=InfoTable[Idx].ResizeFlag;
|
||||||
|
Render3dFlag=InfoTable[Idx].Render3dFlag;
|
||||||
|
VisibleFlag=TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
int CLayer::GetLayerIdx(int Type,int SubType)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int i=0; i<InfoTableSize; i++)
|
||||||
|
{
|
||||||
|
if (InfoTable[i].Type==Type && InfoTable[i].SubType==SubType)
|
||||||
|
{
|
||||||
|
return(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -11,18 +11,26 @@
|
|||||||
#include "Select.h"
|
#include "Select.h"
|
||||||
#include "LayerDef.h"
|
#include "LayerDef.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
struct sLayerInfoTable
|
||||||
|
{
|
||||||
|
LAYER_TYPE Type;
|
||||||
|
LAYER_SUBTYPE SubType;
|
||||||
|
char *Name;
|
||||||
|
|
||||||
|
bool DeleteFlag;
|
||||||
|
float ScaleFactor;
|
||||||
|
bool Render3dFlag;
|
||||||
|
bool ResizeFlag;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
enum LAYER_ENUMS
|
enum LAYER_ENUMS
|
||||||
{
|
{
|
||||||
SELECT_BUFFER_SIZE=16,
|
SELECT_BUFFER_SIZE=16,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
SCREEN_WIDTH_TILE=30,
|
|
||||||
SCREEN_HEIGHT_TILE=20,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CCore;
|
class CCore;
|
||||||
class CMapEditView;
|
class CMapEditView;
|
||||||
@ -33,13 +41,22 @@ public:
|
|||||||
CLayer(){};
|
CLayer(){};
|
||||||
virtual ~CLayer(){};
|
virtual ~CLayer(){};
|
||||||
|
|
||||||
virtual char *GetName()=0;
|
static sLayerInfoTable InfoTable[];
|
||||||
|
static int InfoTableSize;
|
||||||
|
|
||||||
|
static int GetLayerIdx(int Type,int SubType);
|
||||||
|
|
||||||
|
void SetDefaultParams();
|
||||||
|
|
||||||
|
char *GetName() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].Name);}
|
||||||
|
bool CanDelete() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].DeleteFlag);}
|
||||||
|
|
||||||
virtual void SetVisible(BOOL f) {VisibleFlag=f;}
|
virtual void SetVisible(BOOL f) {VisibleFlag=f;}
|
||||||
virtual BOOL IsVisible() {return(VisibleFlag);}
|
virtual BOOL IsVisible() {return(VisibleFlag);}
|
||||||
virtual int GetType()=0;
|
virtual int GetType()=0;
|
||||||
virtual int GetSubType() {return(-1);}
|
virtual int GetSubType() {return(LAYER_SUBTYPE_NONE);}
|
||||||
|
float GetScaleFactor() {return(ScaleFactor);}
|
||||||
|
|
||||||
virtual float GetScaleFactor() {return(ScaleFactor);}
|
|
||||||
|
|
||||||
virtual void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d)=0;
|
virtual void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d)=0;
|
||||||
virtual void RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active)=0;
|
virtual void RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active)=0;
|
||||||
@ -57,12 +74,11 @@ virtual int GetHeight()=0;
|
|||||||
virtual void CheckLayerSize(int Width,int Height){};
|
virtual void CheckLayerSize(int Width,int Height){};
|
||||||
virtual BOOL Resize(int Width,int Height)=0;
|
virtual BOOL Resize(int Width,int Height)=0;
|
||||||
|
|
||||||
virtual void Load(CFile *File,float Version)=0;
|
virtual void Load(CFile *File,int Version)=0;
|
||||||
virtual void Save(CFile *File)=0;
|
virtual void Save(CFile *File)=0;
|
||||||
|
|
||||||
virtual void Export(CCore *Core,CExport &Exp)=0;
|
virtual void Export(CCore *Core,CExport &Exp)=0;
|
||||||
|
|
||||||
virtual bool CanDelete()=0;
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
virtual BOOL SetMode(int NewMode)=0;
|
virtual BOOL SetMode(int NewMode)=0;
|
||||||
@ -83,9 +99,10 @@ virtual void DeleteSet(int Set){};
|
|||||||
virtual void RemapSet(int OrigSet,int NewSet){};
|
virtual void RemapSet(int OrigSet,int NewSet){};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BOOL Render3dFlag;
|
|
||||||
float ScaleFactor;
|
float ScaleFactor;
|
||||||
BOOL ResizeFlag;
|
bool Render3dFlag;
|
||||||
|
bool ResizeFlag;
|
||||||
|
|
||||||
BOOL VisibleFlag;
|
BOOL VisibleFlag;
|
||||||
CSelect Selection;
|
CSelect Selection;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
/*** Layer Tile ***/
|
/*** Layer Tile ***/
|
||||||
/******************/
|
/******************/
|
||||||
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Vector3.h>
|
#include <Vector3.h>
|
||||||
#include <gl\gl.h>
|
#include <gl\gl.h>
|
||||||
@ -17,6 +16,7 @@
|
|||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "LayerTile.h"
|
#include "LayerTile.h"
|
||||||
|
#include "LayerCollision.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "Select.h"
|
#include "Select.h"
|
||||||
#include "Export.h"
|
#include "Export.h"
|
||||||
@ -25,57 +25,40 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// New Layer
|
// New Layer
|
||||||
CLayerTile::CLayerTile(int _SubType,int Width,int Height)
|
CLayerCollision::CLayerCollision(int _SubType,int Width,int Height)
|
||||||
{
|
{
|
||||||
SubType=_SubType;
|
SubType=LAYER_SUBTYPE_NONE;
|
||||||
if (SubType==LAYERTILE_BACK) // Back is fixed size
|
|
||||||
{
|
|
||||||
Width=32;
|
|
||||||
Height=32;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetDefaultParams();
|
SetDefaultParams();
|
||||||
|
|
||||||
Mode=MouseModePaint;
|
Mode=MouseModePaint;
|
||||||
|
|
||||||
if (ResizeFlag)
|
|
||||||
{
|
|
||||||
Width=TileLayerMinWidth+(Width-TileLayerMinWidth)/ScaleFactor;
|
|
||||||
Height=TileLayerMinHeight+(Height-TileLayerMinHeight)/ScaleFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Width<TileLayerMinWidth) Width=TileLayerMinWidth;
|
|
||||||
if (Height<TileLayerMinHeight) Height=TileLayerMinHeight;
|
|
||||||
|
|
||||||
Map.SetSize(Width,Height,TRUE);
|
Map.SetSize(Width,Height,TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Load Layer
|
// Load Layer
|
||||||
CLayerTile::CLayerTile(CFile *File,int Version)
|
CLayerCollision::CLayerCollision(CFile *File,int Version)
|
||||||
{
|
{
|
||||||
Load(File,Version);
|
Load(File,Version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CLayerTile::~CLayerTile()
|
CLayerCollision::~CLayerCollision()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::Load(CFile *File,float Version)
|
void CLayerCollision::Load(CFile *File,int Version)
|
||||||
{
|
{
|
||||||
// Version 1
|
// Version 2
|
||||||
if (Version>=1.0)
|
File->Read(&Render3dFlag,sizeof(BOOL));
|
||||||
{
|
File->Read(&ScaleFactor,sizeof(float));
|
||||||
File->Read(&Render3dFlag,sizeof(BOOL));
|
File->Read(&ResizeFlag,sizeof(BOOL));
|
||||||
File->Read(&ScaleFactor,sizeof(float));
|
File->Read(&VisibleFlag,sizeof(BOOL));
|
||||||
File->Read(&ResizeFlag,sizeof(BOOL));
|
File->Read(&Mode,sizeof(MouseMode));
|
||||||
File->Read(&VisibleFlag,sizeof(BOOL));
|
File->Read(&SubType,sizeof(int));
|
||||||
File->Read(&Mode,sizeof(MouseMode));
|
Map.Load(File,Version);
|
||||||
File->Read(&SubType,sizeof(int));
|
|
||||||
Map.Load(File,Version);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE1("%s\t",GetName());
|
TRACE1("%s\t",GetName());
|
||||||
TRACE1("Scl:%g\t",ScaleFactor);
|
TRACE1("Scl:%g\t",ScaleFactor);
|
||||||
@ -83,7 +66,7 @@ void CLayerTile::Load(CFile *File,float Version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::Save(CFile *File)
|
void CLayerCollision::Save(CFile *File)
|
||||||
{
|
{
|
||||||
// Always Save current version
|
// Always Save current version
|
||||||
|
|
||||||
@ -96,584 +79,39 @@ void CLayerTile::Save(CFile *File)
|
|||||||
Map.Save(File);
|
Map.Save(File);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::CheckLayerSize(int Width,int Height)
|
|
||||||
{
|
|
||||||
if (Resize(Width,Height))
|
|
||||||
{
|
|
||||||
CString mexstr;
|
|
||||||
mexstr.Format("%s Layer Resized to Correct Size\nPlease re-save\n", GetName());
|
|
||||||
AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::Resize(int Width,int Height)
|
|
||||||
{
|
|
||||||
if (!ResizeFlag) return(FALSE); // Its a fixed size, so DONT DO IT!
|
|
||||||
|
|
||||||
int ThisWidth=Map.GetWidth();
|
|
||||||
int ThisHeight=Map.GetHeight();
|
|
||||||
Width=TileLayerMinWidth+(Width-TileLayerMinWidth)/ScaleFactor;
|
|
||||||
Height=TileLayerMinHeight+(Height-TileLayerMinHeight)/ScaleFactor;
|
|
||||||
|
|
||||||
if (ThisWidth!=Width || ThisHeight!=Height)
|
|
||||||
{
|
|
||||||
Map.Resize(Width,Height);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::Render(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
|
||||||
{
|
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
|
||||||
|
|
||||||
if (Is3d && Render3dFlag)
|
|
||||||
{
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
Render(Core,ThisCam,Map,TRUE);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Render(Core,ThisCam,Map,FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
|
||||||
{
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
|
||||||
CPoint &CursPos=Core->GetCursorPos();
|
|
||||||
CMap &Brush=TileBank.GetActiveBrush();
|
|
||||||
Vector3 Ofs;
|
|
||||||
|
|
||||||
if (!Brush.IsValid()) return;
|
|
||||||
|
|
||||||
if (CursPos.x<0 || CursPos.y<0) return;
|
|
||||||
|
|
||||||
Ofs.x=-(CursPos.x-(int)ThisCam.x);
|
|
||||||
Ofs.y=-(CursPos.y-(int)ThisCam.y);
|
|
||||||
ThisCam.x-=(int)ThisCam.x;
|
|
||||||
ThisCam.y-=(int)ThisCam.y;
|
|
||||||
TRACE2("-> %f %f\n",Ofs.x,Ofs.y);
|
|
||||||
|
|
||||||
|
|
||||||
if (Is3d && Render3dFlag)
|
|
||||||
{
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
Render(Core,ThisCam,Brush,TRUE,0.5,&Ofs);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Render(Core,ThisCam,Brush,FALSE,0.5,&Ofs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::Render(CCore *Core,Vector3 &ThisCam,CMap &ThisMap,BOOL Render3d,float Alpha,Vector3 *Ofs)
|
|
||||||
{
|
|
||||||
int MapWidth=ThisMap.GetWidth();
|
|
||||||
int MapHeight=ThisMap.GetHeight();
|
|
||||||
float ZoomW=Core->GetZoomW();
|
|
||||||
float ZoomH=Core->GetZoomH();
|
|
||||||
float ScrOfsX=(ZoomW/2);
|
|
||||||
float ScrOfsY=(ZoomH/2);
|
|
||||||
Vector3 &Scale=Core->GetScaleVector();
|
|
||||||
|
|
||||||
int StartX=(int)ThisCam.x;
|
|
||||||
int StartY=(int)ThisCam.y;
|
|
||||||
float ShiftX=ThisCam.x - (int)ThisCam.x;
|
|
||||||
float ShiftY=ThisCam.y - (int)ThisCam.y;
|
|
||||||
|
|
||||||
if (StartX<0) StartX=0;
|
|
||||||
if (StartY<0) StartY=0;
|
|
||||||
|
|
||||||
int DrawW=ZoomW+8;
|
|
||||||
int DrawH=ZoomH+8;
|
|
||||||
|
|
||||||
if (StartX+DrawW>MapWidth) DrawW=MapWidth-StartX;
|
|
||||||
if (StartY+DrawH>MapHeight) DrawH=MapHeight-StartY;
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
glScalef(Scale.x,Scale.y,Scale.z);
|
|
||||||
glTranslatef(-ShiftX,ShiftY,0); // Set scroll offset
|
|
||||||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
|
||||||
|
|
||||||
|
|
||||||
if (Ofs)
|
|
||||||
{
|
|
||||||
glTranslatef(-Ofs->x,Ofs->y,0); // Set scroll offset
|
|
||||||
}
|
|
||||||
|
|
||||||
glColor4f(1,1,1,Alpha);
|
|
||||||
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
|
||||||
{
|
|
||||||
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
|
||||||
{
|
|
||||||
sMapElem &ThisElem=ThisMap.Get(StartX+XLoop,StartY+YLoop);
|
|
||||||
if (ThisElem.Tile && Core->IsTileValid(ThisElem.Set,ThisElem.Tile))
|
|
||||||
{ // Render Non Zero Tiles
|
|
||||||
CTile &ThisTile=Core->GetTile(ThisElem.Set,ThisElem.Tile);
|
|
||||||
|
|
||||||
ThisTile.Render(ThisElem.Flags,Render3d);
|
|
||||||
}
|
|
||||||
glTranslatef(1.0f,0,0); // Next X
|
|
||||||
}
|
|
||||||
glTranslatef(-DrawW,-1,0); // Next y, rewind to start X
|
|
||||||
}
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::RenderSelection(CCore *Core,Vector3 &CamPos)
|
|
||||||
{
|
|
||||||
CRect Rect=Selection.GetRect();
|
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
|
||||||
float ZoomW=Core->GetZoomW();
|
|
||||||
float ZoomH=Core->GetZoomH();
|
|
||||||
float ScrOfsX=(ZoomW/2);
|
|
||||||
float ScrOfsY=(ZoomH/2);
|
|
||||||
Vector3 &Scale=Core->GetScaleVector();
|
|
||||||
|
|
||||||
if (!Selection.IsValid()) return;
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
glScalef(Scale.x,Scale.y,Scale.z);
|
|
||||||
glTranslatef(-ThisCam.x,ThisCam.y,0);
|
|
||||||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
|
||||||
|
|
||||||
glColor4f(1,0,1,0.5f);
|
|
||||||
glBegin (GL_QUADS);
|
|
||||||
float X0=Rect.left;
|
|
||||||
float X1=Rect.right;
|
|
||||||
float Y0=Rect.top-1;
|
|
||||||
float Y1=Rect.bottom-1;
|
|
||||||
glVertex3f( X0, -Y0, 0);
|
|
||||||
glVertex3f( X1, -Y0, 0);
|
|
||||||
glVertex3f( X1, -Y1, 0);
|
|
||||||
glVertex3f( X0, -Y1, 0);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active)
|
|
||||||
{
|
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
|
||||||
int MapWidth=Map.GetWidth();
|
|
||||||
int MapHeight=Map.GetHeight();
|
|
||||||
float ZoomW=Core->GetZoomW();
|
|
||||||
float ZoomH=Core->GetZoomH();
|
|
||||||
float ScrOfsX=(ZoomW/2);
|
|
||||||
float ScrOfsY=(ZoomH/2);
|
|
||||||
Vector3 &Scale=Core->GetScaleVector();
|
|
||||||
float Col;
|
|
||||||
const float OverVal=0.1f;
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
glScalef(Scale.x,Scale.y,Scale.z);
|
|
||||||
glTranslatef(-ThisCam.x,ThisCam.y,0);
|
|
||||||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
|
||||||
|
|
||||||
if (Active) Col=1; else Col=0.5f;
|
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
|
||||||
|
|
||||||
glColor3f(Col,Col,Col);
|
|
||||||
|
|
||||||
for (int YLoop=0; YLoop<MapHeight+1; YLoop++)
|
|
||||||
{
|
|
||||||
glVertex3f( 0-OverVal, -YLoop+1, 0);
|
|
||||||
glVertex3f( MapWidth+OverVal, -YLoop+1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int XLoop=0; XLoop<MapWidth+1; XLoop++)
|
|
||||||
{
|
|
||||||
glVertex3f( XLoop, 0+1+OverVal, 0);
|
|
||||||
glVertex3f( XLoop, -MapHeight+1-OverVal, 0);
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::FindCursorPos(CCore *Core,CMapEditView *View,Vector3 &CamPos,CPoint &MousePos)
|
|
||||||
{
|
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
|
||||||
int MapWidth=Map.GetWidth();
|
|
||||||
int MapHeight=Map.GetHeight();
|
|
||||||
float ZoomW=Core->GetZoomW();
|
|
||||||
float ZoomH=Core->GetZoomH();
|
|
||||||
float ScrOfsX=(ZoomW/2);
|
|
||||||
float ScrOfsY=(ZoomH/2);
|
|
||||||
Vector3 &Scale=Core->GetScaleVector();
|
|
||||||
|
|
||||||
GLint Viewport[4];
|
|
||||||
GLuint SelectBuffer[SELECT_BUFFER_SIZE];
|
|
||||||
int TileID=0;
|
|
||||||
CPoint &CursorPos=Core->GetCursorPos();
|
|
||||||
|
|
||||||
int StartX=(int)ThisCam.x;
|
|
||||||
int StartY=(int)ThisCam.y;
|
|
||||||
float ShiftX=ThisCam.x - (int)ThisCam.x;
|
|
||||||
float ShiftY=ThisCam.y - (int)ThisCam.y;
|
|
||||||
|
|
||||||
if (StartX<0) StartX=0;
|
|
||||||
if (StartY<0) StartY=0;
|
|
||||||
|
|
||||||
int DrawW=ZoomW+8;
|
|
||||||
int DrawH=ZoomH+8;
|
|
||||||
|
|
||||||
if (StartX+DrawW>MapWidth) DrawW=MapWidth-StartX;
|
|
||||||
if (StartY+DrawH>MapHeight) DrawH=MapHeight-StartY;
|
|
||||||
|
|
||||||
glGetIntegerv(GL_VIEWPORT, Viewport);
|
|
||||||
glSelectBuffer (SELECT_BUFFER_SIZE, SelectBuffer );
|
|
||||||
glRenderMode (GL_SELECT);
|
|
||||||
|
|
||||||
glInitNames();
|
|
||||||
glPushName(-1);
|
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
gluPickMatrix( MousePos.x ,(Viewport[3]-MousePos.y),5.0,5.0,Viewport);
|
|
||||||
View->SetupPersMatrix();
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
glScalef(Scale.x,Scale.y,Scale.z);
|
|
||||||
// glTranslatef(-ThisCam.x,ThisCam.y,0);
|
|
||||||
glTranslatef(-ShiftX,ShiftY,0);
|
|
||||||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
|
||||||
|
|
||||||
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
|
||||||
{
|
|
||||||
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
|
||||||
{
|
|
||||||
TileID=(XLoop+StartX)+(((YLoop+StartY)*MapWidth));
|
|
||||||
glLoadName (TileID);
|
|
||||||
glBegin (GL_QUADS);
|
|
||||||
BuildGLQuad(XLoop,XLoop+1,-YLoop,-YLoop+1,0);
|
|
||||||
glEnd();
|
|
||||||
TileID++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TileID= glRenderMode (GL_RENDER);
|
|
||||||
glPopMatrix();
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPopMatrix();
|
|
||||||
CursorPos.x=CursorPos.y=-1;
|
|
||||||
|
|
||||||
// Process hits
|
|
||||||
|
|
||||||
GLuint *HitPtr=SelectBuffer;
|
|
||||||
|
|
||||||
if (TileID) // Just take 1st
|
|
||||||
{
|
|
||||||
int HitID=HitPtr[3];
|
|
||||||
CursorPos=IDToPoint(HitID,MapWidth);
|
|
||||||
}
|
|
||||||
glMatrixMode(GL_MODELVIEW); // <-- Prevent arse GL assert
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Gui *********************************************************************/
|
/*** Gui *********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::InitGUI(CCore *Core)
|
void CLayerCollision::InitGUI(CCore *Core)
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
CMultiBar *ParamBar=Frm->GetParamBar();
|
CMultiBar *ParamBar=Frm->GetParamBar();
|
||||||
|
|
||||||
ParamBar->Add(Frm->GetLayerTileGUI(),IDD_LAYERTILE_GUI,TRUE);
|
ParamBar->Add(Frm->GetLayerTileToolbar(),IDD_LAYERTILE_TOOLBAR,TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::UpdateGUI(CCore *Core)
|
void CLayerCollision::UpdateGUI(CCore *Core)
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
CLayerTile::UpdateGUI(Core);
|
||||||
CLayerTileGUI *Dlg=(CLayerTileGUI *)Frm->GetDialog(IDD_LAYERTILE_GUI);
|
|
||||||
|
|
||||||
if (Dlg)
|
|
||||||
{
|
|
||||||
Dlg->ResetButtons();
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
Dlg->SetButtonState(CLayerTileGUI::PAINT,TRUE);
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
Dlg->SetButtonState(CLayerTileGUI::SELECT,TRUE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Core->UpdateTileViewGUI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Functions ***************************************************************/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::SetMode(int NewMode)
|
/*****************************************************************************/
|
||||||
|
void CLayerCollision::Export(CCore *Core,CExport &Exp)
|
||||||
{
|
{
|
||||||
BOOL Ret=FALSE;
|
// Exp.ExportLayerTile(Core,GetName(),SubType,Map);
|
||||||
|
|
||||||
// Clean up last mode
|
|
||||||
Ret|=ExitMode();
|
|
||||||
Mode=(MouseMode)NewMode;
|
|
||||||
Ret|=InitMode();
|
|
||||||
return(Ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::InitMode()
|
void CLayerCollision::DeleteSet(int Set)
|
||||||
{
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::ExitMode()
|
|
||||||
{
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::LButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &CursorPos,BOOL DownFlag)
|
|
||||||
{
|
|
||||||
BOOL Ret=FALSE;
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
if (DownFlag)
|
|
||||||
Ret=Paint(TileBank.GetLBrush(),CursorPos);
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
Ret=Selection.Handle(CursorPos,nFlags);
|
|
||||||
if (Selection.HasSelection())
|
|
||||||
{
|
|
||||||
TRACE0("LMB Selection\n");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(Ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::RButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &CursorPos,BOOL DownFlag)
|
|
||||||
{
|
|
||||||
BOOL Ret=FALSE;
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
if (DownFlag)
|
|
||||||
Ret=Paint(TileBank.GetRBrush(),CursorPos);
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
Ret=Selection.Handle(CursorPos,nFlags);
|
|
||||||
if (Selection.HasSelection())
|
|
||||||
{
|
|
||||||
TRACE0("RMB Selection\n");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(Ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::MouseMove(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &CursorPos)
|
|
||||||
{
|
|
||||||
BOOL Ret=FALSE;
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
if (nFlags & MK_LBUTTON)
|
|
||||||
Ret=Paint(TileBank.GetLBrush(),CursorPos);
|
|
||||||
else
|
|
||||||
if (nFlags & MK_RBUTTON)
|
|
||||||
Ret=Paint(TileBank.GetRBrush(),CursorPos);
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
Ret=Selection.Handle(CursorPos,nFlags);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(Ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::RenderCursor(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
|
||||||
{
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
RenderCursorPaint(Core,CamPos,Is3d);
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
RenderSelection(Core,CamPos);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::MirrorX(CCore *Core)
|
|
||||||
{
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
{
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
|
|
||||||
TileBank.GetLBrush().MirrorX(TILE_FLAG_MIRROR_X);
|
|
||||||
TileBank.GetRBrush().MirrorX(TILE_FLAG_MIRROR_X);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
{
|
|
||||||
if (!Selection.IsValid()) return(false); // No Selection
|
|
||||||
CRect R=Selection.GetRect();
|
|
||||||
Map.MirrorX(TILE_FLAG_MIRROR_X,&R);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::MirrorY(CCore *Core)
|
|
||||||
{
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
{
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
|
|
||||||
TileBank.GetLBrush().MirrorY(TILE_FLAG_MIRROR_Y);
|
|
||||||
TileBank.GetRBrush().MirrorY(TILE_FLAG_MIRROR_Y);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
{
|
|
||||||
if (!Selection.IsValid()) return(false); // No Selection
|
|
||||||
CRect R=Selection.GetRect();
|
|
||||||
Map.MirrorY(TILE_FLAG_MIRROR_Y,&R);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::CopySelection(CCore *Core)
|
|
||||||
{
|
|
||||||
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
|
||||||
if (!Selection.IsValid()) return(false); // No Selection
|
|
||||||
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
CRect Rect=Selection.GetRect();
|
|
||||||
|
|
||||||
TileBank.GetActiveBrush().Set(Map,Rect.left,Rect.top,Rect.Width(),Rect.Height());
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::PasteSelection(CCore *Core)
|
|
||||||
{
|
|
||||||
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
|
||||||
if (!Selection.IsValid()) return(false); // No Selection
|
|
||||||
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
CRect Rect=Selection.GetRect();
|
|
||||||
|
|
||||||
Map.Paste(TileBank.GetActiveBrush(),&Rect);
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
BOOL CLayerTile::Paint(CMap &Blk,CPoint &CursorPos)
|
|
||||||
{
|
|
||||||
if (CursorPos.y==-1 || CursorPos.y==-1) return(FALSE); // Off Map?
|
|
||||||
if (!Blk.IsValid()) return(FALSE); // Invalid tile?
|
|
||||||
|
|
||||||
Map.Set(CursorPos.x,CursorPos.y,Blk);
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::Export(CCore *Core,CExport &Exp)
|
|
||||||
{
|
|
||||||
Exp.ExportLayerTile(Core,GetName(),SubType,Map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTile::DeleteSet(int Set)
|
|
||||||
{
|
{
|
||||||
Map.DeleteSet(Set);
|
Map.DeleteSet(Set);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::RemapSet(int OrigSet,int NewSet)
|
void CLayerCollision::RemapSet(int OrigSet,int NewSet)
|
||||||
{
|
{
|
||||||
Map.RemapSet(OrigSet,NewSet);
|
Map.RemapSet(OrigSet,NewSet);
|
||||||
|
|
||||||
|
@ -1,89 +1,37 @@
|
|||||||
/******************/
|
/***********************/
|
||||||
/*** Layer Tile ***/
|
/*** Layer Collision ***/
|
||||||
/******************/
|
/***********************/
|
||||||
|
|
||||||
#ifndef __LAYER_TILE_HEADER__
|
#ifndef __LAYER_COLLISION_HEADER__
|
||||||
#define __LAYER_TILE_HEADER__
|
#define __LAYER_COLLISION_HEADER__
|
||||||
|
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
enum TileLayerEnum
|
|
||||||
{
|
|
||||||
TileLayerMinWidth=32,
|
|
||||||
TileLayerMinHeight=22,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CCore;
|
class CCore;
|
||||||
class CMapEditView;
|
//class CMapEditView;
|
||||||
class CLayerTile : public CLayer
|
class CLayerCollision : public CLayerTile
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum MouseMode
|
CLayerCollision(int SubType,int Width,int Height); // New Layer
|
||||||
{
|
CLayerCollision(CFile *File,int Version); // Load Layer
|
||||||
MouseModePaint=0,
|
~CLayerCollision();
|
||||||
MouseModeSelect,
|
|
||||||
};
|
|
||||||
|
|
||||||
CLayerTile(int SubType,int Width,int Height); // New Layer
|
int GetType() {return(LAYER_TYPE_COLLISION);}
|
||||||
CLayerTile(CFile *File,int Version); // Load Layer
|
|
||||||
~CLayerTile();
|
|
||||||
|
|
||||||
int GetType() {return(LAYER_TYPE_TILE);}
|
|
||||||
int GetSubType() {return(SubType);}
|
|
||||||
|
|
||||||
void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
|
||||||
void RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active);
|
|
||||||
void RenderSelection(CCore *Core,Vector3 &ThisCam);
|
|
||||||
|
|
||||||
void FindCursorPos(CCore *Core,CMapEditView *View,Vector3 &CamPos,CPoint &MousePos);
|
|
||||||
void RenderCursor(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
|
||||||
|
|
||||||
void InitGUI(CCore *Core);
|
void InitGUI(CCore *Core);
|
||||||
void UpdateGUI(CCore *Core);
|
void UpdateGUI(CCore *Core);
|
||||||
|
|
||||||
int GetWidth() {return(Map.GetWidth());}
|
void Load(CFile *File,int Version);
|
||||||
int GetHeight() {return(Map.GetHeight());}
|
|
||||||
BOOL Resize(int Width,int Height);
|
|
||||||
|
|
||||||
void Load(CFile *File,float Version);
|
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
void CheckLayerSize(int Width,int Height);
|
|
||||||
|
|
||||||
void Export(CCore *Core,CExport &Exp);
|
void Export(CCore *Core,CExport &Exp);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
BOOL SetMode(int NewMode);
|
|
||||||
BOOL InitMode();
|
|
||||||
BOOL ExitMode();
|
|
||||||
|
|
||||||
BOOL LButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag);
|
|
||||||
BOOL RButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag);
|
|
||||||
BOOL MouseMove(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &point);
|
|
||||||
|
|
||||||
BOOL MirrorX(CCore *Core);
|
|
||||||
BOOL MirrorY(CCore *Core);
|
|
||||||
|
|
||||||
BOOL CopySelection(CCore *Core);
|
|
||||||
BOOL PasteSelection(CCore *Core);
|
|
||||||
|
|
||||||
void DeleteSet(int Set);
|
void DeleteSet(int Set);
|
||||||
void RemapSet(int OrigSet,int NewSet);
|
void RemapSet(int OrigSet,int NewSet);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,BOOL Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
|
|
||||||
void RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
|
||||||
|
|
||||||
BOOL Paint(CMap &Blk,CPoint &CursorPos);
|
|
||||||
|
|
||||||
CMap Map;
|
|
||||||
int SubType;
|
|
||||||
MouseMode Mode;
|
|
||||||
|
|
||||||
//static char *LayerName[];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,15 +8,19 @@
|
|||||||
enum LAYER_TYPE
|
enum LAYER_TYPE
|
||||||
{
|
{
|
||||||
LAYER_TYPE_TILE=0,
|
LAYER_TYPE_TILE=0,
|
||||||
|
LAYER_TYPE_COLLISION,
|
||||||
LAYER_TYPE_MAX
|
LAYER_TYPE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LAYER_SUBTYPE
|
enum LAYER_SUBTYPE
|
||||||
{
|
{
|
||||||
|
LAYER_SUBTYPE_NONE=-1,
|
||||||
|
|
||||||
LAYERTILE_BACK=0,
|
LAYERTILE_BACK=0,
|
||||||
LAYERTILE_MID,
|
LAYERTILE_MID,
|
||||||
LAYERTILE_ACTION,
|
LAYERTILE_ACTION,
|
||||||
LAYERTILE_FORE,
|
LAYERTILE_FORE,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TILE_FLAG
|
enum TILE_FLAG
|
||||||
|
@ -21,26 +21,21 @@
|
|||||||
#include "Select.h"
|
#include "Select.h"
|
||||||
#include "Export.h"
|
#include "Export.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
char *CLayerTile::LayerName[]=
|
|
||||||
{
|
|
||||||
"Back",
|
|
||||||
"Mid",
|
|
||||||
"Action",
|
|
||||||
"Fore",
|
|
||||||
};
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// New Layer
|
// New Layer
|
||||||
CLayerTile::CLayerTile(int _SubType,int Width,int Height,float Scale,BOOL Is3d,BOOL Resizable)
|
CLayerTile::CLayerTile(int _SubType,int Width,int Height)
|
||||||
{
|
{
|
||||||
SubType=_SubType;
|
SubType=_SubType;
|
||||||
ScaleFactor=Scale;
|
if (SubType==LAYERTILE_BACK) // Back is fixed size
|
||||||
ResizeFlag=Resizable;
|
{
|
||||||
Render3dFlag=Is3d;
|
Width=32;
|
||||||
VisibleFlag=TRUE;
|
Height=32;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDefaultParams();
|
||||||
|
|
||||||
Mode=MouseModePaint;
|
Mode=MouseModePaint;
|
||||||
|
|
||||||
if (ResizeFlag)
|
if (ResizeFlag)
|
||||||
@ -68,19 +63,15 @@ CLayerTile::~CLayerTile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::Load(CFile *File,float Version)
|
void CLayerTile::Load(CFile *File,int Version)
|
||||||
{
|
{
|
||||||
// Version 1
|
File->Read(&Render3dFlag,sizeof(BOOL));
|
||||||
if (Version>=1.0)
|
File->Read(&ScaleFactor,sizeof(float));
|
||||||
{
|
File->Read(&ResizeFlag,sizeof(BOOL));
|
||||||
File->Read(&Render3dFlag,sizeof(BOOL));
|
File->Read(&VisibleFlag,sizeof(BOOL));
|
||||||
File->Read(&ScaleFactor,sizeof(float));
|
File->Read(&Mode,sizeof(MouseMode));
|
||||||
File->Read(&ResizeFlag,sizeof(BOOL));
|
File->Read(&SubType,sizeof(int));
|
||||||
File->Read(&VisibleFlag,sizeof(BOOL));
|
Map.Load(File,Version);
|
||||||
File->Read(&Mode,sizeof(MouseMode));
|
|
||||||
File->Read(&SubType,sizeof(int));
|
|
||||||
Map.Load(File,Version);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE1("%s\t",GetName());
|
TRACE1("%s\t",GetName());
|
||||||
TRACE1("Scl:%g\t",ScaleFactor);
|
TRACE1("Scl:%g\t",ScaleFactor);
|
||||||
@ -407,30 +398,32 @@ void CLayerTile::InitGUI(CCore *Core)
|
|||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
CMultiBar *ParamBar=Frm->GetParamBar();
|
CMultiBar *ParamBar=Frm->GetParamBar();
|
||||||
|
|
||||||
|
ParamBar->Add(Frm->GetLayerTileToolbar(),IDD_LAYERTILE_TOOLBAR,TRUE);
|
||||||
ParamBar->Add(Frm->GetLayerTileGUI(),IDD_LAYERTILE_GUI,TRUE);
|
ParamBar->Add(Frm->GetLayerTileGUI(),IDD_LAYERTILE_GUI,TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::UpdateGUI(CCore *Core)
|
void CLayerTile::UpdateGUI(CCore *Core)
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
CLayerTileGUI *Dlg=(CLayerTileGUI *)Frm->GetDialog(IDD_LAYERTILE_GUI);
|
CLayerTileToolbar *Bar=(CLayerTileToolbar *)Frm->GetDialog(IDD_LAYERTILE_TOOLBAR);
|
||||||
|
|
||||||
if (Dlg)
|
if (Bar)
|
||||||
{
|
{
|
||||||
Dlg->ResetButtons();
|
Bar->ResetButtons();
|
||||||
switch(Mode)
|
switch(Mode)
|
||||||
{
|
{
|
||||||
case MouseModePaint:
|
case MouseModePaint:
|
||||||
Dlg->SetButtonState(CLayerTileGUI::PAINT,TRUE);
|
Bar->SetButtonState(CLayerTileToolbar::PAINT,TRUE);
|
||||||
break;
|
break;
|
||||||
case MouseModeSelect:
|
case MouseModeSelect:
|
||||||
Dlg->SetButtonState(CLayerTileGUI::SELECT,TRUE);
|
Bar->SetButtonState(CLayerTileToolbar::SELECT,TRUE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Core->UpdateTileViewGUI();
|
Core->UpdateTileViewGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,13 +27,13 @@ public:
|
|||||||
MouseModeSelect,
|
MouseModeSelect,
|
||||||
};
|
};
|
||||||
|
|
||||||
CLayerTile(int SubType,int Width,int Height,float Scale,BOOL Is3d,BOOL Resizable); // New Layer
|
CLayerTile(){};
|
||||||
CLayerTile(CFile *File,int Version); // Load Layer
|
CLayerTile(int SubType,int Width,int Height); // New Layer
|
||||||
|
CLayerTile(CFile *File,int Version); // Load Layer
|
||||||
~CLayerTile();
|
~CLayerTile();
|
||||||
|
|
||||||
int GetType() {return(LAYER_TYPE_TILE);}
|
int GetType() {return(LAYER_TYPE_TILE);}
|
||||||
int GetSubType() {return(SubType);}
|
int GetSubType() {return(SubType);}
|
||||||
char *GetName() {return(LayerName[SubType]);}
|
|
||||||
|
|
||||||
void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
||||||
void RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active);
|
void RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active);
|
||||||
@ -49,12 +49,11 @@ public:
|
|||||||
int GetHeight() {return(Map.GetHeight());}
|
int GetHeight() {return(Map.GetHeight());}
|
||||||
BOOL Resize(int Width,int Height);
|
BOOL Resize(int Width,int Height);
|
||||||
|
|
||||||
void Load(CFile *File,float Version);
|
void Load(CFile *File,int Version);
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
void CheckLayerSize(int Width,int Height);
|
void CheckLayerSize(int Width,int Height);
|
||||||
|
|
||||||
void Export(CCore *Core,CExport &Exp);
|
void Export(CCore *Core,CExport &Exp);
|
||||||
bool CanDelete() {if (SubType==LAYERTILE_FORE) return(true); else return(false);}
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
BOOL SetMode(int NewMode);
|
BOOL SetMode(int NewMode);
|
||||||
@ -85,7 +84,7 @@ protected:
|
|||||||
int SubType;
|
int SubType;
|
||||||
MouseMode Mode;
|
MouseMode Mode;
|
||||||
|
|
||||||
static char *LayerName[];
|
//static char *LayerName[];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "MultiBar.h"
|
#include "MultiBar.h"
|
||||||
#include "LayerList.h"
|
#include "LayerList.h"
|
||||||
#include "LayerTileGUI.h"
|
#include "LayerTileGUI.h"
|
||||||
|
#include "LayerTileToolbar.h"
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
#if _MSC_VER > 1000
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -39,6 +40,7 @@ public:
|
|||||||
CMultiBar *GetParamBar() {return(&ParamBar);}
|
CMultiBar *GetParamBar() {return(&ParamBar);}
|
||||||
CDialog &GetLayerList() {return(LayerList);}
|
CDialog &GetLayerList() {return(LayerList);}
|
||||||
CDialog &GetLayerTileGUI() {return(LayerTileGUI);}
|
CDialog &GetLayerTileGUI() {return(LayerTileGUI);}
|
||||||
|
CDialog &GetLayerTileToolbar() {return(LayerTileToolBar);}
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
public:
|
public:
|
||||||
@ -58,13 +60,14 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected: // control bar embedded members
|
protected: // control bar embedded members
|
||||||
CStatusBar StatusBar;
|
CStatusBar StatusBar;
|
||||||
CMainToolBar ToolBar;
|
CMainToolBar ToolBar;
|
||||||
|
|
||||||
CMultiBar ParamBar;
|
CMultiBar ParamBar;
|
||||||
// Sub Dialogs
|
// Sub Dialogs
|
||||||
CLayerList LayerList;
|
CLayerList LayerList;
|
||||||
CLayerTileGUI LayerTileGUI;
|
CLayerTileGUI LayerTileGUI;
|
||||||
|
CLayerTileToolbar LayerTileToolBar;
|
||||||
|
|
||||||
// Generated message map functions
|
// Generated message map functions
|
||||||
protected:
|
protected:
|
||||||
|
@ -12,11 +12,14 @@
|
|||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CMap::Load(CFile *File,float Version)
|
void CMap::Load(CFile *File,int Version)
|
||||||
{
|
{
|
||||||
// Version 1
|
// Version 1
|
||||||
int Width;
|
int Width;
|
||||||
int Height;
|
int Height;
|
||||||
|
int VFix=0; // Fix for colliison tileset
|
||||||
|
|
||||||
|
if (Version<2) VFix=1;
|
||||||
|
|
||||||
File->Read(&Width,sizeof(int));
|
File->Read(&Width,sizeof(int));
|
||||||
File->Read(&Height,sizeof(int));
|
File->Read(&Height,sizeof(int));
|
||||||
@ -29,10 +32,10 @@ int Height;
|
|||||||
{
|
{
|
||||||
sMapElem ThisElem;
|
sMapElem ThisElem;
|
||||||
File->Read(&ThisElem,sizeof(sMapElem));
|
File->Read(&ThisElem,sizeof(sMapElem));
|
||||||
|
ThisElem.Set+=VFix;
|
||||||
Set(X,Y,ThisElem,TRUE);
|
Set(X,Y,ThisElem,TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
|
|
||||||
BOOL DoesContainTile(sMapElem &Tile);
|
BOOL DoesContainTile(sMapElem &Tile);
|
||||||
|
|
||||||
void Load(CFile *File,float Version);
|
void Load(CFile *File,int Version);
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
|
|
||||||
void DeleteSet(int Set);
|
void DeleteSet(int Set);
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
[General Info]
|
[General Info]
|
||||||
Version=1
|
Version=1
|
||||||
LastClass=CLayerList
|
LastClass=CMapEditView
|
||||||
LastTemplate=CDialog
|
LastTemplate=CDialog
|
||||||
NewFileInclude1=#include "stdafx.h"
|
NewFileInclude1=#include "stdafx.h"
|
||||||
NewFileInclude2=#include "mapedit.h"
|
NewFileInclude2=#include "mapedit.h"
|
||||||
LastPage=0
|
LastPage=0
|
||||||
|
|
||||||
ClassCount=14
|
ClassCount=16
|
||||||
Class1=CChildFrame
|
Class1=CChildFrame
|
||||||
Class2=CGLEnabledView
|
Class2=CGLEnabledView
|
||||||
Class3=CMainFrame
|
Class3=CMainFrame
|
||||||
@ -17,31 +17,36 @@ Class5=CAboutDlg
|
|||||||
Class6=CMapEditDoc
|
Class6=CMapEditDoc
|
||||||
Class7=CMapEditView
|
Class7=CMapEditView
|
||||||
|
|
||||||
ResourceCount=11
|
ResourceCount=13
|
||||||
Resource1=IDD_NEW_LAYER
|
Resource1=IDD_NEW_LAYER
|
||||||
Resource2=IDR_MAPEDITYPE (English (U.S.))
|
Resource2=IDR_MAPEDITYPE (English (U.S.))
|
||||||
Resource3=IDD_ABOUTBOX (English (U.S.))
|
Resource3=IDD_ABOUTBOX (English (U.S.))
|
||||||
Resource4=IDD_DIALOGBAR (English (U.S.))
|
Resource4=IDD_DIALOGBAR (English (U.S.))
|
||||||
Resource5=IDD_LAYER_LIST_DIALOG
|
Resource5=IDD_MAPSIZE
|
||||||
Class8=CMultiBar
|
Class8=CMultiBar
|
||||||
Resource6=IDD_LAYERTILE_GUI
|
Resource6=IDR_TOOLBAR (English (U.S.))
|
||||||
Resource7=IDD_MULTIBAR (English (U.S.))
|
Resource7=IDD_LAYERTILE_GUI
|
||||||
Class9=CLayerList
|
Class9=CLayerList
|
||||||
Class10=CMapSizeDlg
|
Class10=CMapSizeDlg
|
||||||
Resource8=IDR_MAINFRAME (English (U.S.))
|
Resource8=IDR_MAINFRAME (English (U.S.))
|
||||||
Class11=CGfxToolBar
|
Class11=CGfxToolBar
|
||||||
Class12=CLayerTileGUI
|
Class12=CLayerTileGUI
|
||||||
Resource9=IDR_TOOLBAR (English (U.S.))
|
Resource9=IDD_LAYER_LIST_DIALOG
|
||||||
Resource10=IDD_MAPSIZE
|
Resource10=IDD_NEWMAP
|
||||||
Class13=CNewMapGUI
|
Class13=CNewMapGUI
|
||||||
Class14=CProgressDlg
|
Class14=CProgressDlg
|
||||||
Resource11=IDD_NEWMAP
|
Resource11=IDD_MULTIBAR (English (U.S.))
|
||||||
|
Class15=CAddLayerDlg
|
||||||
|
Resource12=IDD_ADDLAYER
|
||||||
|
Class16=CLayerTileToolbar
|
||||||
|
Resource13=IDD_LAYERTILE_TOOLBAR
|
||||||
|
|
||||||
[CLS:CChildFrame]
|
[CLS:CChildFrame]
|
||||||
Type=0
|
Type=0
|
||||||
BaseClass=CMDIChildWnd
|
BaseClass=CMDIChildWnd
|
||||||
HeaderFile=ChildFrm.h
|
HeaderFile=ChildFrm.h
|
||||||
ImplementationFile=ChildFrm.cpp
|
ImplementationFile=ChildFrm.cpp
|
||||||
|
LastObject=CChildFrame
|
||||||
|
|
||||||
[CLS:CGLEnabledView]
|
[CLS:CGLEnabledView]
|
||||||
Type=0
|
Type=0
|
||||||
@ -77,7 +82,7 @@ Type=0
|
|||||||
BaseClass=CDocument
|
BaseClass=CDocument
|
||||||
HeaderFile=MapEditDoc.h
|
HeaderFile=MapEditDoc.h
|
||||||
ImplementationFile=MapEditDoc.cpp
|
ImplementationFile=MapEditDoc.cpp
|
||||||
LastObject=ID_EXPORT_AGB
|
LastObject=CMapEditDoc
|
||||||
Filter=N
|
Filter=N
|
||||||
VirtualFilter=DC
|
VirtualFilter=DC
|
||||||
|
|
||||||
@ -228,7 +233,7 @@ ImplementationFile=LayerList.cpp
|
|||||||
BaseClass=CDialog
|
BaseClass=CDialog
|
||||||
Filter=D
|
Filter=D
|
||||||
VirtualFilter=dWC
|
VirtualFilter=dWC
|
||||||
LastObject=IDC_LAYERLIST_ADD
|
LastObject=IDC_LAYER_LIST
|
||||||
|
|
||||||
[CLS:CGfxToolBar]
|
[CLS:CGfxToolBar]
|
||||||
Type=0
|
Type=0
|
||||||
@ -262,13 +267,11 @@ VirtualFilter=dWC
|
|||||||
[DLG:IDD_LAYERTILE_GUI]
|
[DLG:IDD_LAYERTILE_GUI]
|
||||||
Type=1
|
Type=1
|
||||||
Class=CLayerTileGUI
|
Class=CLayerTileGUI
|
||||||
ControlCount=6
|
ControlCount=4
|
||||||
Control1=IDD_LAYERTILE_LIST,combobox,1342242819
|
Control1=IDD_LAYERTILE_LIST,combobox,1342242819
|
||||||
Control2=IDD_LAYERTILE_BTN_UPDATE,button,1342242816
|
Control2=IDD_LAYERTILE_BTN_UPDATE,button,1342242816
|
||||||
Control3=IDD_LAYERTILE_BTN_LOAD,button,1342242816
|
Control3=IDD_LAYERTILE_BTN_LOAD,button,1342242816
|
||||||
Control4=IDD_LAYERTILE_BTN_PAINT,button,1342177344
|
Control4=IDD_LAYERTILE_BTN_DELETE,button,1342242816
|
||||||
Control5=IDD_LAYERTILE_BTN_SELECT,button,1342177344
|
|
||||||
Control6=IDD_LAYERTILE_BTN_DELETE,button,1342242816
|
|
||||||
|
|
||||||
[CLS:CLayerTileGUI]
|
[CLS:CLayerTileGUI]
|
||||||
Type=0
|
Type=0
|
||||||
@ -277,7 +280,7 @@ ImplementationFile=LayerTileGUI.cpp
|
|||||||
BaseClass=CDialog
|
BaseClass=CDialog
|
||||||
Filter=D
|
Filter=D
|
||||||
VirtualFilter=dWC
|
VirtualFilter=dWC
|
||||||
LastObject=IDD_LAYERTILE_BTN_DELETE
|
LastObject=IDD_LAYERTILE_BTN_UPDATE
|
||||||
|
|
||||||
[DLG:IDD_NEW_LAYER]
|
[DLG:IDD_NEW_LAYER]
|
||||||
Type=1
|
Type=1
|
||||||
@ -299,16 +302,13 @@ Control12=IDC_NEW_LAYER_WIDTH_EDIT2,edit,1350631552
|
|||||||
[DLG:IDD_NEWMAP]
|
[DLG:IDD_NEWMAP]
|
||||||
Type=1
|
Type=1
|
||||||
Class=CNewMapGUI
|
Class=CNewMapGUI
|
||||||
ControlCount=9
|
ControlCount=6
|
||||||
Control1=IDOK,button,1342177281
|
Control1=IDOK,button,1342177281
|
||||||
Control2=IDCANCEL,button,1342177280
|
Control2=IDCANCEL,button,1342177280
|
||||||
Control3=IDC_MAPSIZE_WIDTH_TEXT,static,1342308866
|
Control3=IDC_MAPSIZE_WIDTH_TEXT,static,1342308866
|
||||||
Control4=IDC_MAPSIZE_WIDTH,edit,1350639744
|
Control4=IDC_MAPSIZE_WIDTH,edit,1350639744
|
||||||
Control5=IDC_MAPSIZE_HEIGHT_TEXT,static,1342308866
|
Control5=IDC_MAPSIZE_HEIGHT_TEXT,static,1342308866
|
||||||
Control6=IDC_MAPSIZE_HEIGHT,edit,1350639744
|
Control6=IDC_MAPSIZE_HEIGHT,edit,1350639744
|
||||||
Control7=IDC_NEWMAP_BACK_CHECK,button,1476460547
|
|
||||||
Control8=IDC_NEWMAP_MID_CHECK,button,1476460547
|
|
||||||
Control9=IDC_NEWMAP_FORE_CHECK,button,1342242819
|
|
||||||
|
|
||||||
[CLS:CNewMapGUI]
|
[CLS:CNewMapGUI]
|
||||||
Type=0
|
Type=0
|
||||||
@ -328,3 +328,36 @@ Filter=D
|
|||||||
LastObject=IDC_EDIT1
|
LastObject=IDC_EDIT1
|
||||||
VirtualFilter=dWC
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
[CLS:CAddLayerDlg]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=AddLayerDlg.h
|
||||||
|
ImplementationFile=AddLayerDlg.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=IDC_ADDLAYER_LIST
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
[DLG:IDD_ADDLAYER]
|
||||||
|
Type=1
|
||||||
|
Class=CAddLayerDlg
|
||||||
|
ControlCount=3
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDCANCEL,button,1342242816
|
||||||
|
Control3=IDC_ADDLAYER_LIST,listbox,1352728833
|
||||||
|
|
||||||
|
[DLG:IDD_LAYERTILE_TOOLBAR]
|
||||||
|
Type=1
|
||||||
|
Class=CLayerTileToolbar
|
||||||
|
ControlCount=2
|
||||||
|
Control1=IDD_LAYERTILE_BTN_PAINT,button,1342177344
|
||||||
|
Control2=IDD_LAYERTILE_BTN_SELECT,button,1342177344
|
||||||
|
|
||||||
|
[CLS:CLayerTileToolbar]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=LayerTileToolbar.h
|
||||||
|
ImplementationFile=LayerTileToolbar.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=CLayerTileToolbar
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ BOOL CMapEditApp::InitInstance()
|
|||||||
pMainFrame->ShowWindow(m_nCmdShow);
|
pMainFrame->ShowWindow(m_nCmdShow);
|
||||||
pMainFrame->UpdateWindow();
|
pMainFrame->UpdateWindow();
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
|
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
|
||||||
# ADD LINK32 opengl32.lib glu32.lib glib.lib ginlib.lib glaux.lib maths.lib /nologo /subsystem:windows /machine:I386 /out:"..\..\tools\MapEdit.exe" /libpath:"..\libs\ginlib\release\\" /libpath:"..\libs\glib\release\\" /libpath:"..\libs\maths\release\\"
|
# ADD LINK32 opengl32.lib glu32.lib glib.lib ginlib.lib glaux.lib maths.lib /nologo /subsystem:windows /machine:I386 /out:"..\..\tools\MapEdit\MapEdit.exe" /libpath:"..\libs\ginlib\release\\" /libpath:"..\libs\glib\release\\" /libpath:"..\libs\maths\release\\"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "MapEdit - Win32 Debug"
|
!ELSEIF "$(CFG)" == "MapEdit - Win32 Debug"
|
||||||
|
|
||||||
@ -103,6 +103,14 @@ SOURCE=.\Layer.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LayerCollision.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LayerCollision.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\LayerDef.h
|
SOURCE=.\LayerDef.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@ -348,6 +356,14 @@ SOURCE=.\res\Toolbar.bmp
|
|||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\AddLayerDlg.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\AddLayerDlg.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\LayerList.cpp
|
SOURCE=.\LayerList.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@ -364,6 +380,14 @@ SOURCE=.\LayerTileGUI.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LayerTileToolbar.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LayerTileToolbar.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\MapSizeDlg.cpp
|
SOURCE=.\MapSizeDlg.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -469,21 +469,6 @@ BEGIN
|
|||||||
PUSHBUTTON "Delete",IDC_LAYERLIST_DELETE,80,95,70,15
|
PUSHBUTTON "Delete",IDC_LAYERLIST_DELETE,80,95,70,15
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_LAYERTILE_GUI DIALOG DISCARDABLE 0, 0, 151, 81
|
|
||||||
STYLE WS_CHILD
|
|
||||||
FONT 8, "MS Sans Serif"
|
|
||||||
BEGIN
|
|
||||||
COMBOBOX IDD_LAYERTILE_LIST,7,7,138,322,CBS_DROPDOWNLIST |
|
|
||||||
WS_TABSTOP
|
|
||||||
PUSHBUTTON "Update",IDD_LAYERTILE_BTN_UPDATE,95,25,50,15
|
|
||||||
PUSHBUTTON "Load",IDD_LAYERTILE_BTN_LOAD,5,25,45,15
|
|
||||||
PUSHBUTTON "P",IDD_LAYERTILE_BTN_PAINT,5,45,15,15,BS_ICON | NOT
|
|
||||||
WS_TABSTOP
|
|
||||||
PUSHBUTTON "S",IDD_LAYERTILE_BTN_SELECT,20,45,15,15,BS_ICON | NOT
|
|
||||||
WS_TABSTOP
|
|
||||||
PUSHBUTTON "Delete",IDD_LAYERTILE_BTN_DELETE,50,25,45,15
|
|
||||||
END
|
|
||||||
|
|
||||||
IDD_MAPSIZE DIALOG DISCARDABLE 0, 0, 127, 61
|
IDD_MAPSIZE DIALOG DISCARDABLE 0, 0, 127, 61
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
||||||
CAPTION "Enter New Size"
|
CAPTION "Enter New Size"
|
||||||
@ -501,45 +486,51 @@ BEGIN
|
|||||||
IDC_MAPSIZE_WARNING,5,40,110,20
|
IDC_MAPSIZE_WARNING,5,40,110,20
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_NEW_LAYER DIALOG DISCARDABLE 0, 0, 302, 236
|
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
|
||||||
CAPTION "Dialog"
|
|
||||||
FONT 8, "MS Sans Serif"
|
|
||||||
BEGIN
|
|
||||||
DEFPUSHBUTTON "OK",IDOK,245,215,50,14
|
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,190,215,50,14
|
|
||||||
COMBOBOX IDC_NEW_LAYER_TYPE_LIST,45,20,105,110,CBS_DROPDOWN |
|
|
||||||
CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
|
||||||
LTEXT "Layer Type",IDC_NEW_LAYER_TYPE_NAME,5,20,36,10
|
|
||||||
LTEXT "Width",IDC_NEW_LAYER_WIDTH_NAME,5,36,36,10
|
|
||||||
LTEXT "Height",IDC_NEW_LAYER_HEIGHT_NAME,5,50,36,10
|
|
||||||
EDITTEXT IDC_NEW_LAYER_WIDTH_EDIT,45,36,30,15,ES_AUTOHSCROLL
|
|
||||||
EDITTEXT IDC_NEW_LAYER_HEIGHT_EDIT,45,50,30,15,ES_AUTOHSCROLL
|
|
||||||
LTEXT "Name",IDC_NEW_LAYER_NAME_NAME,5,5,36,10
|
|
||||||
EDITTEXT IDC_NEW_LAYER_NAME_EDIT,45,5,105,15,ES_AUTOHSCROLL
|
|
||||||
LTEXT "Width",IDC_NEW_LAYER_WIDTH_NAME2,80,35,36,10
|
|
||||||
EDITTEXT IDC_NEW_LAYER_WIDTH_EDIT2,120,35,30,15,ES_AUTOHSCROLL
|
|
||||||
END
|
|
||||||
|
|
||||||
IDD_NEWMAP DIALOG DISCARDABLE 0, 0, 145, 66
|
IDD_NEWMAP DIALOG DISCARDABLE 0, 0, 145, 66
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
||||||
CAPTION "Enter New Size"
|
CAPTION "Enter New Size"
|
||||||
FONT 8, "MS Sans Serif"
|
FONT 8, "MS Sans Serif"
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "OK",IDOK,90,45,50,14,NOT WS_TABSTOP
|
DEFPUSHBUTTON "OK",IDOK,60,35,50,14,NOT WS_TABSTOP
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,35,45,50,14,NOT WS_TABSTOP
|
PUSHBUTTON "Cancel",IDCANCEL,5,35,50,14,NOT WS_TABSTOP
|
||||||
RTEXT "Width",IDC_MAPSIZE_WIDTH_TEXT,5,5,20,10,SS_CENTERIMAGE
|
RTEXT "Width",IDC_MAPSIZE_WIDTH_TEXT,5,5,20,10,SS_CENTERIMAGE
|
||||||
EDITTEXT IDC_MAPSIZE_WIDTH,30,5,35,12,ES_AUTOHSCROLL | ES_NUMBER
|
EDITTEXT IDC_MAPSIZE_WIDTH,30,5,35,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
RTEXT "Height",IDC_MAPSIZE_HEIGHT_TEXT,5,20,20,10,
|
RTEXT "Height",IDC_MAPSIZE_HEIGHT_TEXT,5,20,20,10,
|
||||||
SS_CENTERIMAGE
|
SS_CENTERIMAGE
|
||||||
EDITTEXT IDC_MAPSIZE_HEIGHT,30,20,35,12,ES_AUTOHSCROLL |
|
EDITTEXT IDC_MAPSIZE_HEIGHT,30,20,35,12,ES_AUTOHSCROLL |
|
||||||
ES_NUMBER
|
ES_NUMBER
|
||||||
CONTROL "Create Back Layer",IDC_NEWMAP_BACK_CHECK,"Button",
|
END
|
||||||
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,70,5,75,10
|
|
||||||
CONTROL "Create Mid Layer",IDC_NEWMAP_MID_CHECK,"Button",
|
IDD_ADDLAYER DIALOGEX 0, 0, 118, 90
|
||||||
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,70,15,69,10
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
||||||
CONTROL "Create Fore Layer",IDC_NEWMAP_FORE_CHECK,"Button",
|
CAPTION "Select Layer To Add."
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,70,25,72,10
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,60,75,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,5,75,50,14
|
||||||
|
LISTBOX IDC_ADDLAYER_LIST,5,5,105,65,LBS_NOINTEGRALHEIGHT |
|
||||||
|
WS_VSCROLL | WS_TABSTOP,WS_EX_DLGMODALFRAME
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_LAYERTILE_GUI DIALOG DISCARDABLE 0, 0, 151, 47
|
||||||
|
STYLE WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
COMBOBOX IDD_LAYERTILE_LIST,7,7,138,322,CBS_DROPDOWNLIST |
|
||||||
|
WS_TABSTOP
|
||||||
|
PUSHBUTTON "Update",IDD_LAYERTILE_BTN_UPDATE,95,25,50,15
|
||||||
|
PUSHBUTTON "Load",IDD_LAYERTILE_BTN_LOAD,5,25,45,15
|
||||||
|
PUSHBUTTON "Delete",IDD_LAYERTILE_BTN_DELETE,50,25,45,15
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_LAYERTILE_TOOLBAR DIALOG DISCARDABLE 0, 0, 151, 16
|
||||||
|
STYLE WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
PUSHBUTTON "P",IDD_LAYERTILE_BTN_PAINT,5,0,15,15,BS_ICON | NOT
|
||||||
|
WS_TABSTOP
|
||||||
|
PUSHBUTTON "S",IDD_LAYERTILE_BTN_SELECT,20,0,15,15,BS_ICON | NOT
|
||||||
|
WS_TABSTOP
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
@ -559,14 +550,6 @@ BEGIN
|
|||||||
BOTTOMMARGIN, 108
|
BOTTOMMARGIN, 108
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_LAYERTILE_GUI, DIALOG
|
|
||||||
BEGIN
|
|
||||||
LEFTMARGIN, 7
|
|
||||||
RIGHTMARGIN, 144
|
|
||||||
TOPMARGIN, 7
|
|
||||||
BOTTOMMARGIN, 74
|
|
||||||
END
|
|
||||||
|
|
||||||
IDD_MAPSIZE, DIALOG
|
IDD_MAPSIZE, DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
LEFTMARGIN, 7
|
LEFTMARGIN, 7
|
||||||
@ -575,14 +558,6 @@ BEGIN
|
|||||||
BOTTOMMARGIN, 54
|
BOTTOMMARGIN, 54
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_NEW_LAYER, DIALOG
|
|
||||||
BEGIN
|
|
||||||
LEFTMARGIN, 7
|
|
||||||
RIGHTMARGIN, 295
|
|
||||||
TOPMARGIN, 7
|
|
||||||
BOTTOMMARGIN, 229
|
|
||||||
END
|
|
||||||
|
|
||||||
IDD_NEWMAP, DIALOG
|
IDD_NEWMAP, DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
LEFTMARGIN, 7
|
LEFTMARGIN, 7
|
||||||
@ -590,6 +565,30 @@ BEGIN
|
|||||||
TOPMARGIN, 7
|
TOPMARGIN, 7
|
||||||
BOTTOMMARGIN, 59
|
BOTTOMMARGIN, 59
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_ADDLAYER, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 111
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 83
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_LAYERTILE_GUI, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 144
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 40
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_LAYERTILE_TOOLBAR, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 144
|
||||||
|
TOPMARGIN, 4
|
||||||
|
BOTTOMMARGIN, 9
|
||||||
|
END
|
||||||
END
|
END
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <gl\glu.h>
|
#include <gl\glu.h>
|
||||||
#include "GLEnabledView.h"
|
#include "GLEnabledView.h"
|
||||||
#include <Vector>
|
#include <Vector>
|
||||||
|
//#include <direct.h>
|
||||||
#include <GFName.hpp>
|
#include <GFName.hpp>
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
@ -21,8 +22,9 @@
|
|||||||
#include "MainFrm.h"
|
#include "MainFrm.h"
|
||||||
#include "LayerTileGui.h"
|
#include "LayerTileGui.h"
|
||||||
|
|
||||||
|
// Reserve slot 0 for collision :o)
|
||||||
|
char *ColFName="Collision.bmp";
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** TileBank ****************************************************************/
|
/*** TileBank ****************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -36,14 +38,31 @@ const float TileBrowserY1=1+TileBrowserGap/2;
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CTileBank::CTileBank()
|
CTileBank::CTileBank()
|
||||||
{
|
{
|
||||||
|
GFName ExePath;
|
||||||
|
GString Filename;
|
||||||
|
|
||||||
|
// Get application path
|
||||||
|
#ifdef _DEBUG
|
||||||
|
ExePath="C:/Spongebob/tools/mapedit/mapedit/";
|
||||||
|
#else
|
||||||
|
char ExeFilename[2048];
|
||||||
|
GetModuleFileName(GetModuleHandle(NULL),ExeFilename,2048);
|
||||||
|
ExePath=ExeFilename;
|
||||||
|
ExePath.File(0);
|
||||||
|
ExePath.Ext(0);
|
||||||
|
#endif
|
||||||
|
Filename=ExePath.FullName();
|
||||||
|
Filename+=ColFName;
|
||||||
|
|
||||||
LoadFlag=FALSE;
|
LoadFlag=FALSE;
|
||||||
CurrentSet=0;
|
CurrentSet=0; LastSet=0;
|
||||||
for (int i=0; i<MaxBrush; i++) Brush[i].Delete();
|
for (int i=0; i<MaxBrush; i++) Brush[i].Delete();
|
||||||
LastCursorPos=CursorPos=-1;
|
LastCursorPos=CursorPos=-1;
|
||||||
ActiveBrush=0;
|
ActiveBrush=0;
|
||||||
SelStart=-1;
|
SelStart=-1;
|
||||||
SelEnd=-1;
|
SelEnd=-1;
|
||||||
|
TileSet.push_back(CTileSet(Filename,0));
|
||||||
|
LoadFlag=TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -52,7 +71,21 @@ CTileBank::~CTileBank()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CTileBank::Load(CFile *File,float Version)
|
void CTileBank::SetCollision(bool f)
|
||||||
|
{
|
||||||
|
if (f)
|
||||||
|
{ // Is collision
|
||||||
|
LastSet=CurrentSet;
|
||||||
|
CurrentSet=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentSet=LastSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CTileBank::Load(CFile *File,int Version)
|
||||||
{
|
{
|
||||||
int ListSize;
|
int ListSize;
|
||||||
GFName RootPath=File->GetFilePath();
|
GFName RootPath=File->GetFilePath();
|
||||||
@ -68,32 +101,22 @@ GString FilePath;
|
|||||||
File->Read(&ActiveBrush,sizeof(int));
|
File->Read(&ActiveBrush,sizeof(int));
|
||||||
Brush[0].Load(File,Version);
|
Brush[0].Load(File,Version);
|
||||||
Brush[1].Load(File,Version);
|
Brush[1].Load(File,Version);
|
||||||
|
if (Version<2)
|
||||||
if (Version<=1.00)
|
|
||||||
{
|
{
|
||||||
for (int i=0;i<ListSize;i++)
|
CurrentSet++;
|
||||||
{
|
|
||||||
char Filename[256+64];
|
|
||||||
|
|
||||||
File->Read(Filename,256+64);
|
|
||||||
AddTileSet(Filename);
|
|
||||||
// TRACE1("%s\n",Filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
// New Style rel storage
|
||||||
{ // New Style rel storage
|
for (int i=0;i<ListSize;i++)
|
||||||
for (int i=0;i<ListSize;i++)
|
{
|
||||||
|
char c=1,RelName[256+64],FullName[256+64];
|
||||||
|
int Len=0;
|
||||||
|
while (c)
|
||||||
{
|
{
|
||||||
char c=1,RelName[256+64],FullName[256+64];
|
File->Read(&c,1);
|
||||||
int Len=0;
|
RelName[Len++]=c;
|
||||||
while (c)
|
|
||||||
{
|
|
||||||
File->Read(&c,1);
|
|
||||||
RelName[Len++]=c;
|
|
||||||
}
|
|
||||||
RootPath.makeabsolute(FilePath,RelName,FullName);
|
|
||||||
AddTileSet(FullName);
|
|
||||||
}
|
}
|
||||||
|
RootPath.makeabsolute(FilePath,RelName,FullName);
|
||||||
|
AddTileSet(FullName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +124,7 @@ GString FilePath;
|
|||||||
void CTileBank::Save(CFile *File)
|
void CTileBank::Save(CFile *File)
|
||||||
{
|
{
|
||||||
int ListSize=TileSet.size();
|
int ListSize=TileSet.size();
|
||||||
|
int NewListSize=ListSize-1;
|
||||||
GString FilePath;
|
GString FilePath;
|
||||||
GFName RootPath=File->GetFilePath();
|
GFName RootPath=File->GetFilePath();
|
||||||
|
|
||||||
@ -108,13 +132,13 @@ GFName RootPath=File->GetFilePath();
|
|||||||
FilePath+=RootPath.Dir();
|
FilePath+=RootPath.Dir();
|
||||||
FilePath.Append('\\');
|
FilePath.Append('\\');
|
||||||
|
|
||||||
File->Write(&ListSize,sizeof(int));
|
File->Write(&NewListSize,sizeof(int));
|
||||||
File->Write(&CurrentSet,sizeof(int));
|
File->Write(&CurrentSet,sizeof(int));
|
||||||
File->Write(&ActiveBrush,sizeof(int));
|
File->Write(&ActiveBrush,sizeof(int));
|
||||||
Brush[0].Save(File);
|
Brush[0].Save(File);
|
||||||
Brush[1].Save(File);
|
Brush[1].Save(File);
|
||||||
|
|
||||||
for (int i=0; i<ListSize; i++)
|
for (int i=1; i<ListSize; i++)
|
||||||
{
|
{
|
||||||
CTileSet &ThisSet=TileSet[i];
|
CTileSet &ThisSet=TileSet[i];
|
||||||
char Filename[256+64];
|
char Filename[256+64];
|
||||||
@ -127,7 +151,7 @@ GFName RootPath=File->GetFilePath();
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CTileBank::AddTileSet(char *Filename)
|
void CTileBank::AddTileSet(const char *Filename)
|
||||||
{
|
{
|
||||||
int ListSize=TileSet.size();
|
int ListSize=TileSet.size();
|
||||||
|
|
||||||
@ -139,7 +163,7 @@ int ListSize=TileSet.size();
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int CTileBank::FindTileSet(char *Filename)
|
int CTileBank::FindTileSet(const char *Filename)
|
||||||
{
|
{
|
||||||
int ListSize=TileSet.size();
|
int ListSize=TileSet.size();
|
||||||
CTileSet FindSet(Filename,ListSize);
|
CTileSet FindSet(Filename,ListSize);
|
||||||
@ -180,12 +204,11 @@ int ListSize=TileSet.size();
|
|||||||
{
|
{
|
||||||
for (int i=0; i<MaxBrush; i++)
|
for (int i=0; i<MaxBrush; i++)
|
||||||
{
|
{
|
||||||
Brush[i].RemapSet(Set,Set-1);
|
Brush[i].RemapSet(Set,Set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TileSet.erase(TileSet.begin()+CurrentSet);
|
TileSet.erase(TileSet.begin()+CurrentSet);
|
||||||
CurrentSet=0;
|
CurrentSet=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -199,7 +222,6 @@ int ListSize=TileSet.size();
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoadFlag=TRUE;
|
LoadFlag=TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -214,7 +236,6 @@ void CTileBank::RenderSet(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
|||||||
{
|
{
|
||||||
if (!TileSet.size()) return; // No tiles, return
|
if (!TileSet.size()) return; // No tiles, return
|
||||||
|
|
||||||
|
|
||||||
if (Is3d)
|
if (Is3d)
|
||||||
{
|
{
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
@ -251,13 +272,13 @@ int ListSize=TileSet.size();
|
|||||||
if (Dlg)
|
if (Dlg)
|
||||||
{
|
{
|
||||||
Dlg->m_List.ResetContent();
|
Dlg->m_List.ResetContent();
|
||||||
if (ListSize)
|
if (ListSize-1)
|
||||||
{
|
{
|
||||||
for (int i=0; i<ListSize; i++)
|
for (int i=1; i<ListSize; i++)
|
||||||
{
|
{
|
||||||
Dlg->m_List.AddString(TileSet[i].GetName());
|
Dlg->m_List.AddString(TileSet[i].GetName());
|
||||||
}
|
}
|
||||||
Dlg->m_List.SetCurSel(CurrentSet);
|
Dlg->m_List.SetCurSel(CurrentSet-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -265,6 +286,7 @@ int ListSize=TileSet.size();
|
|||||||
}
|
}
|
||||||
Dlg->m_List.EnableWindow(IsTileView);
|
Dlg->m_List.EnableWindow(IsTileView);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -365,7 +387,7 @@ BOOL CTileBank::IsTileValidGB(int Set,int Tile)
|
|||||||
/*** TileSet *****************************************************************/
|
/*** TileSet *****************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CTileSet::CTileSet(char *_Filename,int Idx)
|
CTileSet::CTileSet(const char *_Filename,int Idx)
|
||||||
{
|
{
|
||||||
Filename=_Filename;
|
Filename=_Filename;
|
||||||
|
|
||||||
|
@ -40,15 +40,15 @@ public:
|
|||||||
MaxBrush
|
MaxBrush
|
||||||
};
|
};
|
||||||
|
|
||||||
int FindTileSet(char *Filename);
|
int FindTileSet(const char *Filename);
|
||||||
void AddTileSet(char *Filename);
|
void AddTileSet(const char *Filename);
|
||||||
int NeedLoad() {return(LoadFlag);}
|
int NeedLoad() {return(LoadFlag);}
|
||||||
void Delete();
|
void Delete();
|
||||||
void Reload();
|
void Reload();
|
||||||
void LoadTileSets(CCore *Core);
|
void LoadTileSets(CCore *Core);
|
||||||
CTile &GetTile(int Bank,int Tile);
|
CTile &GetTile(int Bank,int Tile);
|
||||||
|
|
||||||
void SetCurrent(int Set) {CurrentSet=Set;}
|
void SetCurrent(int Set) {CurrentSet=Set+1;}
|
||||||
int GetCurrent() {return(CurrentSet);}
|
int GetCurrent() {return(CurrentSet);}
|
||||||
int GetSetCount() {return(TileSet.size());}
|
int GetSetCount() {return(TileSet.size());}
|
||||||
|
|
||||||
@ -66,6 +66,8 @@ public:
|
|||||||
BOOL IsTileValid(int Set,int Tile);
|
BOOL IsTileValid(int Set,int Tile);
|
||||||
BOOL IsTileValidGB(int Set,int Tile);
|
BOOL IsTileValidGB(int Set,int Tile);
|
||||||
|
|
||||||
|
void SetCollision(bool f);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
BOOL SelectL(BOOL DownFlag) {return(Select(LBrush,DownFlag));}
|
BOOL SelectL(BOOL DownFlag) {return(Select(LBrush,DownFlag));}
|
||||||
BOOL SelectR(BOOL DownFlag) {return(Select(RBrush,DownFlag));}
|
BOOL SelectR(BOOL DownFlag) {return(Select(RBrush,DownFlag));}
|
||||||
@ -74,7 +76,7 @@ public:
|
|||||||
void SetActiveBrushL() {ActiveBrush=LBrush;}
|
void SetActiveBrushL() {ActiveBrush=LBrush;}
|
||||||
void SetActiveBrushR() {ActiveBrush=RBrush;}
|
void SetActiveBrushR() {ActiveBrush=RBrush;}
|
||||||
|
|
||||||
void Load(CFile *File,float Version);
|
void Load(CFile *File,int Version);
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
|
|
||||||
|
|
||||||
@ -83,7 +85,7 @@ private:
|
|||||||
void SetBrush(CMap &ThisBrush);
|
void SetBrush(CMap &ThisBrush);
|
||||||
|
|
||||||
std::vector<CTileSet> TileSet;
|
std::vector<CTileSet> TileSet;
|
||||||
int CurrentSet;
|
int CurrentSet,LastSet;
|
||||||
CMap Brush[2];
|
CMap Brush[2];
|
||||||
int ActiveBrush;
|
int ActiveBrush;
|
||||||
int SelStart,SelEnd;
|
int SelStart,SelEnd;
|
||||||
@ -96,7 +98,7 @@ private:
|
|||||||
class CTileSet
|
class CTileSet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CTileSet(char *_Filename,int Idx);
|
CTileSet(const char *_Filename,int Idx);
|
||||||
~CTileSet();
|
~CTileSet();
|
||||||
|
|
||||||
int IsLoaded() {return(Loaded);}
|
int IsLoaded() {return(Loaded);}
|
||||||
|
@ -9,12 +9,13 @@
|
|||||||
#define IDR_TOOLBAR 128
|
#define IDR_TOOLBAR 128
|
||||||
#define IDR_MAPEDITYPE 129
|
#define IDR_MAPEDITYPE 129
|
||||||
#define IDD_LAYER_LIST_DIALOG 147
|
#define IDD_LAYER_LIST_DIALOG 147
|
||||||
#define IDD_LAYERTILE_GUI 148
|
|
||||||
#define IDI_PAINT 152
|
#define IDI_PAINT 152
|
||||||
#define IDI_SELECT 153
|
#define IDI_SELECT 153
|
||||||
#define IDD_MAPSIZE 167
|
#define IDD_MAPSIZE 167
|
||||||
#define IDD_NEW_LAYER 168
|
|
||||||
#define IDD_NEWMAP 169
|
#define IDD_NEWMAP 169
|
||||||
|
#define IDD_ADDLAYER 172
|
||||||
|
#define IDD_LAYERTILE_GUI 173
|
||||||
|
#define IDD_LAYERTILE_TOOLBAR 174
|
||||||
#define IDC_TOOLBAR_COMBO 1018
|
#define IDC_TOOLBAR_COMBO 1018
|
||||||
#define IDC_LAYER_LIST 1019
|
#define IDC_LAYER_LIST 1019
|
||||||
#define IDD_LAYERTILE_BTN_UPDATE 1029
|
#define IDD_LAYERTILE_BTN_UPDATE 1029
|
||||||
@ -28,21 +29,9 @@
|
|||||||
#define IDC_MAPSIZE_HEIGHT_TEXT 1039
|
#define IDC_MAPSIZE_HEIGHT_TEXT 1039
|
||||||
#define IDC_MAPSIZE_HEIGHT 1040
|
#define IDC_MAPSIZE_HEIGHT 1040
|
||||||
#define IDC_MAPSIZE_WARNING 1041
|
#define IDC_MAPSIZE_WARNING 1041
|
||||||
#define IDC_NEW_LAYER_TYPE_LIST 1042
|
|
||||||
#define IDC_NEW_LAYER_TYPE_NAME 1043
|
|
||||||
#define IDC_NEW_LAYER_WIDTH_NAME 1044
|
|
||||||
#define IDC_NEW_LAYER_HEIGHT_NAME 1045
|
|
||||||
#define IDC_NEW_LAYER_WIDTH_EDIT 1046
|
|
||||||
#define IDC_NEW_LAYER_HEIGHT_EDIT 1047
|
|
||||||
#define IDC_NEWMAP_BACK_CHECK 1047
|
|
||||||
#define IDC_NEW_LAYER_NAME_NAME 1048
|
|
||||||
#define IDC_NEW_LAYER_NAME_EDIT 1049
|
|
||||||
#define IDC_NEWMAP_MID_CHECK 1050
|
|
||||||
#define IDC_NEWMAP_FORE_CHECK 1051
|
|
||||||
#define IDC_NEW_LAYER_WIDTH_NAME2 1052
|
|
||||||
#define IDC_NEW_LAYER_WIDTH_EDIT2 1053
|
|
||||||
#define IDC_LAYERLIST_ADD 1056
|
#define IDC_LAYERLIST_ADD 1056
|
||||||
#define IDC_LAYERLIST_DELETE 1057
|
#define IDC_LAYERLIST_DELETE 1057
|
||||||
|
#define IDC_ADDLAYER_LIST 1058
|
||||||
#define ID_TOOLBAR_LAYERBAR 32773
|
#define ID_TOOLBAR_LAYERBAR 32773
|
||||||
#define ID_TOOLBAR_TILEPALETTE 32774
|
#define ID_TOOLBAR_TILEPALETTE 32774
|
||||||
#define ID_TOOLBAR_COMBO 32777
|
#define ID_TOOLBAR_COMBO 32777
|
||||||
@ -68,9 +57,9 @@
|
|||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_3D_CONTROLS 1
|
#define _APS_3D_CONTROLS 1
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 172
|
#define _APS_NEXT_RESOURCE_VALUE 173
|
||||||
#define _APS_NEXT_COMMAND_VALUE 32799
|
#define _APS_NEXT_COMMAND_VALUE 32799
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1057
|
#define _APS_NEXT_CONTROL_VALUE 1059
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Loading…
Reference in New Issue
Block a user