This commit is contained in:
Daveo 2000-11-15 21:22:40 +00:00
parent acd5ab37c0
commit 7ac13dc8b8
17 changed files with 599 additions and 275 deletions

View file

@ -19,7 +19,6 @@
#include "Layer.h" #include "Layer.h"
#include "LayerTile.h" #include "LayerTile.h"
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
@ -35,11 +34,6 @@ CCore::CCore()
TileCam=Vec(0,0,0); TileCam=Vec(0,0,0);
Is3dFlag=TRUE; Is3dFlag=TRUE;
CurrentTileBank=0;
MouseTileL.Bank=0; MouseTileL.Tile=1;
MouseTileR.Bank=0; MouseTileR.Tile=1;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -48,6 +42,20 @@ CCore::~CCore()
for (int i=0; i<LAYER_TYPE_MAX; i++) if (Layers[i]) delete Layers[i]; for (int i=0; i<LAYER_TYPE_MAX; i++) if (Layers[i]) delete Layers[i];
} }
/*****************************************************************************/
void CCore::Init()
{
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
CMultiBar *ParamBar=Frm->GetParamBar();
ParamBar->RemoveAll();
// Add default parram bar items
ParamBar->Add(Frm->GetLayerList(),IDD_LAYER_LIST_DIALOG,TRUE,TRUE);
ParamBar->Add(Frm->GetTileSetDlg(),IDD_TILESET_DIALOG,TRUE,TRUE);
Layers[ActiveLayer]->InitGUI(this);
ParamBar->Update();
}
/*****************************************************************************/ /*****************************************************************************/
void CCore::NewMap() void CCore::NewMap()
{ {
@ -60,12 +68,10 @@ void CCore::NewMap()
ActiveLayer=LAYER_TYPE_ACTION; ActiveLayer=LAYER_TYPE_ACTION;
MapCam=Vec(0,0,0); MapCam=Vec(0,0,0);
TileCam=Vec(0,0,0); TileCam=Vec(0,0,0);
TileBank.AddTileSet("c:/temp/3/test.gin"); // TileBank.AddTileSet("c:/temp/3/test.gin");
// TileBank.AddTileSet("c:/temp/4/4.gin");
// TileBank.AddTileSet("c:/temp/slope/slope.gin"); // TileBank.AddTileSet("c:/temp/slope/slope.gin");
// TileBank.AddTileSet("c:/temp/2/2.gin"); Init();
// TileBank.AddTileSet("c:/temp/1/1.gin");
TileBank.AddTileSet("c:/temp/4/4.gin");
TileBank.AddTileSet("c:/temp/5/5.gin");
} }
/*****************************************************************************/ /*****************************************************************************/
@ -105,6 +111,7 @@ Vec &ThisCam=GetCam();
if (GridFlag) Layers[ActiveLayer]->RenderGrid(this,ThisCam); if (GridFlag) Layers[ActiveLayer]->RenderGrid(this,ThisCam);
// Get Cursor Pos // Get Cursor Pos
LastCursorPos=CursorPos;
Layers[ActiveLayer]->FindCursorPos(this,View,GetCam(),CurrentMousePos); Layers[ActiveLayer]->FindCursorPos(this,View,GetCam(),CurrentMousePos);
} }
@ -121,13 +128,31 @@ Vec &ThisCam=GetCam();
/*****************************************************************************/ /*****************************************************************************/
/*** Control *****************************************************************/ /*** Control *****************************************************************/
/*****************************************************************************/
void CCore::SetMode(int NewMode)
{
BOOL RedrawFlag=FALSE;
RedrawFlag=Layers[ActiveLayer]->SetMode(NewMode);
//if (RedrawFlag) View->Invalidate();
}
/*****************************************************************************/ /*****************************************************************************/
void CCore::LButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag) void CCore::LButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag)
{ {
BOOL RedrawFlag=FALSE;
if (TileViewFlag) if (TileViewFlag)
TileBank.LButtonControl(this,View,nFlags,point,DownFlag); {
RedrawFlag=TileBank.TileSelectL();
}
else else
; {
RedrawFlag=Layers[ActiveLayer]->LButtonControl(this,View,nFlags,CursorPos,DownFlag);
}
if (RedrawFlag) View->Invalidate();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -139,11 +164,18 @@ void CCore::MButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL Do
/*****************************************************************************/ /*****************************************************************************/
void CCore::RButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag) void CCore::RButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag)
{ {
if (TileViewFlag) BOOL RedrawFlag=FALSE;
TileBank.RButtonControl(this,View,nFlags,point,DownFlag);
else
;
if (TileViewFlag)
{
RedrawFlag=TileBank.TileSelectR();
}
else
{
RedrawFlag=Layers[ActiveLayer]->RButtonControl(this,View,nFlags,CursorPos,DownFlag);
}
if (RedrawFlag) View->Invalidate();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -190,10 +222,12 @@ Vec &ThisCam=GetCam();
else else
{ // Mouse still moved, so need to redraw windows, to get CursorPos (And pos render) { // Mouse still moved, so need to redraw windows, to get CursorPos (And pos render)
View->Invalidate(); View->Invalidate();
Layers[ActiveLayer]->MouseMove(this,View,nFlags,CursorPos);
} }
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Layers ******************************************************************/ /*** Layers ******************************************************************/
/*****************************************************************************/ /*****************************************************************************/
@ -203,29 +237,6 @@ CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
CToolBar *ToolBar=Frm->GetToolBar(); CToolBar *ToolBar=Frm->GetToolBar();
CMultiBar *ParamBar=Frm->GetParamBar(); CMultiBar *ParamBar=Frm->GetParamBar();
// ParamBar->ReCalc();
//CCheckListBox *Dlg=(CCheckListBox *)ParamBar->GetDlgItem(IDC_PARAMBAR_LAYER_LIST);
/*
ParamViewFlag=ViewFlag;
if (ParamViewFlag)
{
ParamBar->m_ListBox.ResetContent();
// Dlg->ResetContent();
for (int i=0;i<LAYER_TYPE_MAX;i++)
{
CLayer *ThisLayer=GetLayer(i);
ParamBar->m_ListBox.AddString(ThisLayer->GetName());
// Dlg->AddString(ThisLayer->GetName());
}
ParamBar->m_ListBox.SetCurSel(ActiveLayer);
// Dlg->SetCurSel(ActiveLayer);
}
*/
// ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_PARAMBAR,ParamViewFlag);
// Frm->ShowControlBar(ParamBar, ParamViewFlag, FALSE);
// ParamBar->ShowWindow(SW_SHOW);
// if (View) UpdateView(View);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -255,36 +266,36 @@ void CCore::UpdateTileView(CMapEditView *View,BOOL Toggle)
{ {
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd(); CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
CToolBar *ToolBar=Frm->GetToolBar(); CToolBar *ToolBar=Frm->GetToolBar();
CMultiBar *ParamBar=Frm->GetParamBar();
if (Toggle) if (Toggle) TileViewFlag=!TileViewFlag;
{ ParamBar->RemoveAll();
TileViewFlag=!TileViewFlag;
if (TileViewFlag)
TileBank.InitGUI(this);
else
Layers[ActiveLayer]->InitGUI(this);
}
ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_TILEPALETTE,TileViewFlag); ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_TILEPALETTE,TileViewFlag);
UpdateView(View); UpdateView(View);
} }
/*****************************************************************************/ /*****************************************************************************/
void CCore::ReloadTileBank() void CCore::TileBankLoad(char *Filename)
{
TileBank.AddTileSet(Filename);
TileBank.UpdateGUI(this,TileViewFlag);
UpdateView(NULL);
}
/*****************************************************************************/
void CCore::TileBankReload()
{ {
TileBank.Reload(); TileBank.Reload();
TexCache.Purge(); TexCache.Purge();
UpdateView(NULL); UpdateView(NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
void CCore::ChangeTileBank() void CCore::TileBankSet()
{ {
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd(); CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
CTileSetDlg *TileSetDlg=(CTileSetDlg*)Frm->GetDialog(IDD_TILESET_DIALOG); CTileSetDlg *TileSetDlg=(CTileSetDlg*)Frm->GetDialog(IDD_TILESET_DIALOG);
CurrentTileBank=TileSetDlg->TileSetList.GetCurSel(); TileBank.SetCurrent(TileSetDlg->TileSetList.GetCurSel());
} }
/*****************************************************************************/ /*****************************************************************************/
@ -305,9 +316,7 @@ void CCore::UpdateAll(CMapEditView *View)
UpdateView(View); UpdateView(View);
UpdateGrid(View); UpdateGrid(View);
if (TileViewFlag) TileBank.UpdateGUI(this,TileViewFlag);
TileBank.UpdateGUI(this);
else
Layers[ActiveLayer]->UpdateGUI(this); Layers[ActiveLayer]->UpdateGUI(this);
} }

View file

@ -14,7 +14,6 @@
#include "TileSet.h" #include "TileSet.h"
/*****************************************************************************/ /*****************************************************************************/
class CMapEditView; class CMapEditView;
class CCore class CCore
@ -31,6 +30,7 @@ public:
void RenderTileView(CMapEditView *View); void RenderTileView(CMapEditView *View);
// Control // Control
void SetMode(int NewMode);
void LButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag); void LButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag);
void MButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag); void MButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag);
void RButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag); void RButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag);
@ -40,14 +40,11 @@ public:
// TileBank // TileBank
void UpdateTileView(CMapEditView *View,BOOL Toggle=FALSE); void UpdateTileView(CMapEditView *View,BOOL Toggle=FALSE);
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 ReloadTileBank(); void TileBankLoad(char *Filename);
void ChangeTileBank(); void TileBankReload();
void TileBankSet();
int GetCurrentTileBank() {return(CurrentTileBank);}
void SetCurrentTileBank(int Bnk) {CurrentTileBank=Bnk;}
sMapElem &GetMouseTileL() {return(MouseTileL);}
sMapElem &GetMouseTileR() {return(MouseTileR);}
// Param Bar // Param Bar
void UpdateParamBar(CMapEditView *View,BOOL ViewFlag); void UpdateParamBar(CMapEditView *View,BOOL ViewFlag);
@ -81,14 +78,14 @@ private:
int ActiveLayer; int ActiveLayer;
CTileBank TileBank; CTileBank TileBank;
CTexCache TexCache; CTexCache TexCache;
int CurrentTileBank;
sMapElem MouseTileL,MouseTileR;
BOOL TileViewFlag; BOOL TileViewFlag;
BOOL GridFlag; BOOL GridFlag;
BOOL Is3dFlag; BOOL Is3dFlag;
}; };
/*****************************************************************************/ /*****************************************************************************/

View file

@ -49,7 +49,16 @@ virtual void FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &
virtual void InitGUI(CCore *Core)=0; virtual void InitGUI(CCore *Core)=0;
virtual void UpdateGUI(CCore *Core)=0; virtual void UpdateGUI(CCore *Core)=0;
// Functions
virtual BOOL SetMode(int NewMode)=0;
virtual BOOL InitMode()=0;
virtual BOOL ExitMode()=0;
virtual BOOL LButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &CursorPos,BOOL DownFlag)=0;
virtual BOOL RButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &CursorPos,BOOL DownFlag)=0;
virtual BOOL MouseMove(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &CursorPos)=0;
protected: protected:
char Name[256]; char Name[256];
BOOL Render3dFlag; BOOL Render3dFlag;
float ZPosDiv; float ZPosDiv;

View file

@ -28,9 +28,11 @@
CLayerTile::CLayerTile(char *_Name,int Width,int Height,float ZDiv,BOOL Is3d) CLayerTile::CLayerTile(char *_Name,int Width,int Height,float ZDiv,BOOL Is3d)
{ {
SetName(_Name); SetName(_Name);
Map.SetSize(Width,Height); Map.SetSize(Width,Height,TRUE);
ZPosDiv=ZDiv; ZPosDiv=ZDiv;
Render3dFlag=Is3d; Render3dFlag=Is3d;
Mode=MouseModePaint;
Flag=MouseFlagNone;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -81,7 +83,7 @@ CTexCache &TexCache=Core->GetTexCache();
for (int XLoop=0; XLoop<MapW; XLoop++) for (int XLoop=0; XLoop<MapW; XLoop++)
{ {
sMapElem &ThisElem=Map.GetTile(XLoop,YLoop); sMapElem &ThisElem=Map.GetTile(XLoop,YLoop);
CTile &ThisTile=Core->GetTile(ThisElem.Bank,ThisElem.Tile); CTile &ThisTile=Core->GetTile(ThisElem.Set,ThisElem.Tile);
glLoadIdentity(); // Slow way, but good to go for the mo glLoadIdentity(); // Slow way, but good to go for the mo
glTranslatef(StartX+XLoop,StartY-YLoop,CamPos.z); glTranslatef(StartX+XLoop,StartY-YLoop,CamPos.z);
@ -114,13 +116,16 @@ CTexCache &TexCache=Core->GetTexCache();
for (int XLoop=0; XLoop<MapW; XLoop++) for (int XLoop=0; XLoop<MapW; XLoop++)
{ {
sMapElem &ThisElem=Map.GetTile(XLoop,YLoop); sMapElem &ThisElem=Map.GetTile(XLoop,YLoop);
CTile &ThisTile=Core->GetTile(ThisElem.Bank,ThisElem.Tile); if (ThisElem.Tile)
{ // Render Non Zero Tiles
CTile &ThisTile=Core->GetTile(ThisElem.Set,ThisElem.Tile);
glLoadIdentity(); // Slow way, but good to go for the mo glLoadIdentity(); // Slow way, but good to go for the mo
glTranslatef(StartX+XLoop,StartY-YLoop,CamPos.z); glTranslatef(StartX+XLoop,StartY-YLoop,CamPos.z);
ThisTile.Render(); ThisTile.Render();
} }
} }
}
} }
@ -232,11 +237,160 @@ void CLayerTile::InitGUI(CCore *Core)
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd(); CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
CMultiBar *ParamBar=Frm->GetParamBar(); CMultiBar *ParamBar=Frm->GetParamBar();
ParamBar->RemoveAll(); ParamBar->Add(Frm->GetGfxToolBar(),IDD_GFXTOOLBAR,TRUE);
ParamBar->Update();
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerTile::UpdateGUI(CCore *Core) void CLayerTile::UpdateGUI(CCore *Core)
{ {
} }
/*****************************************************************************/
/*** Functions ***************************************************************/
/*****************************************************************************/
BOOL CLayerTile::SetMode(int NewMode)
{
BOOL Ret=FALSE;
// Clean up last mode
Ret|=ExitMode();
Mode=(MouseMode)NewMode;
Ret|=InitMode();
return(Ret);
}
/*****************************************************************************/
BOOL CLayerTile::InitMode()
{
switch(Mode)
{
case MouseModeNone:
break;
case MouseModePaint:
break;
case MouseModeSelect:
break;
case MouseModeBlockSelect:
break;
case MouseModePicker:
break;
default:
break;
}
return(FALSE);
}
/*****************************************************************************/
BOOL CLayerTile::ExitMode()
{
switch(Mode)
{
case MouseModeNone:
break;
case MouseModePaint:
break;
case MouseModeSelect:
break;
case MouseModeBlockSelect:
break;
case MouseModePicker:
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 MouseModeNone:
break;
case MouseModePaint:
if (DownFlag)
Ret=Paint(TileBank.GetLTile(),CursorPos);
break;
case MouseModeSelect:
break;
case MouseModeBlockSelect:
break;
case MouseModePicker:
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 MouseModeNone:
break;
case MouseModePaint:
if (DownFlag)
Ret=Paint(TileBank.GetRTile(),CursorPos);
break;
case MouseModeSelect:
break;
case MouseModeBlockSelect:
break;
case MouseModePicker:
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 MouseModeNone:
break;
case MouseModePaint:
if (nFlags & MK_LBUTTON)
Ret=Paint(TileBank.GetLTile(),CursorPos);
else
if (nFlags & MK_RBUTTON)
Ret=Paint(TileBank.GetRTile(),CursorPos);
break;
case MouseModeSelect:
break;
case MouseModeBlockSelect:
break;
case MouseModePicker:
break;
default:
break;
}
return(Ret);
}
/*****************************************************************************/
BOOL CLayerTile::Paint(sMapElem &Tile,CPoint &CursorPos)
{
if (CursorPos.y==-1 || CursorPos.y==-1) return(FALSE); // Off Map?
if (Tile.Set==-1 || Tile.Tile==-1) return(FALSE); // Invalid tile?
Map.SetTile(CursorPos.x,CursorPos.y,Tile);
return(TRUE);
}

View file

@ -7,11 +7,13 @@
#include "Layer.h" #include "Layer.h"
/*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
enum TileLayerEnum enum TileLayerEnum
{ {
TileLayerDefaultWidth=20, TileLayerDefaultWidth=30,
TileLayerDefaultHeight=12, TileLayerDefaultHeight=20,
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -21,6 +23,23 @@ class CLayerTile : public CLayer
{ {
public: public:
enum MouseMode
{
MouseModeNone=0,
MouseModePaint,
MouseModeSelect,
MouseModeBlockSelect,
MouseModePicker,
MouseModeMirrorX,
MouseModeMirrorY,
};
enum MouseFlag
{
MouseFlagNone=1<<0,
MouseFlagMirrorX=1<<1,
MouseFlagMirrorY=1<<2,
};
CLayerTile(char *_Name,int Width,int Height,float ZDiv,BOOL Is3d); // New Layer CLayerTile(char *_Name,int Width,int Height,float ZDiv,BOOL Is3d); // New Layer
CLayerTile(char *_Name); // Load Layer CLayerTile(char *_Name); // Load Layer
~CLayerTile(); ~CLayerTile();
@ -32,12 +51,24 @@ public:
void InitGUI(CCore *Core); void InitGUI(CCore *Core);
void UpdateGUI(CCore *Core); void UpdateGUI(CCore *Core);
// 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);
protected: protected:
void Render2d(CCore *Core,Vec &CamPos); void Render2d(CCore *Core,Vec &CamPos);
void Render3d(CCore *Core,Vec &CamPos); void Render3d(CCore *Core,Vec &CamPos);
BOOL Paint(sMapElem &Blk,CPoint &CursorPos);
CMap Map; CMap Map;
MouseMode Mode;
BOOL Flag;
}; };

View file

@ -67,9 +67,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
ParamBar.SetWindowText("Param"); ParamBar.SetWindowText("Param");
DockControlBar(&ParamBar); DockControlBar(&ParamBar);
ParamBar.Add(LayerList,IDD_LAYER_LIST_DIALOG,TRUE,TRUE); // Add default parram bar item
// ToolBar (plus extra code for extra controls!!) // ToolBar (plus extra code for extra controls!!)
if (!ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !ToolBar.LoadToolBar(IDR_MAINFRAME)) if (!ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !ToolBar.LoadToolBar(IDR_MAINFRAME))
{ {

View file

@ -8,6 +8,7 @@
#include "MultiBar.h" #include "MultiBar.h"
#include "LayerList.h" #include "LayerList.h"
#include "TileSetDlg.h" #include "TileSetDlg.h"
#include "GfxToolBar.h"
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
@ -39,7 +40,7 @@ public:
CMultiBar *GetParamBar() {return(&ParamBar);} CMultiBar *GetParamBar() {return(&ParamBar);}
CDialog &GetLayerList() {return(LayerList);} CDialog &GetLayerList() {return(LayerList);}
CDialog &GetTileSetDlg() {return(TileSetDlg);} CDialog &GetTileSetDlg() {return(TileSetDlg);}
CDialog &GetGfxToolBar() {return(GfxToolBar);}
// Operations // Operations
public: public:
@ -65,7 +66,7 @@ protected: // control bar embedded members
// Sub Dialogs // Sub Dialogs
CLayerList LayerList; CLayerList LayerList;
CTileSetDlg TileSetDlg; CTileSetDlg TileSetDlg;
CGfxToolBar GfxToolBar;
// Generated message map functions // Generated message map functions
protected: protected:
//{{AFX_MSG(CMainFrame) //{{AFX_MSG(CMainFrame)

View file

@ -13,19 +13,7 @@
/*****************************************************************************/ /*****************************************************************************/
int CMap::GetWidth() void CMap::SetSize(int Width,int Height,BOOL Clear)
{
return(Map.size());
}
/*****************************************************************************/
int CMap::GetHeight()
{
return(Map[0].size());
}
/*****************************************************************************/
void CMap::SetSize(int Width,int Height)
{ {
Map.resize(Width); Map.resize(Width);
for (int i=0;i<Width;i++) for (int i=0;i<Width;i++)
@ -33,11 +21,15 @@ void CMap::SetSize(int Width,int Height)
Map[i].resize(Height); Map[i].resize(Height);
} }
if (Clear)
{
for (int Y=0;Y<Height;Y++) for (int Y=0;Y<Height;Y++)
for (int X=0;X<Width;X++) for (int X=0;X<Width;X++)
{ {
Map[X][Y].Bank=0; Map[X][Y].Set=0;
Map[X][Y].Tile=(X+Y)%9; // Map[X][Y].Tile=(X+Y)%9;
Map[X][Y].Tile=0;
}
} }
} }
@ -52,6 +44,28 @@ void CMap::SetHeight(int Height)
{ {
} }
/*****************************************************************************/
void CMap::Clear()
{
int Width=GetWidth();
for (int i=0;i<Width;i++)
{
Map[i].clear();
}
Map.clear();
}
/*****************************************************************************/ /*****************************************************************************/
sMapElem &CMap::GetTile(int X,int Y)
{
return(Map[X][Y]);
}
/*****************************************************************************/
void CMap::SetTile(int X,int Y,sMapElem &New)
{
Map[X][Y]=New;
}

View file

@ -9,7 +9,7 @@
struct sMapElem struct sMapElem
{ {
int Bank; int Set;
int Tile; int Tile;
int Flags; int Flags;
}; };
@ -21,14 +21,16 @@ public:
CMap(){}; CMap(){};
~CMap(){}; ~CMap(){};
int GetWidth(); int GetWidth() {return(Map.size());}
int GetHeight(); int GetHeight() {return(Map[0].size());}
void SetSize(int Width,int Height); void SetSize(int Width,int Height,BOOL Clear=FALSE);
void SetWidth(int Width); void SetWidth(int Width);
void SetHeight(int Height); void SetHeight(int Height);
void Clear();
sMapElem &GetTile(int X,int Y) {return(Map[X][Y]);} sMapElem &GetTile(int X,int Y);
void SetTile(int X,int Y,sMapElem &New);
protected: protected:
std::vector< std::vector<sMapElem> > Map; std::vector< std::vector<sMapElem> > Map;

View file

@ -8,7 +8,7 @@ NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "mapedit.h" NewFileInclude2=#include "mapedit.h"
LastPage=0 LastPage=0
ClassCount=10 ClassCount=11
Class1=CChildFrame Class1=CChildFrame
Class2=CGLEnabledView Class2=CGLEnabledView
Class3=CMainFrame Class3=CMainFrame
@ -17,18 +17,20 @@ Class5=CAboutDlg
Class6=CMapEditDoc Class6=CMapEditDoc
Class7=CMapEditView Class7=CMapEditView
ResourceCount=8 ResourceCount=9
Resource1=IDR_TOOLBAR (English (U.S.)) Resource1=IDD_MULTIBAR (English (U.S.))
Resource2=IDR_MAPEDITYPE (English (U.S.)) Resource2=IDR_MAPEDITYPE (English (U.S.))
Resource3=IDR_MAINFRAME (English (U.S.)) Resource3=IDD_TILESET_DIALOG
Resource4=IDD_DIALOGBAR (English (U.S.)) Resource4=IDD_DIALOGBAR (English (U.S.))
Resource5=IDD_ABOUTBOX (English (U.S.)) Resource5=IDR_TOOLBAR (English (U.S.))
Class8=CMultiBar Class8=CMultiBar
Resource6=IDD_LAYER_LIST_DIALOG Resource6=IDD_ABOUTBOX (English (U.S.))
Resource7=IDD_MULTIBAR (English (U.S.)) Resource7=IDR_MAINFRAME (English (U.S.))
Class9=CLayerList Class9=CLayerList
Class10=CTileSetDlg Class10=CTileSetDlg
Resource8=IDD_TILESET_DIALOG Resource8=IDD_LAYER_LIST_DIALOG
Class11=CGfxToolBar
Resource9=IDD_GFXTOOLBAR
[CLS:CChildFrame] [CLS:CChildFrame]
Type=0 Type=0
@ -205,9 +207,10 @@ LastObject=CLayerList
[DLG:IDD_TILESET_DIALOG] [DLG:IDD_TILESET_DIALOG]
Type=1 Type=1
Class=CTileSetDlg Class=CTileSetDlg
ControlCount=2 ControlCount=3
Control1=IDC_TILESETDLG_COMBO,combobox,1342242819 Control1=IDC_TILESETDLG_COMBO,combobox,1342242819
Control2=IDC_TILESETDLG_BTN_UPDATE,button,1342242816 Control2=IDC_TILESETDLG_BTN_UPDATE,button,1342242816
Control3=IDC_TILESETDLG_BTN_LOAD,button,1342242816
[CLS:CTileSetDlg] [CLS:CTileSetDlg]
Type=0 Type=0
@ -216,5 +219,24 @@ ImplementationFile=TileSetDlg.cpp
BaseClass=CDialog BaseClass=CDialog
Filter=D Filter=D
VirtualFilter=dWC VirtualFilter=dWC
LastObject=IDC_TILESETDLG_COMBO LastObject=IDC_TILESETDLG_BTN_LOAD
[CLS:CGfxToolBar]
Type=0
HeaderFile=GfxToolBar.h
ImplementationFile=GfxToolBar.cpp
BaseClass=CDialog
Filter=D
LastObject=IDD_GFXTOOLBAR_MIRRORX
VirtualFilter=dWC
[DLG:IDD_GFXTOOLBAR]
Type=1
Class=CGfxToolBar
ControlCount=5
Control1=IDD_GFXTOOLBAR_PAINT,button,1342242816
Control2=IDD_GFXTOOLBAR_SELECT,button,1342242816
Control3=IDD_GFXTOOLBAR_PICKER,button,1342242816
Control4=IDD_GFXTOOLBAR_MIRRORX,button,1342242816
Control5=IDD_GFXTOOLBAR_MIRRORY,button,1342242816

View file

@ -243,6 +243,14 @@ SOURCE=.\StdAfx.h
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File # Begin Source File
SOURCE=.\res\ico00001.ico
# End Source File
# Begin Source File
SOURCE=.\res\icon1.ico
# End Source File
# Begin Source File
SOURCE=.\res\MapEdit.ico SOURCE=.\res\MapEdit.ico
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -255,6 +263,30 @@ SOURCE=.\res\MapEditDoc.ico
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\res\mirrorx.ico
# End Source File
# Begin Source File
SOURCE=.\res\mirrory.ico
# End Source File
# Begin Source File
SOURCE=.\res\paint.ico
# End Source File
# Begin Source File
SOURCE=.\res\paint1.ico
# End Source File
# Begin Source File
SOURCE=.\res\paint2.ico
# End Source File
# Begin Source File
SOURCE=.\res\picker.ico
# End Source File
# Begin Source File
SOURCE=.\res\Toolbar.bmp SOURCE=.\res\Toolbar.bmp
# End Source File # End Source File
# End Group # End Group
@ -263,6 +295,14 @@ SOURCE=.\res\Toolbar.bmp
# PROP Default_Filter "" # PROP Default_Filter ""
# Begin Source File # Begin Source File
SOURCE=.\GfxToolBar.cpp
# End Source File
# Begin Source File
SOURCE=.\GfxToolBar.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

View file

@ -408,6 +408,19 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252) #pragma code_page(1252)
#endif //_WIN32 #endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_PAINT ICON DISCARDABLE "res\\paint.ico"
IDI_SELECT ICON DISCARDABLE "res\\paint1.ico"
IDI_PICKER ICON DISCARDABLE "res\\picker.ico"
IDI_MIRRORX ICON DISCARDABLE "res\\mirrorx.ico"
IDI_MIRRORY ICON DISCARDABLE "res\\mirrory.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Dialog // Dialog
@ -428,7 +441,19 @@ FONT 8, "MS Sans Serif"
BEGIN BEGIN
COMBOBOX IDC_TILESETDLG_COMBO,7,7,138,322,CBS_DROPDOWNLIST | COMBOBOX IDC_TILESETDLG_COMBO,7,7,138,322,CBS_DROPDOWNLIST |
WS_TABSTOP WS_TABSTOP
PUSHBUTTON "Update",IDC_TILESETDLG_BTN_UPDATE,5,25,140,15 PUSHBUTTON "Update",IDC_TILESETDLG_BTN_UPDATE,80,25,65,15
PUSHBUTTON "Load",IDC_TILESETDLG_BTN_LOAD,5,25,70,15
END
IDD_GFXTOOLBAR DIALOG DISCARDABLE 0, 0, 156, 26
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "P",IDD_GFXTOOLBAR_PAINT,5,5,15,15
PUSHBUTTON "S",IDD_GFXTOOLBAR_SELECT,20,5,15,15
PUSHBUTTON "Pk",IDD_GFXTOOLBAR_PICKER,35,5,15,15
PUSHBUTTON "X",IDD_GFXTOOLBAR_MIRRORX,50,5,15,15
PUSHBUTTON "Y",IDD_GFXTOOLBAR_MIRRORY,65,5,15,15
END END
@ -455,6 +480,14 @@ BEGIN
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 39 BOTTOMMARGIN, 39
END END
IDD_GFXTOOLBAR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 149
TOPMARGIN, 7
BOTTOMMARGIN, 19
END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED

View file

@ -165,16 +165,39 @@ void CMapEditDoc::ToggleGrid(CMapEditView *View)
} }
/*********************************************************************************/ /*********************************************************************************/
void CMapEditDoc::ReloadTileBank() void CMapEditDoc::SetMode(int NewMode)
{ {
Core.ReloadTileBank(); Core.SetMode(NewMode);
}
/*********************************************************************************/
/*** Tilebank Functions **********************************************************/
/*********************************************************************************/
void CMapEditDoc::TileBankLoad()
{
char BASED_CODE GinFilter[]= "Gin Files (*.Gin)|*.gin|All Files (*.*)|*.*||";
CFileDialog Dlg(TRUE,"Gin",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,GinFilter);
if (Dlg.DoModal()!=IDOK) return;
char Filename[256];
sprintf(Filename,"%s",Dlg.GetPathName());
Core.TileBankLoad(Filename);
UpdateAllViews(NULL);
}
/*********************************************************************************/
void CMapEditDoc::TileBankReload()
{
Core.TileBankReload();
UpdateAllViews(NULL); UpdateAllViews(NULL);
} }
/*********************************************************************************/ /*********************************************************************************/
void CMapEditDoc::TileBankChange() void CMapEditDoc::TileBankSet()
{ {
Core.ChangeTileBank(); Core.TileBankSet();
UpdateAllViews(NULL); UpdateAllViews(NULL);
} }

View file

@ -32,8 +32,11 @@ public:
void ToggleTileView(CMapEditView *View); void ToggleTileView(CMapEditView *View);
void ToggleGrid(CMapEditView *View); void ToggleGrid(CMapEditView *View);
void ReloadTileBank(); void TileBankLoad();
void TileBankChange(); void TileBankReload();
void TileBankSet();
void SetMode(int NewMode);
// Operations // Operations
public: public:

View file

@ -37,6 +37,15 @@ const float TileBrowserY1=1+TileBrowserGap/2;
CTileBank::CTileBank() CTileBank::CTileBank()
{ {
LoadFlag=FALSE; LoadFlag=FALSE;
CurrentSet=0;
LTile.Set=-1;
RTile.Set=-1;
AddTileSet("c:/temp/rockp/rockp.gin");
LTile.Set=0;
LTile.Tile=1;
RTile.Set=0;
RTile.Tile=2;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -87,107 +96,75 @@ CTile &CTileBank::GetTile(int Bank,int Tile)
/*****************************************************************************/ /*****************************************************************************/
void CTileBank::RenderSet(CCore *Core,Vec &CamPos,BOOL Is3d) void CTileBank::RenderSet(CCore *Core,Vec &CamPos,BOOL Is3d)
{ {
int CurrentBank=Core->GetCurrentTileBank(); int LT=LTile.Tile;
sMapElem &LSelTile=Core->GetMouseTileL(); int RT=RTile.Tile;
sMapElem &RSelTile=Core->GetMouseTileR();
int LTile=-1,RTile=-1;
if (LSelTile.Bank==CurrentBank || LSelTile.Tile==0) LTile=LSelTile.Tile; if (LTile.Set!=CurrentSet) LT=-1;
if (RSelTile.Bank==CurrentBank || RSelTile.Tile==0) RTile=RSelTile.Tile; if (RTile.Set!=CurrentSet) RT=-1;
if (!TileSet.size()) return; // No tiles, return
if (Is3d) if (Is3d)
{ {
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
TileSet[CurrentBank].Render3d(Core,CamPos,CursPos,LTile,RTile); TileSet[CurrentSet].Render3d(CamPos,LT,RT,CursorPos,Core->IsGridOn());
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
} }
else else
{ {
TileSet[CurrentBank].Render2d(Core,CamPos,CursPos,LTile,RTile); TileSet[CurrentSet].Render2d(CamPos,LT,RT,CursorPos,Core->IsGridOn());
} }
} }
/*****************************************************************************/ /*****************************************************************************/
void CTileBank::FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &MousePos) void CTileBank::FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &MousePos)
{ {
int CurrentBank=Core->GetCurrentTileBank(); if (!TileSet.size()) return; // No tiles, return
CursPos=TileSet[CurrentBank].FindCursorPos(Core,View,CamPos,MousePos); CursorPos=TileSet[CurrentSet].FindCursorPos(Core,View,CamPos,MousePos);
}
/*****************************************************************************/
void CTileBank::LButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag)
{
if (!DownFlag) return;
sMapElem &SelTile= Core->GetMouseTileL();
sMapElem &OtherSelTile= Core->GetMouseTileR();
int CurrentBank= Core->GetCurrentTileBank();
if (CursPos==-1) return;
if (CurrentBank==OtherSelTile.Bank && OtherSelTile.Tile==CursPos)
{ // Dont assign if same as other mouse
}
else
{
SelTile.Bank=CurrentBank;
SelTile.Tile=CursPos;
if (SelTile.Tile==0) SelTile.Bank=0; // Always make zero tile, bank 0 (dunno why, just seems handy)
View->Invalidate();
}
}
/*****************************************************************************/
void CTileBank::RButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag)
{
if (!DownFlag) return;
sMapElem &SelTile= Core->GetMouseTileR();
sMapElem &OtherSelTile= Core->GetMouseTileL();
int CurrentBank= Core->GetCurrentTileBank();
if (CursPos==-1) return;
if (CurrentBank==OtherSelTile.Bank && OtherSelTile.Tile==CursPos)
{ // Dont assign if same as other mouse
}
else
{
SelTile.Bank=CurrentBank;
SelTile.Tile=CursPos;
View->Invalidate();
}
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Gui *********************************************************************/ /*** Gui *********************************************************************/
/*****************************************************************************/ /*****************************************************************************/
void CTileBank::InitGUI(CCore *Core) void CTileBank::UpdateGUI(CCore *Core,BOOL IsTileView)
{
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
CMultiBar *ParamBar=Frm->GetParamBar();
ParamBar->RemoveAll();
ParamBar->Add(Frm->GetTileSetDlg(),IDD_TILESET_DIALOG,TRUE);
ParamBar->Update();
UpdateGUI(Core);
}
/*****************************************************************************/
void CTileBank::UpdateGUI(CCore *Core)
{ {
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd(); CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
CTileSetDlg *TileSetDlg=(CTileSetDlg*)Frm->GetDialog(IDD_TILESET_DIALOG); CTileSetDlg *TileSetDlg=(CTileSetDlg*)Frm->GetDialog(IDD_TILESET_DIALOG);
int ListSize=TileSet.size(); int ListSize=TileSet.size();
TRACE1("%i\n",TileSetDlg->TileSetList.GetCurSel());
TileSetDlg->TileSetList.ResetContent(); TileSetDlg->TileSetList.ResetContent();
if (ListSize)
{
for (int i=0; i<ListSize; i++) for (int i=0; i<ListSize; i++)
{ {
TileSetDlg->TileSetList.AddString(TileSet[i].GetName()); TileSetDlg->TileSetList.AddString(TileSet[i].GetName());
} }
TileSetDlg->TileSetList.SetCurSel(Core->GetCurrentTileBank()); TileSetDlg->TileSetList.SetCurSel(CurrentSet);
// IsTileView=TRUE;
}
else
{
IsTileView=FALSE;
}
TileSetDlg->TileSetList.EnableWindow(IsTileView);
}
/*****************************************************************************/
/*** Functions ***************************************************************/
/*****************************************************************************/
BOOL CTileBank::TileSelect(sMapElem &ThisTile,sMapElem &OtherTile)
{
if (CursorPos==-1) return(FALSE);
if (CurrentSet==OtherTile.Set && OtherTile.Tile==CursorPos)
{ // Dont assign if same as other Tile
return(FALSE);
}
ThisTile.Set=CurrentSet;
ThisTile.Tile=CursorPos;
if (ThisTile.Tile==0) ThisTile.Set=0; // Always make zero tile, bank 0 (dunno why, just seems handy)
return(TRUE);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -222,7 +199,6 @@ void CTileSet::Load(CCore *Core)
{ {
CScene Scene; CScene Scene;
char Filename[256+64]; char Filename[256+64];
CTile NewTile;
sprintf(Filename,"%s%s.%s",Path,Name,"Gin"); sprintf(Filename,"%s%s.%s",Path,Name,"Gin");
Scene.Load(Filename); Scene.Load(Filename);
@ -230,13 +206,10 @@ CTile NewTile;
CNode &ThisNode=Scene.GetSceneNode(0); CNode &ThisNode=Scene.GetSceneNode(0);
int ChildCount=ThisNode.GetPruneChildCount(); int ChildCount=ThisNode.GetPruneChildCount();
NewTile.CreateBlank(Core,this); Tile.push_back(CTile()); // Insert Blank
Tile.push_back(NewTile);
for (int Child=0; Child<ChildCount; Child++) for (int Child=0; Child<ChildCount; Child++)
{ {
NewTile.Load(Core,this,Scene,ThisNode.PruneChildList[Child]); Tile.push_back(CTile(Core,this,Scene,ThisNode.PruneChildList[Child]));
Tile.push_back(NewTile);
} }
Loaded=TRUE; Loaded=TRUE;
@ -257,17 +230,15 @@ int ListSize=Tile.size();
} }
/*****************************************************************************/ /*****************************************************************************/
void CTileSet::Render2d(CCore *Core,Vec &CamPos,int CursorPos,int LTile,int RTile) void CTileSet::Render2d(Vec &CamPos,int LTile,int RTile,int CursorPos,BOOL GridFlag)
{ {
} }
/*****************************************************************************/ /*****************************************************************************/
void CTileSet::Render3d(CCore *Core,Vec &CamPos,int CursorPos,int LTile,int RTile) void CTileSet::Render3d(Vec &CamPos,int LTile,int RTile,int CursorPos,BOOL GridFlag)
{ {
int ListSize=Tile.size(); int ListSize=Tile.size();
CTexCache &TexCache=Core->GetTexCache();
int TileID=0; int TileID=0;
BOOL GridFlag=Core->IsGridOn();
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
@ -280,38 +251,41 @@ BOOL GridFlag=Core->IsGridOn();
glLoadIdentity(); glLoadIdentity();
glTranslatef(CamPos.x+XPos*(1+TileBrowserGap),CamPos.y-YPos*(1+TileBrowserGap),CamPos.z); glTranslatef(CamPos.x+XPos*(1+TileBrowserGap),CamPos.y-YPos*(1+TileBrowserGap),CamPos.z);
RenderMisc(TileID==LTile,TileID==RTile,GridFlag,TileID==CursorPos); RenderMisc(TileID==LTile,TileID==RTile,TileID==CursorPos,GridFlag);
glColor3f(0.5,0.5,0.5); glColor3f(0.5,0.5,0.5);
ThisTile.Render(); ThisTile.Render();
TileID++; TileID++;
} }
} }
/*****************************************************************************/ /*****************************************************************************/
void CTileSet::RenderMisc(BOOL LSelFlag,BOOL RSelFlag, BOOL GridFlag,BOOL CursorFlag) void CTileSet::RenderMisc(BOOL LTileFlag,BOOL RTileFlag,BOOL CursorFlag,BOOL GridFlag)
{ {
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
if (LSelFlag || RSelFlag || CursorFlag) if (LTileFlag || RTileFlag || CursorFlag)
{ // Show selected tile {
glBegin(GL_QUADS); glBegin(GL_QUADS);
glNormal3f( 1,1,1); glNormal3f( 1,1,1);
if (LSelFlag)
glColor3ub(255,0,0);
else
if (RSelFlag)
glColor3ub(0,0,255);
else
glColor3ub(255,255,0); glColor3ub(255,255,0);
if (LTileFlag)
{
glColor3ub(255,0,0);
}
if (RTileFlag)
{
glColor3ub(0,0,255);
}
BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0); BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0);
glEnd(); glEnd();
} }
else
if (GridFlag) if (GridFlag)
{ {
glBegin(GL_LINES); glBegin(GL_LINES);
@ -334,7 +308,6 @@ void CTileSet::RenderMisc(BOOL LSelFlag,BOOL RSelFlag, BOOL GridFlag,BOOL Cursor
} }
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
/*****************************************************************************/ /*****************************************************************************/

View file

@ -38,21 +38,29 @@ public:
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;}
sMapElem &GetLTile() {return(LTile);}
sMapElem &GetRTile() {return(RTile);}
void RenderSet(CCore *Core,Vec &CamPos,BOOL Is3d); void RenderSet(CCore *Core,Vec &CamPos,BOOL Is3d);
void FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &MousePos); void FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &MousePos);
void LButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag); void UpdateGUI(CCore *Core,BOOL IsTileView);
void RButtonControl(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag);
void InitGUI(CCore *Core); // Functions
void UpdateGUI(CCore *Core); BOOL TileSelectL() {return(TileSelect(LTile,RTile));}
BOOL TileSelectR() {return(TileSelect(RTile,LTile));}
private: private:
BOOL TileSelect(sMapElem &ThisTile,sMapElem &OtherTile);
std::vector<CTileSet> TileSet; std::vector<CTileSet> TileSet;
BOOL LoadFlag; int CurrentSet;
int CursPos; sMapElem LTile,RTile;
BOOL LoadFlag;
int CursorPos;
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -68,12 +76,13 @@ public:
char *GetName() {return(Name);} char *GetName() {return(Name);}
CTile &GetTile(int No) {return(Tile[No]);} CTile &GetTile(int No) {return(Tile[No]);}
void Purge(); void Purge();
void Render2d(CCore *Core,Vec &CamPos,int CursorPos,int LTile,int RTile);
void Render3d(CCore *Core,Vec &CamPos,int CursorPos,int LTile,int RTile);
void RenderMisc(BOOL LSelFlag,BOOL RSelFlag, BOOL GridFlag,BOOL CursorFlag);
int FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &MousePos); int FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &MousePos);
void Render2d(Vec &CamPos,int LTile,int RTile,int CursorPos,BOOL GridFlag);
void Render3d(Vec &CamPos,int LTile,int RTile,int CursorPos,BOOL GridFlag);
private: private:
void RenderMisc(BOOL LTileFlag,BOOL RTileFlag,BOOL CursorFlag,BOOL GridFlag);
char Path[256],Name[256]; char Path[256],Name[256];
std::vector<CTile> Tile; std::vector<CTile> Tile;
BOOL Loaded; BOOL Loaded;

View file

@ -5,20 +5,27 @@
#define IDD_ABOUTBOX 100 #define IDD_ABOUTBOX 100
#define IDD_PARAMBAR 103 #define IDD_PARAMBAR 103
#define IDD_MULTIBAR 103 #define IDD_MULTIBAR 103
#define IDD_TILETOOLBAR 104
#define IDR_MAINFRAME 128 #define IDR_MAINFRAME 128
#define IDR_TOOLBAR 128 #define IDR_TOOLBAR 128
#define IDR_MAPEDITYPE 129 #define IDR_MAPEDITYPE 129
#define IDD_TRASHHEAP 142
#define IDD_LAYER_LIST_DIALOG 147 #define IDD_LAYER_LIST_DIALOG 147
#define IDD_TILESET_DIALOG 148 #define IDD_TILESET_DIALOG 148
#define IDC_PARAMBAR_LAYER_LIST 1011 #define IDD_GFXTOOLBAR 151
#define IDC_TILETOOLBAR_COMBO 1013 #define IDI_PAINT 152
#define IDI_SELECT 153
#define IDI_PICKER 154
#define IDI_MIRRORX 155
#define IDI_MIRRORY 156
#define IDC_TOOLBAR_COMBO 1018 #define IDC_TOOLBAR_COMBO 1018
#define IDC_LIST1 1019
#define IDC_LAYER_LIST 1019 #define IDC_LAYER_LIST 1019
#define IDC_TILESETDLG_BTN_UPDATE 1029 #define IDC_TILESETDLG_BTN_UPDATE 1029
#define IDC_TILESETDLG_COMBO 1030 #define IDC_TILESETDLG_COMBO 1030
#define IDD_GFXTOOLBAR_PAINT 1031
#define IDC_TILESETDLG_BTN_LOAD 1031
#define IDD_GFXTOOLBAR_SELECT 1032
#define IDD_GFXTOOLBAR_PICKER 1033
#define IDD_GFXTOOLBAR_MIRRORX 1034
#define IDD_GFXTOOLBAR_MIRRORY 1035
#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
@ -31,9 +38,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 151 #define _APS_NEXT_RESOURCE_VALUE 163
#define _APS_NEXT_COMMAND_VALUE 32785 #define _APS_NEXT_COMMAND_VALUE 32785
#define _APS_NEXT_CONTROL_VALUE 1031 #define _APS_NEXT_CONTROL_VALUE 1032
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif