From acc0107240c8a58e607befa7a9286fed36c63388 Mon Sep 17 00:00:00 2001 From: Daveo Date: Wed, 7 Feb 2001 21:31:31 +0000 Subject: [PATCH] --- Utils/MapEdit/Core.cpp | 41 ++++++++++++++++++++++++------------- Utils/MapEdit/Export.cpp | 18 ++++++++-------- Utils/MapEdit/Export.h | 4 ++-- Utils/MapEdit/ExportHdr.h | 3 ++- Utils/MapEdit/Layer.cpp | 12 +++++------ Utils/MapEdit/Layer.h | 3 +++ Utils/MapEdit/LayerDef.h | 2 +- Utils/MapEdit/LayerTile.cpp | 10 ++++----- Utils/MapEdit/MapEdit.dsp | 8 ++++---- 9 files changed, 59 insertions(+), 42 deletions(-) diff --git a/Utils/MapEdit/Core.cpp b/Utils/MapEdit/Core.cpp index 5cd7728c8..0a89ff771 100644 --- a/Utils/MapEdit/Core.cpp +++ b/Utils/MapEdit/Core.cpp @@ -72,7 +72,8 @@ int Width,Height; // Create Tile Layers AddLayer(LAYER_TYPE_TILE,LAYERTILE_ACTION, Width, Height); - AddLayer(LAYER_TYPE_COLLISION,-1, Width, Height); + AddLayer(LAYER_TYPE_TILE,LAYERTILE_SCRATCH, Width, Height); +// AddLayer(LAYER_TYPE_COLLISION,-1, Width, Height); ActiveLayer=FindActionLayer(); MapCam.Zero(); @@ -208,15 +209,28 @@ void CCore::RenderLayers(CMapEditView *View) { Vector3 &ThisCam=GetCam(); int ListSize=Layer.size(); - - for (int i=0;iIsUnique()) StartLayer++; + + if (Layer[ActiveLayer]->IsUnique()) + { + StartLayer=ActiveLayer; + EndLayer=StartLayer+1; + } + + for (int i=StartLayer; iIsVisible()) - { + { Layer[i]->Render(this,ThisCam,Is3dFlag); if (GridFlag) Layer[i]->RenderGrid(this,ThisCam,i==ActiveLayer); - } + } } + Layer[ActiveLayer]->RenderCursor(this,ThisCam,Is3dFlag); @@ -469,11 +483,8 @@ CLayer *Layer; ASSERT(!"AddLayer - Invalid Layer Type"); break; } - - } - /*****************************************************************************/ void CCore::AddLayer(int CurrentLayer) { @@ -482,7 +493,6 @@ CAddLayerDlg Dlg; int NewLayerId=0; int Sel; - // Build Unused List Dlg.Sel=&Sel; Sel=0; @@ -530,12 +540,12 @@ void CCore::DeleteLayer(int CurrentLayer) /*****************************************************************************/ void CCore::UpdateGrid(CMapEditView *View,BOOL Toggle) { -//CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd(); -//CToolBar *ToolBar=Frm->GetToolBar(); +CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd(); +CToolBar *ToolBar=Frm->GetToolBar(); if (Toggle) GridFlag=!GridFlag; -// ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_GRID,GridFlag); + ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_GRID,GridFlag); UpdateView(View); } @@ -809,11 +819,14 @@ char ExportName[256]; SetFileExt(Filename,ExportName,"MEX"); -CExport Exp(ExportName,LayerCount); +CExport Exp(ExportName); for (int i=0;iExport(this,Exp); + if (Layer[i]->CanExport()) + { + Layer[i]->Export(this,Exp); + } } Exp.ExportTiles(this); diff --git a/Utils/MapEdit/Export.cpp b/Utils/MapEdit/Export.cpp index 8323dc255..d4dc7c102 100644 --- a/Utils/MapEdit/Export.cpp +++ b/Utils/MapEdit/Export.cpp @@ -23,31 +23,31 @@ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ -CExport::CExport(char *Filename,int _LayerCount) +CExport::CExport(char *Filename) { - LayerCount=_LayerCount; File=fopen(Filename,"wb"); // Write Dummy File Header fwrite(&FileHdr,sizeof(sExpFileHdr),1,File); - for (int i=0;i LayerOfs; CList TriList; diff --git a/Utils/MapEdit/ExportHdr.h b/Utils/MapEdit/ExportHdr.h index 72a54a686..35de3c604 100644 --- a/Utils/MapEdit/ExportHdr.h +++ b/Utils/MapEdit/ExportHdr.h @@ -12,6 +12,7 @@ #include /*****************************************************************************/ +#define EXPORT_LAYER_COUNT 8 struct sExpFileHdr { int TileCount; @@ -24,7 +25,7 @@ struct sExpFileHdr int TexNameCount; int TexNameOfs; int LayerCount; -// int LayerOfs[n] + int LayerOfs[EXPORT_LAYER_COUNT]; }; /*****************************************************************************/ diff --git a/Utils/MapEdit/Layer.cpp b/Utils/MapEdit/Layer.cpp index 770f1e006..31ffbbf29 100644 --- a/Utils/MapEdit/Layer.cpp +++ b/Utils/MapEdit/Layer.cpp @@ -16,12 +16,12 @@ /*****************************************************************************/ 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}, + //Type SubType Name delete?Scale 3d Resizable Export + {LAYER_TYPE_TILE, LAYERTILE_SCRATCH, "WorkPad", false, 1.0f, true, false, false,}, + {LAYER_TYPE_TILE, LAYERTILE_BACK, "Back", true, 4.0f, false, false, true,}, + {LAYER_TYPE_TILE, LAYERTILE_MID, "Mid", true, 2.0f, false, true, true,}, + {LAYER_TYPE_TILE, LAYERTILE_ACTION, "Action", false, 1.0f, true, true, true,}, + {LAYER_TYPE_COLLISION, LAYER_SUBTYPE_NONE, "Collision", true, 1.0f, false, true, true,}, }; int CLayer::InfoTableSize=sizeof(InfoTable)/sizeof(sLayerInfoTable); diff --git a/Utils/MapEdit/Layer.h b/Utils/MapEdit/Layer.h index b247392e7..9767a0a26 100644 --- a/Utils/MapEdit/Layer.h +++ b/Utils/MapEdit/Layer.h @@ -22,6 +22,7 @@ struct sLayerInfoTable float ScaleFactor; bool Render3dFlag; bool ResizeFlag; + bool ExportFlag; }; @@ -50,6 +51,8 @@ static int GetLayerIdx(int Type,int SubType); char *GetName() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].Name);} bool CanDelete() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].DeleteFlag);} + bool CanExport() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].ExportFlag);} + bool IsUnique() {return(!(InfoTable[GetLayerIdx(GetType(),GetSubType())].ExportFlag));} virtual void SetVisible(BOOL f) {VisibleFlag=f;} virtual BOOL IsVisible() {return(VisibleFlag);} diff --git a/Utils/MapEdit/LayerDef.h b/Utils/MapEdit/LayerDef.h index 0c001bcc6..989009025 100644 --- a/Utils/MapEdit/LayerDef.h +++ b/Utils/MapEdit/LayerDef.h @@ -23,7 +23,7 @@ enum LAYER_SUBTYPE LAYERTILE_MID, LAYERTILE_ACTION, LAYERTILE_FORE, - + LAYERTILE_SCRATCH, }; enum TILE_FLAG diff --git a/Utils/MapEdit/LayerTile.cpp b/Utils/MapEdit/LayerTile.cpp index 90ba532f0..d4360f095 100644 --- a/Utils/MapEdit/LayerTile.cpp +++ b/Utils/MapEdit/LayerTile.cpp @@ -28,11 +28,6 @@ CLayerTile::CLayerTile(int _SubType,int Width,int Height) { SubType=_SubType; - if (SubType==LAYERTILE_BACK) // Back is fixed size - { - Width=32; - Height=32; - } SetDefaultParams(); @@ -43,6 +38,11 @@ CLayerTile::CLayerTile(int _SubType,int Width,int Height) Width=TileLayerMinWidth+(Width-TileLayerMinWidth)/ScaleFactor; Height=TileLayerMinHeight+(Height-TileLayerMinHeight)/ScaleFactor; } + else + { + Width=32; + Height=32; + } if (Width