This commit is contained in:
parent
2518a438e2
commit
23d9f79f4c
11 changed files with 283 additions and 164 deletions
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
|
|
||||||
BOOL Test3dFlag=TRUE;
|
BOOL Test3dFlag=TRUE;
|
||||||
GLint TestTile;
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -32,16 +31,20 @@ GLint TestTile;
|
||||||
CCore::CCore()
|
CCore::CCore()
|
||||||
{
|
{
|
||||||
MouseMode=MOUSE_MODE_NONE;
|
MouseMode=MOUSE_MODE_NONE;
|
||||||
Layers[LAYER_TYPE_BACK]= new CLayerBack;
|
Layers[LAYER_TYPE_BACK]= new CLayerBack(this);
|
||||||
Layers[LAYER_TYPE_MID]= new CLayerMid;
|
Layers[LAYER_TYPE_MID]= new CLayerMid(this);
|
||||||
Layers[LAYER_TYPE_ACTION]= new CLayerAction;
|
Layers[LAYER_TYPE_ACTION]= new CLayerAction(this);
|
||||||
Layers[LAYER_TYPE_FORE]= new CLayerFore;
|
Layers[LAYER_TYPE_FORE]= new CLayerFore(this);
|
||||||
|
|
||||||
|
TileViewFlag=0;
|
||||||
|
LayerViewFlag=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CCore::~CCore()
|
CCore::~CCore()
|
||||||
{
|
{
|
||||||
for (int i=0; i<LAYER_TYPE_MAX; i++) delete Layers[i];
|
int i;
|
||||||
|
for (i=0; i<LAYER_TYPE_MAX; i++) delete Layers[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -49,22 +52,25 @@ void CCore::Init(CMapEditView *Wnd)
|
||||||
{
|
{
|
||||||
ParentWindow=Wnd;
|
ParentWindow=Wnd;
|
||||||
ActiveLayer=0;
|
ActiveLayer=0;
|
||||||
CamPos.x=CamPos.y=CamPos.z=0;
|
MapCam=Vec(0,0,0);
|
||||||
UpdateView(0,0,0);
|
TileCam=Vec(0,0,0);
|
||||||
CTileSet NewSet("c:/temp/2/test.gin",this);
|
UpdateView();
|
||||||
TileSet.push_back(NewSet);
|
|
||||||
|
|
||||||
|
TileSet.push_back(CTileSet("c:/temp/3/test.gin",this));
|
||||||
|
TRACE1("%i\n",TileSet.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::Render()
|
void CCore::Render()
|
||||||
{
|
{
|
||||||
// theApp.SetTileView(TRUE);
|
Vec &ThisCam=GetCam();
|
||||||
|
|
||||||
if (GetTileView())
|
if (GetTileView())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -73,23 +79,13 @@ void CCore::Render()
|
||||||
if (i==LAYER_TYPE_ACTION)
|
if (i==LAYER_TYPE_ACTION)
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
Layers[i]->Render(CamPos,Test3dFlag);
|
Layers[i]->Render(ThisCam,Test3dFlag);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ParentWindow->Invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::UpdateView(float XOfs,float YOfs,float ZOfs)
|
|
||||||
{
|
|
||||||
CamPos=CamPos+Vec(XOfs,YOfs,ZOfs);
|
|
||||||
if (CamPos.z>-1) CamPos.z=-1;
|
|
||||||
|
|
||||||
ParentWindow->Invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Control *****************************************************************/
|
/*** Control *****************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -106,25 +102,24 @@ void CCore::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
void CCore::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||||
{
|
{
|
||||||
// Test3dFlag=!Test3dFlag;
|
|
||||||
UpdateView(0,0,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::MouseWheel(UINT nFlags, short zDelta, CPoint &pt)
|
void CCore::MouseWheel(UINT nFlags, short zDelta, CPoint &pt)
|
||||||
{
|
{
|
||||||
if (zDelta>0)
|
if (zDelta>0)
|
||||||
UpdateView(0,0,1.0f);
|
UpdateView(Vec(0,0,1.0f));
|
||||||
else
|
else
|
||||||
UpdateView(0,0,-1.0f);
|
UpdateView(Vec(0,0,-1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::MouseMove(UINT nFlags, CPoint &point)
|
void CCore::MouseMove(UINT nFlags, CPoint &point)
|
||||||
{
|
{
|
||||||
float XOfs=0;
|
Vec Ofs(0,0,0);
|
||||||
float YOfs=0;
|
//float XOfs=0;
|
||||||
|
//float YOfs=0;
|
||||||
|
Vec &ThisCam=GetCam();
|
||||||
// check if active doc
|
// check if active doc
|
||||||
if (theApp.GetCurrent()!=ParentWindow->GetDocument()) return;
|
if (theApp.GetCurrent()!=ParentWindow->GetDocument()) return;
|
||||||
|
|
||||||
|
@ -137,85 +132,109 @@ float YOfs=0;
|
||||||
RECT ThisRect;
|
RECT ThisRect;
|
||||||
|
|
||||||
ParentWindow->GetWindowRect(&ThisRect);
|
ParentWindow->GetWindowRect(&ThisRect);
|
||||||
XS=CamPos.z*2;//*Layers[ActiveLayer]->GetLayerZPos();
|
XS=ThisCam.z*2;//*Layers[ActiveLayer]->GetLayerZPos();
|
||||||
YS=CamPos.z*2;//*Layers[ActiveLayer]->GetLayerZPos();
|
YS=ThisCam.z*2;//*Layers[ActiveLayer]->GetLayerZPos();
|
||||||
XS/=((ThisRect.right-ThisRect.left));
|
XS/=((ThisRect.right-ThisRect.left));
|
||||||
YS/=((ThisRect.bottom-ThisRect.top));
|
YS/=((ThisRect.bottom-ThisRect.top));
|
||||||
|
|
||||||
XOfs=LastMousePos.x-CurrentMousePos.x;
|
Ofs.x=LastMousePos.x-CurrentMousePos.x;
|
||||||
YOfs=LastMousePos.y-CurrentMousePos.y;
|
Ofs.y=LastMousePos.y-CurrentMousePos.y;
|
||||||
LastMousePos=CurrentMousePos;
|
LastMousePos=CurrentMousePos;
|
||||||
|
|
||||||
XOfs*=XS;
|
Ofs.x*=XS;
|
||||||
YOfs*=YS;
|
Ofs.y*=YS;
|
||||||
|
|
||||||
TRACE2("Move %i %i \n",point.x,point.y);
|
TRACE2("Move %i %i \n",point.x,point.y);
|
||||||
UpdateView(+XOfs,-YOfs,0);
|
UpdateView(Ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Layer Code **************************************************************/
|
/*** Layers ******************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::LayerSetActive(int i)
|
void CCore::UpdateLayerBar(BOOL ViewFlag)
|
||||||
{
|
{
|
||||||
}
|
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
|
CToolBar *ToolBar=Frm->GetToolBar();
|
||||||
|
CDialogBar *LayerBar=Frm->GetLayerBar();
|
||||||
|
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
||||||
|
|
||||||
/*****************************************************************************/
|
LayerViewFlag=ViewFlag;
|
||||||
int CCore::LayerGetActive()
|
if (LayerViewFlag)
|
||||||
{
|
{
|
||||||
return(ActiveLayer);
|
Dlg->ResetContent();
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
for (int i=0;i<LAYER_TYPE_MAX;i++)
|
||||||
CLayer *CCore::LayerGet(int i)
|
|
||||||
{
|
{
|
||||||
return(Layers[i]);
|
CLayer *ThisLayer=GetLayer(i);
|
||||||
|
Dlg->AddString(ThisLayer->GetName());
|
||||||
|
}
|
||||||
|
Dlg->SetCurSel(ActiveLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_LAYERBAR,LayerViewFlag);
|
||||||
|
Frm->ShowControlBar(LayerBar, LayerViewFlag, FALSE);
|
||||||
|
// UpdateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
void CCore::SetActiveLayer(int i)
|
||||||
|
{
|
||||||
|
UpdateLayerBar(LayerViewFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*** TileBank ****************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::SetTileView(BOOL f)
|
void CCore::UpdateTileView(BOOL ViewFlag)
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
CToolBar *ToolBar=Frm->GetToolBar();
|
CToolBar *ToolBar=Frm->GetToolBar();
|
||||||
|
|
||||||
TileViewFlag=f;
|
TileViewFlag=ViewFlag;
|
||||||
ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_TILEPALETTE,TileViewFlag);
|
ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_TILEPALETTE,TileViewFlag);
|
||||||
|
UpdateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::ToggleTileView()
|
GLint CCore::GetTile(int Bank,int TileNo)
|
||||||
{
|
{
|
||||||
SetTileView(!TileViewFlag);
|
TRACE1("%i\n",TileSet.size());
|
||||||
|
return(TileSet[Bank].GetTile(TileNo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*** Misc ********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
Vec &CCore::GetCam()
|
||||||
void CCore::SetLayerPalette(BOOL f)
|
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
if (GetTileView())
|
||||||
CToolBar *ToolBar=Frm->GetToolBar();
|
return(TileCam);
|
||||||
CDialogBar *LayerPalette=Frm->GetLayerBar();
|
else
|
||||||
|
return(MapCam);
|
||||||
|
|
||||||
LayerPaletteFlag=f;
|
|
||||||
ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_LAYERBAR,LayerPaletteFlag);
|
|
||||||
Frm->ShowControlBar(LayerPalette, LayerPaletteFlag, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::ToggleLayerPalette()
|
void CCore::UpdateAll()
|
||||||
{
|
{
|
||||||
SetLayerPalette(!LayerPaletteFlag);
|
UpdateView();
|
||||||
|
UpdateLayerBar(LayerViewFlag);
|
||||||
|
UpdateTileView(TileViewFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
void CCore::UpdateView(Vec Ofs)
|
||||||
|
{
|
||||||
|
Vec &ThisCam=GetCam();
|
||||||
|
|
||||||
|
ThisCam=ThisCam+Ofs;
|
||||||
|
if (ThisCam.z>-1) ThisCam.z=-1;
|
||||||
|
|
||||||
|
ParentWindow->Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,10 @@ class CCore
|
||||||
public:
|
public:
|
||||||
CCore();
|
CCore();
|
||||||
~CCore();
|
~CCore();
|
||||||
|
|
||||||
|
void Init(CMapEditView *Wnd);
|
||||||
|
void Render();
|
||||||
|
|
||||||
// Control
|
// Control
|
||||||
void LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
void LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
||||||
void MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
void MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
||||||
|
@ -39,36 +43,37 @@ public:
|
||||||
void MouseWheel(UINT nFlags, short zDelta, CPoint &pt);
|
void MouseWheel(UINT nFlags, short zDelta, CPoint &pt);
|
||||||
void MouseMove(UINT nFlags, CPoint &point);
|
void MouseMove(UINT nFlags, CPoint &point);
|
||||||
|
|
||||||
// Blah
|
// TileBank
|
||||||
void Init(CMapEditView *Wnd);
|
void UpdateTileView(BOOL ViewFlag);
|
||||||
void Render();
|
|
||||||
void UpdateView(float XOfs,float YOfs,float ZOfs);
|
|
||||||
void SetMouseMode(MOUSE_MODE CurrentMode,MOUSE_MODE NewMode);
|
|
||||||
|
|
||||||
Vec &GetCamPos() {return(CamPos);}
|
|
||||||
|
|
||||||
void SetTileView(BOOL f);
|
|
||||||
BOOL GetTileView() {return(TileViewFlag);}
|
BOOL GetTileView() {return(TileViewFlag);}
|
||||||
void ToggleTileView();
|
void ToggleTileView() {UpdateTileView(!TileViewFlag);}
|
||||||
|
|
||||||
void SetLayerPalette(BOOL f);
|
GLint GetTile(int Bank,int TileNo);
|
||||||
BOOL GetLayerPalette() {return(LayerPaletteFlag);}
|
|
||||||
void ToggleLayerPalette();
|
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
void LayerSetActive(int Layer);
|
void UpdateLayerBar(BOOL ViewFlag);
|
||||||
int LayerGetActive();
|
BOOL GetLayerViewFlag() {return(LayerViewFlag);}
|
||||||
CLayer *LayerGet(int i);
|
void ToggleLayerView() {UpdateLayerBar(!LayerViewFlag);}
|
||||||
|
|
||||||
|
void SetActiveLayer(int Layer);
|
||||||
|
int GetActiveLayer() {return(ActiveLayer);}
|
||||||
|
CLayer *GetLayer(int i) {return(Layers[i]);}
|
||||||
|
|
||||||
// Tex Cache
|
// Tex Cache
|
||||||
CTexCache &GetTexCache() {return(TexCache);}
|
CTexCache &GetTexCache() {return(TexCache);}
|
||||||
|
|
||||||
|
// Misc
|
||||||
|
void UpdateAll();
|
||||||
|
void UpdateView(Vec Ofs=Vec(0,0,0));
|
||||||
|
|
||||||
|
Vec &GetCam();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMapEditView *ParentWindow;
|
CMapEditView *ParentWindow;
|
||||||
MOUSE_MODE MouseMode;
|
MOUSE_MODE MouseMode;
|
||||||
CPoint CurrentMousePos,LastMousePos;
|
CPoint CurrentMousePos,LastMousePos;
|
||||||
Vec CamPos;
|
Vec MapCam,TileCam;
|
||||||
|
|
||||||
CLayer *Layers[LAYER_TYPE_MAX];
|
CLayer *Layers[LAYER_TYPE_MAX];
|
||||||
int ActiveLayer;
|
int ActiveLayer;
|
||||||
|
@ -77,7 +82,7 @@ private:
|
||||||
CTexCache TexCache;
|
CTexCache TexCache;
|
||||||
|
|
||||||
BOOL TileViewFlag;
|
BOOL TileViewFlag;
|
||||||
BOOL LayerPaletteFlag;
|
BOOL LayerViewFlag;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
//#include "MapEditDoc.h"
|
//#include "MapEditDoc.h"
|
||||||
//#include "MapEditView.h"
|
//#include "MapEditView.h"
|
||||||
|
|
||||||
|
#include "Core.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CLayer::CLayer()
|
CLayer::CLayer(CCore *_Core)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +30,16 @@ CLayer::~CLayer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayer::InitLayer(CCore *_Core)
|
||||||
|
{
|
||||||
|
int Width=Map.GetWidth();
|
||||||
|
int Height=Map.GetHeight();
|
||||||
|
|
||||||
|
Core=_Core;
|
||||||
|
TRACE3("%i x %i = %i\t",Width,Height,Width*Height);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayer::Render(Vec &MapPos,BOOL Is3d)
|
void CLayer::Render(Vec &MapPos,BOOL Is3d)
|
||||||
{
|
{
|
||||||
|
@ -39,22 +50,23 @@ void CLayer::Render(Vec &MapPos,BOOL Is3d)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
extern GLint TestTile;
|
|
||||||
|
|
||||||
void CLayer::Render2d(Vec &MapPos)
|
void CLayer::Render2d(Vec &MapPos)
|
||||||
{
|
{
|
||||||
float XYDiv=GetLayerZPosDiv();
|
float XYDiv=GetLayerZPosDiv();
|
||||||
return;
|
return;
|
||||||
|
int Width=Map.GetWidth();
|
||||||
|
int Height=Map.GetHeight();
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z);
|
glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z);
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
SetTestColor();
|
SetTestColor();
|
||||||
BuildGLQuad(-1,LayerWidth+1,-1,0,0); // Bottom
|
BuildGLQuad(-1,Width+1,-1,0,0); // Bottom
|
||||||
BuildGLQuad(-1,LayerWidth+1,LayerHeight+1,LayerHeight,0); // Top
|
BuildGLQuad(-1,Width+1,Height+1,Height,0); // Top
|
||||||
BuildGLQuad(-1,0,LayerHeight,0,0); // Left
|
BuildGLQuad(-1,0,Height,0,0); // Left
|
||||||
BuildGLQuad(LayerWidth,LayerWidth+1,LayerHeight,0,0); // Right
|
BuildGLQuad(Width,Width+1,Height,0,0); // Right
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,14 +77,31 @@ float asd=0;
|
||||||
void CLayer::Render3d(Vec &MapPos)
|
void CLayer::Render3d(Vec &MapPos)
|
||||||
{
|
{
|
||||||
float XYDiv=GetLayerZPosDiv();
|
float XYDiv=GetLayerZPosDiv();
|
||||||
|
float X,Y;
|
||||||
|
int XX=0;
|
||||||
|
int YY=0;
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
|
||||||
glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z);
|
|
||||||
glRotatef(asd,0,1,0);
|
|
||||||
asd+=0.5;
|
|
||||||
|
|
||||||
glCallList(TestTile);
|
Y=MapPos.y;
|
||||||
|
|
||||||
|
for (YY=0; YY<3; YY++)
|
||||||
|
{
|
||||||
|
X=MapPos.x;
|
||||||
|
for (XX=0; XX<3; XX++)
|
||||||
|
{
|
||||||
|
glLoadIdentity();
|
||||||
|
glTranslatef(X/XYDiv,Y/XYDiv,MapPos.z);
|
||||||
|
// glRotatef(asd,0,1,0);
|
||||||
|
// asd+=0.5;
|
||||||
|
// glCallList(Core->GetTile(0,2));
|
||||||
|
glCallList(Core->GetTile(0,XX+(YY*3)));
|
||||||
|
|
||||||
|
X+=1.0f;
|
||||||
|
}
|
||||||
|
Y+=1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <Vector>
|
#include <Vector>
|
||||||
#include "gl3d.h"
|
#include "gl3d.h"
|
||||||
|
#include "Map.h"
|
||||||
|
|
||||||
enum LAYER_TYPE
|
enum LAYER_TYPE
|
||||||
{
|
{
|
||||||
|
@ -18,15 +19,26 @@ enum LAYER_TYPE
|
||||||
LAYER_TYPE_MAX
|
LAYER_TYPE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct sMapElem
|
||||||
|
{
|
||||||
|
int Bank;
|
||||||
|
int Tile;
|
||||||
|
int Flags;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
class CCore;
|
||||||
|
class CMap;
|
||||||
class CLayer
|
class CLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLayer();
|
CLayer(){ASSERT(1);}
|
||||||
|
CLayer(CCore *_Core);
|
||||||
~CLayer();
|
~CLayer();
|
||||||
|
|
||||||
|
void InitLayer(CCore *_Core);
|
||||||
|
|
||||||
// Virtual
|
// Virtual
|
||||||
virtual void Init()=0;
|
virtual void Init()=0;
|
||||||
|
@ -43,8 +55,14 @@ virtual void SetTestColor()=0;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float LayerWidth,LayerHeight;
|
// float Width,Height;
|
||||||
|
CCore *Core;
|
||||||
|
// std::vector< std::vector<sMapElem> > Map;
|
||||||
|
// sMapElem *Map;
|
||||||
|
CMap Map;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
#endif
|
#endif
|
||||||
|
|
53
Utils/MapEdit/Map.cpp
Normal file
53
Utils/MapEdit/Map.cpp
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/******************/
|
||||||
|
/*** Map Stuph ***/
|
||||||
|
/*****************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "Map.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
int CMap::GetWidth()
|
||||||
|
{
|
||||||
|
return(Map.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
int CMap::GetHeight()
|
||||||
|
{
|
||||||
|
return(Map[0].size());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CMap::SetSize(int Width,int Height)
|
||||||
|
{
|
||||||
|
Map.resize(Width);
|
||||||
|
for (int i=0;i<Width;i++)
|
||||||
|
{
|
||||||
|
Map[i].resize(Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int Y=0;Y<Height;Y++)
|
||||||
|
for (int X=0;X<Width;X++)
|
||||||
|
{
|
||||||
|
TRACE2("%i,%i\n",X,Y);
|
||||||
|
Map[X][Y].Bank=0;
|
||||||
|
Map[X][Y].Tile=(X+Y)%9;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CMap::SetWidth(int Width)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CMap::SetHeight(int Height)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
37
Utils/MapEdit/Map.h
Normal file
37
Utils/MapEdit/Map.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/******************/
|
||||||
|
/*** Map Stuph ***/
|
||||||
|
/*****************/
|
||||||
|
|
||||||
|
#ifndef __MAP_HEADER__
|
||||||
|
#define __MAP_HEADER__
|
||||||
|
|
||||||
|
#include <Vector>
|
||||||
|
|
||||||
|
struct sMapElem
|
||||||
|
{
|
||||||
|
int Bank;
|
||||||
|
int Tile;
|
||||||
|
int Flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
class CMap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMap(){};
|
||||||
|
~CMap(){};
|
||||||
|
|
||||||
|
int GetWidth();
|
||||||
|
int GetHeight();
|
||||||
|
|
||||||
|
void SetSize(int Width,int Height);
|
||||||
|
void SetWidth(int Width);
|
||||||
|
void SetHeight(int Height);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector< std::vector<sMapElem> > Map;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
#endif
|
|
@ -143,6 +143,14 @@ SOURCE=.\Core.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Map.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Map.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\TexCache.cpp
|
SOURCE=.\TexCache.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -123,47 +123,7 @@ CMapEditDoc *CurDoc=GetDocument();
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void CMapEditView::UpdateAll()
|
void CMapEditView::UpdateAll()
|
||||||
{
|
{
|
||||||
UpdateLayerBar();
|
Core.UpdateAll();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
void CMapEditView::UpdateLayerBar()
|
|
||||||
{
|
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
|
||||||
CDialogBar *LayerBar=Frm->GetLayerBar();
|
|
||||||
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
|
||||||
int CurSel=Dlg->GetCurSel();
|
|
||||||
|
|
||||||
Dlg->ResetContent();
|
|
||||||
|
|
||||||
for (int i=0;i<LAYER_TYPE_MAX;i++)
|
|
||||||
{
|
|
||||||
CLayer *ThisLayer=Core.LayerGet(i);
|
|
||||||
Dlg->AddString(ThisLayer->GetName());
|
|
||||||
}
|
|
||||||
Dlg->SetCurSel(CurSel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
int CMapEditView::GetLayerCurSel()
|
|
||||||
{
|
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
|
||||||
CDialogBar *LayerBar=Frm->GetLayerBar();
|
|
||||||
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
|
||||||
return(Dlg->GetCurSel());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
int CMapEditView::GetLayerCount()
|
|
||||||
{
|
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
|
||||||
CDialogBar *LayerBar=Frm->GetLayerBar();
|
|
||||||
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
|
||||||
return(Dlg->GetCount());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
@ -178,14 +138,5 @@ void CMapEditView::OnRButtonDown(UINT nFlags, CPoint point) {Core.RButtonCont
|
||||||
void CMapEditView::OnRButtonUp(UINT nFlags, CPoint point) {Core.RButtonControl(nFlags,point,FALSE);}
|
void CMapEditView::OnRButtonUp(UINT nFlags, CPoint point) {Core.RButtonControl(nFlags,point,FALSE);}
|
||||||
void CMapEditView::OnMouseMove(UINT nFlags, CPoint point) {Core.MouseMove(nFlags, point);}
|
void CMapEditView::OnMouseMove(UINT nFlags, CPoint point) {Core.MouseMove(nFlags, point);}
|
||||||
|
|
||||||
|
void CMapEditView::OnToolbarLayerbar() {Core.ToggleLayerView();}
|
||||||
|
void CMapEditView::OnToolbarTilepalette() {Core.ToggleTileView();}
|
||||||
void CMapEditView::OnToolbarLayerbar()
|
|
||||||
{
|
|
||||||
Core.ToggleLayerPalette();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMapEditView::OnToolbarTilepalette()
|
|
||||||
{
|
|
||||||
Core.ToggleTileView();
|
|
||||||
}
|
|
||||||
|
|
|
@ -38,9 +38,6 @@ public:
|
||||||
virtual void Dump(CDumpContext& dc) const;
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
#endif
|
#endif
|
||||||
void UpdateAll();
|
void UpdateAll();
|
||||||
void UpdateLayerBar();
|
|
||||||
int GetLayerCurSel();
|
|
||||||
int GetLayerCount();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void VideoMode(ColorsNumber &c,ZAccuracy &z,BOOL &dbuf);
|
void VideoMode(ColorsNumber &c,ZAccuracy &z,BOOL &dbuf);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// or project specific include files that are used frequently, but
|
// or project specific include files that are used frequently, but
|
||||||
// are changed infrequently
|
// are changed infrequently
|
||||||
//
|
//
|
||||||
|
#pragma warning( disable : 4786 )
|
||||||
|
|
||||||
#if !defined(AFX_STDAFX_H__67922BC1_781B_4EBB_86D3_B87FA7642774__INCLUDED_)
|
#if !defined(AFX_STDAFX_H__67922BC1_781B_4EBB_86D3_B87FA7642774__INCLUDED_)
|
||||||
#define AFX_STDAFX_H__67922BC1_781B_4EBB_86D3_B87FA7642774__INCLUDED_
|
#define AFX_STDAFX_H__67922BC1_781B_4EBB_86D3_B87FA7642774__INCLUDED_
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
int Load(CCore *Core,char *_Filename);
|
int Load(CCore *Core,char *_Filename);
|
||||||
char *GetPath() {return(Path);}
|
char *GetPath() {return(Path);}
|
||||||
char *GetFilename() {return(Filename);}
|
char *GetFilename() {return(Filename);}
|
||||||
|
GLint GetTile(int No) {return(Tile[No].GetTile());}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char Path[256];
|
char Path[256];
|
||||||
|
|
Loading…
Add table
Reference in a new issue