diff --git a/Utils/MapEdit/Core.cpp b/Utils/MapEdit/Core.cpp index f2c1dcefd..57e77c98f 100644 --- a/Utils/MapEdit/Core.cpp +++ b/Utils/MapEdit/Core.cpp @@ -17,11 +17,7 @@ #include "Core.h" #include "Layer.h" -#include "LayerBack.h" -#include "LayerMid.h" -#include "LayerAction.h" -#include "LayerFore.h" - +#include "LayerTile.h" BOOL Test3dFlag=TRUE; @@ -42,13 +38,14 @@ CCore::~CCore() /*****************************************************************************/ void CCore::NewMap() { + RenderFlag=TRUE; // To be loaded/created - Layers[LAYER_TYPE_BACK]= new CLayerBack(); - Layers[LAYER_TYPE_MID]= new CLayerMid(); - Layers[LAYER_TYPE_ACTION]= new CLayerAction(); - Layers[LAYER_TYPE_FORE]= new CLayerFore(); + Layers[LAYER_TYPE_BACK]= new CLayerTile("Back", 32, 32, 4.0f, FALSE); + Layers[LAYER_TYPE_MID]= new CLayerTile("Mid", TileLayerDefaultWidth/2.0f, TileLayerDefaultHeight/2.0f, 2.0f, FALSE); + Layers[LAYER_TYPE_ACTION]= new CLayerTile("Action",TileLayerDefaultWidth/1.0f, TileLayerDefaultHeight/1.0f, 1.0f, TRUE); + Layers[LAYER_TYPE_FORE]= new CLayerTile("Fore", TileLayerDefaultWidth/0.5f, TileLayerDefaultHeight/0.5f, 0.5f, FALSE); TileViewFlag=0; LayerViewFlag=1; @@ -69,6 +66,7 @@ void CCore::OpenMap() /*****************************************************************************/ void CCore::Render(CMapEditView *View) { + Vec &ThisCam=GetCam(); if (TileBank.NeedLoad()) TileBank.LoadTileSets(this); @@ -186,6 +184,8 @@ CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST); ToolBar->GetToolBarCtrl().PressButton(ID_TOOLBAR_LAYERBAR,LayerViewFlag); Frm->ShowControlBar(LayerBar, LayerViewFlag, FALSE); + if (View) UpdateView(View); + } /*****************************************************************************/ diff --git a/Utils/MapEdit/Core.h b/Utils/MapEdit/Core.h index 8156b9175..e5c58bf2d 100644 --- a/Utils/MapEdit/Core.h +++ b/Utils/MapEdit/Core.h @@ -8,7 +8,7 @@ #include #include "gl3d.h" #include "Layer.h" -#include "LayerBack.h" +//#include "LayerTile.h" #include "TexCache.h" #include "TileSet.h" @@ -69,7 +69,6 @@ private: CLayer *Layers[LAYER_TYPE_MAX]; int ActiveLayer; -// std::vector TileSet; CTileBank TileBank; CTexCache TexCache; diff --git a/Utils/MapEdit/Layer.cpp b/Utils/MapEdit/Layer.cpp index 77e6da9e0..2398c9e4a 100644 --- a/Utils/MapEdit/Layer.cpp +++ b/Utils/MapEdit/Layer.cpp @@ -8,181 +8,27 @@ #include #include #include -#include "GLEnabledView.h" +//#include "GLEnabledView.h" -#include "MapEditDoc.h" -#include "MapEditView.h" +//#include "MapEditDoc.h" +//#include "MapEditView.h" #include "Core.h" #include "Layer.h" #include "Utils.h" - /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ -CLayer::CLayer() +char *CLayer::GetName() { + return(Name); } /*****************************************************************************/ -CLayer::~CLayer() +void CLayer::SetName(char *_Name) { -} - -/*****************************************************************************/ -void CLayer::Render(CCore *Core,Vec &MapPos,BOOL Is3d) -{ - Render2d(Core,MapPos); -} - -/*****************************************************************************/ -void CLayer::Render2d(CCore *Core,Vec &MapPos) -{ -float XYDiv=GetLayerZPosDiv(); -return; -int Width=Map.GetWidth(); -int Height=Map.GetHeight(); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z); - - glBegin(GL_QUADS); - BuildGLQuad(-1,Width+1,-1,0,0); // Bottom - BuildGLQuad(-1,Width+1,Height+1,Height,0); // Top - BuildGLQuad(-1,0,Height,0,0); // Left - BuildGLQuad(Width,Width+1,Height,0,0); // Right - glEnd(); - - -} - -/*****************************************************************************/ -void CLayer::Render3d(CCore *Core,Vec &MapPos) -{ -float XYDiv=GetLayerZPosDiv(); -int MapW=Map.GetWidth(); -int MapH=Map.GetHeight(); -float StartX=MapPos.x/XYDiv; -float StartY=MapPos.y/XYDiv; -CTexCache &TexCache=Core->GetTexCache(); - - glMatrixMode(GL_MODELVIEW); - - for (int YLoop=0; YLoopGetTile(ThisElem.Bank,ThisElem.Tile); - - glLoadIdentity(); // Slow way, but good to go for the mo - glTranslatef(StartX+XLoop,StartY-YLoop,MapPos.z); - ThisTile.Render(); - } - } - -} - -/*****************************************************************************/ -void CLayer::RenderGrid(CCore *Core,Vec &MapPos) -{ -float XYDiv=GetLayerZPosDiv(); -int MapW=Map.GetWidth(); -int MapH=Map.GetHeight(); -float StartX=MapPos.x/XYDiv; -float StartY=MapPos.y/XYDiv; -float OverVal=0.5; - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(StartX,StartY,MapPos.z); - glDisable(GL_TEXTURE_2D); - - glBegin(GL_LINES); - glNormal3f( 1,1,1); - glColor3ub(255,255,255); - - for (int YLoop=0; YLoopGetCursorPos(); - -float XYDiv=GetLayerZPosDiv(); -int MapW=Map.GetWidth(); -int MapH=Map.GetHeight(); -float StartX=MapPos.x/XYDiv; -float StartY=MapPos.y/XYDiv; - - 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); - glLoadIdentity(); - glTranslatef(StartX,StartY,MapPos.z); - - - for (int YLoop=0; YLoop Tile; BOOL Loaded; diff --git a/Utils/MapEdit/resource.h b/Utils/MapEdit/resource.h index e6b6fc9f6..fd24c9564 100644 --- a/Utils/MapEdit/resource.h +++ b/Utils/MapEdit/resource.h @@ -23,9 +23,9 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 141 +#define _APS_NEXT_RESOURCE_VALUE 142 #define _APS_NEXT_COMMAND_VALUE 32775 -#define _APS_NEXT_CONTROL_VALUE 1015 +#define _APS_NEXT_CONTROL_VALUE 1018 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif