diff --git a/Utils/MapEdit/Core.cpp b/Utils/MapEdit/Core.cpp index a949b8dbe..18d2b07c6 100644 --- a/Utils/MapEdit/Core.cpp +++ b/Utils/MapEdit/Core.cpp @@ -55,7 +55,6 @@ GString Filename; GetExecPath(Filename); Filename+=IconzFileName; IconBank->AddSet(Filename); - } /*****************************************************************************/ @@ -110,7 +109,6 @@ Vector3 DuffVector; CString mexstr; mexstr.Format("Old File Format\n\nPlease re-save\n"); AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION); - } #endif @@ -231,26 +229,31 @@ void CCore::RenderLayers(bool OneShot) Vector3 &ThisCam=GetCam(); int ListSize=Layer.size(); int StartLayer,EndLayer; +CLayer *ThisLayer; if (OneShot) { StartLayer=ActiveLayer; EndLayer=StartLayer+1; + ThisLayer=CurrentLayer; } else { - StartLayer=0; - EndLayer=ListSize; - while (Layer[StartLayer]->IsUnique()) StartLayer++; + StartLayer=0; + EndLayer=ListSize; + while (Layer[StartLayer]->IsUnique()) StartLayer++; + ThisLayer=Layer[StartLayer]; } for (int i=StartLayer; iIsVisible()) + if (ThisLayer->IsVisible()) { - Layer[i]->Render(this,ThisCam,Is3dFlag); - if (GridFlag) Layer[i]->RenderGrid(this,ThisCam,i==ActiveLayer); + ThisLayer->Render(this,ThisCam,Is3dFlag); + if (GridFlag) ThisLayer->RenderGrid(this,ThisCam,i==ActiveLayer); } + if (i!=EndLayer) ThisLayer=Layer[i+1]; + } CurrentLayer->RenderCursor(this,ThisCam,Is3dFlag); // Get Cursor Pos diff --git a/Utils/MapEdit/Elem.cpp b/Utils/MapEdit/Elem.cpp index e7e5d0da2..cd97a4fef 100644 --- a/Utils/MapEdit/Elem.cpp +++ b/Utils/MapEdit/Elem.cpp @@ -25,6 +25,9 @@ const Vector3 DefOfs(+0.5f,0,+4.0f); +int CElem::BlankID=-1; +int CElem::InvalidID=-1; +bool CElem::DefTexFlag=false; /*****************************************************************************/ // All Elems MUST run from 0,0 -> @@ -67,7 +70,7 @@ CElem::CElem(int Width,int Height) Type=ElemType2d; TexXOfs=0; TexYOfs=0; - CreateBlankTileGfx(); + for (int i=0; i> PC_TILE_FLAG_COLLISION_SHIFT; glPopMatrix(); } -/*****************************************************************************/ -void CElem::RenderInvalid() -{ -float X0=0; -float X1=UnitWidth; -float Y0=0; -float Y1=UnitHeight; - - glBindTexture(GL_TEXTURE_2D, 0); - glBegin(GL_LINES); - glColor4f(1,1,1,1); - - glVertex3f( X0,Y0,0); - glVertex3f( X1,Y1,0); - - glVertex3f( X1,Y0,0); - glVertex3f( X0,Y1,0); - glEnd(); -} - /*****************************************************************************/ void CElem::Purge() { @@ -439,51 +429,41 @@ void CElem::Purge() /*****************************************************************************/ // Only created for the tile browser, should NEVER appear in main view -void CElem::CreateBlankTileGfx() +void CElem::CreateDefaultTileGfx() { float X0=0; -float X1=UnitWidth; +float X1=1.0f; float Y0=0; -float Y1=UnitHeight; - - Purge(); - for (int i=0; iListSize) return(false); + if (No>=ListSize) return(false); return(ElemList[No].IsValid()); } @@ -880,8 +861,8 @@ bool CElemBank::IsValid(int Set,int Elem) { if (Set<0 || Elem<0) return(false); if (Elem==0) return(true); -// if (Set>=SetList.size()) return(false); - if (Set>SetList.size()) return(false); + if (Set>=SetList.size()) return(false); +// if (Set>SetList.size()) return(false); ASSERT(Set &GetTriList() {return(TriList);} @@ -93,7 +94,6 @@ protected: float UnitWidth,UnitHeight; int ElemID; u8 *ElemRGB; - }; /*****************************************************************************/ @@ -119,7 +119,6 @@ const char *GetName() {return(Name);} int GetBrowserWidth() {return(ElemBrowserWidth);} void RenderElem(int Elem,int Flags,bool Render3d) {ElemList[Elem].Render(Flags,Render3d);} - void RenderInvalid() {ElemList[0].RenderInvalid();} CElem &GetElem(int No) {return(ElemList[No]);} void Purge(); bool IsValid(int No); @@ -163,7 +162,7 @@ virtual void Save(CFile *File); CElem &GetElem(int Set,int Elem) {return(SetList[Set].GetElem(Elem));} bool IsValid(int Set,int Elem); void RenderElem(int Set,int Elem,int Flags,bool Is3d); - + void RenderInvalid() {glCallList(CElem::InvalidID);} int GetSetCount() {return(SetList.size());} const char *GetSetName(int Set) {return(SetList[Set].GetName());} diff --git a/Utils/MapEdit/ElemStore.cpp b/Utils/MapEdit/ElemStore.cpp index d2c2d6ea1..27fda0760 100644 --- a/Utils/MapEdit/ElemStore.cpp +++ b/Utils/MapEdit/ElemStore.cpp @@ -77,7 +77,7 @@ void CElemStore::RenderElem(int Set,int Elem,int Flags,bool Is3d) } else { - SetList[0].RenderInvalid(); + RenderInvalid(); } } diff --git a/Utils/MapEdit/Layer.cpp b/Utils/MapEdit/Layer.cpp index aeb047f43..cb3332b9d 100644 --- a/Utils/MapEdit/Layer.cpp +++ b/Utils/MapEdit/Layer.cpp @@ -134,6 +134,7 @@ CLayer *New; File->Read(&ThisDef,sizeof(sLayerDef)); New=NewLayer(ThisDef);//Type,SubType,0,0); + New->Load(File,Version); } return(New); } diff --git a/Utils/MapEdit/Layer.h b/Utils/MapEdit/Layer.h index ff1a4de1a..063d599ef 100644 --- a/Utils/MapEdit/Layer.h +++ b/Utils/MapEdit/Layer.h @@ -52,7 +52,7 @@ static int GetLayerIdx(int Type,int SubType); static CLayer *NewLayer(sLayerDef &Def); static CLayer *LoadLayer(CFile *File,int Version); - char *GetName() {TRACE1("%i\n",TableIdx);return(InfoTable[TableIdx].Name);} + char *GetName() {return(InfoTable[TableIdx].Name);} bool CanDelete() {return(InfoTable[TableIdx].DeleteFlag);} float GetScaleFactor() {return(InfoTable[TableIdx].ScaleFactor);} bool GetRender3dFlag() {return(InfoTable[TableIdx].Render3dFlag);} diff --git a/Utils/MapEdit/LayerCollision.cpp b/Utils/MapEdit/LayerCollision.cpp index 44ed71ce6..b62c336c8 100644 --- a/Utils/MapEdit/LayerCollision.cpp +++ b/Utils/MapEdit/LayerCollision.cpp @@ -80,6 +80,7 @@ void CLayerCollision::Load(CFile *File,int Version) void CLayerCollision::Save(CFile *File) { // Always Save current version + File->Write(&Mode,sizeof(MouseMode)); Map.Save(File); } diff --git a/Utils/MapEdit/LayerShade.cpp b/Utils/MapEdit/LayerShade.cpp index b4a65e0d4..863ee6351 100644 --- a/Utils/MapEdit/LayerShade.cpp +++ b/Utils/MapEdit/LayerShade.cpp @@ -70,7 +70,6 @@ void CLayerShade::Load(CFile *File,int Version) } InitLayer(LayerDef); File->Read(&Count,sizeof(int)); - if (Count<2) Count=2; for (int i=0; iRead(&Pos[i],sizeof(int)); diff --git a/Utils/MapEdit/LayerThing.cpp b/Utils/MapEdit/LayerThing.cpp index 9a22684fc..e38decf39 100644 --- a/Utils/MapEdit/LayerThing.cpp +++ b/Utils/MapEdit/LayerThing.cpp @@ -116,7 +116,6 @@ CElemBank *IconBank=Core->GetIconBank(); glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner int ListSize=ThisThing.XY.size(); -TRACE1("%i\n",ListSize); for (int i=0;i