diff --git a/Utils/MapEdit/Core.cpp b/Utils/MapEdit/Core.cpp index 04e83da01..e8efc2141 100644 --- a/Utils/MapEdit/Core.cpp +++ b/Utils/MapEdit/Core.cpp @@ -658,4 +658,6 @@ CExportPSX Exp(ExportName); Layer[FindActionLayer()]->Export(this,Exp); Exp.ExportTiles(this); + Exp.ExportTexList(this); + } \ No newline at end of file diff --git a/Utils/MapEdit/Export.h b/Utils/MapEdit/Export.h index 887875090..a82a7e4c5 100644 --- a/Utils/MapEdit/Export.h +++ b/Utils/MapEdit/Export.h @@ -7,8 +7,10 @@ #include "stdafx.h" #include +#include "mapedit.h" #include "Quantize.h" +#include "list.h" /*****************************************************************************/ @@ -16,6 +18,7 @@ /*****************************************************************************/ class CCore; class CMap; + class CTile; class CExport @@ -32,7 +35,9 @@ protected: char Drive[_MAX_DRIVE],Path[_MAX_DIR],Name[_MAX_FNAME],Ext[_MAX_EXT]; FILE *File; int Count; - std::vector UsedTileList; + + CList UsedTileList; + }; diff --git a/Utils/MapEdit/LayerTile.cpp b/Utils/MapEdit/LayerTile.cpp index 4d1e46d59..e9892c28c 100644 --- a/Utils/MapEdit/LayerTile.cpp +++ b/Utils/MapEdit/LayerTile.cpp @@ -188,11 +188,11 @@ int Height=ThisMap.GetHeight(); if (Alpha<1) { - glColor4f(0.5,0.5,0.5,Alpha); + glColor4f(1,1,1,Alpha); } else { - glColor3f(0.5,0.5,0.5); + glColor3f(1,1,1); } glMatrixMode(GL_MODELVIEW); @@ -229,9 +229,9 @@ float OverVal=0.5; glBegin(GL_LINES); if (Active) - glColor3ub(255,255,255); + glColor3f(1,1,1); else - glColor3ub(127,127,127); + glColor3f(0.5,0.5,0.5); for (int YLoop=0; YLoop Buffer; @@ -127,53 +108,41 @@ int TexHeight=TexData->Height; int GLWidth=AlignSize(TexWidth); int GLHeight=AlignSize(TexHeight); u8 *Src,*Dst; -u8 R,G,B,A; + // create RGB & alpha texture & ensuse texture is correct size for GL Buffer.resize(GLWidth*GLHeight*4); + Src=TexData->RGB; Dst=&Buffer[0]; - for (int Y=0; YRGB[((Y*TexWidth)+X)*3]; - R=*Src++; - G=*Src++; - B=*Src++; - A=255; - if ((R==BlankRGB.rgbRed && G==BlankRGB.rgbGreen && B==BlankRGB.rgbBlue)) // Create alpha for transparent pixels (flagged with PINK!!) + u8 R,G,B,A; + + R=*Src++; + G=*Src++; + B=*Src++; + A=255; + if ((R==BlankRGB.rgbRed && G==BlankRGB.rgbGreen && B==BlankRGB.rgbBlue)) // Create alpha for transparent pixels (flagged with PINK!!) { A=0; } - - } - else - { - R=255; - G=0; - B=255; - A=255; - } *Dst++=R; *Dst++=G; *Dst++=B; *Dst++=A; } + Dst+=(GLWidth-TexWidth)*4; } ThisTex.TexWidth=TexWidth; ThisTex.TexHeight=TexHeight; - ThisTex.GLWidth=GLWidth; - ThisTex.GLHeight=GLHeight; - ThisTex.dW=1.0f/(GLWidth/16); - ThisTex.dW=((float)TexWidth/(float)GLWidth)/(GLWidth/16); - ThisTex.dH=((float)TexHeight/(float)GLHeight)/(GLHeight/16); - - glGenTextures(1, &ThisTex.TexID); + ThisTex.dW=(1.0f)/(float)(GLWidth/16.0f); + ThisTex.dH=(1.0f)/(float)(GLHeight/16.0f); + + glGenTextures(1, &ThisTex.TexID); glBindTexture(GL_TEXTURE_2D, ThisTex.TexID); glTexImage2D(GL_TEXTURE_2D, 0, 4, GLWidth, GLHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, &Buffer[0]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); diff --git a/Utils/MapEdit/TexCache.h b/Utils/MapEdit/TexCache.h index 134d96a0e..0e7380961 100644 --- a/Utils/MapEdit/TexCache.h +++ b/Utils/MapEdit/TexCache.h @@ -24,11 +24,9 @@ struct sRGBData struct sTex { char Filename[_MAX_PATH]; -// char Name[_MAX_FNAME]; GLuint TexID; int Flags; int TexWidth,TexHeight; - int GLWidth,GLHeight; float dW,dH; BOOL Loaded; diff --git a/Utils/MapEdit/TileSet.cpp b/Utils/MapEdit/TileSet.cpp index e7e08a9df..d9a09142b 100644 --- a/Utils/MapEdit/TileSet.cpp +++ b/Utils/MapEdit/TileSet.cpp @@ -486,7 +486,7 @@ BOOL ValidTile=TRUE; ValidTile=IsTileValid(TileID); if (TileID && ValidTile) { - glColor3f(0.5,0.5,0.5); + glColor3f(1,1,1); Tile[TileID].Render(0,Render3d); } @@ -524,7 +524,7 @@ BOOL ValidTile=TRUE; if (!ValidTile) { glBegin(GL_LINES); - glColor3ub(255,255,255); + glColor3f(1,1,1); glVertex3f( TileBrowserX0,TileBrowserY0,0); glVertex3f( TileBrowserX1,TileBrowserY1,0); @@ -540,7 +540,7 @@ BOOL ValidTile=TRUE; CPoint Pos=GetTilePos(TileID); glBegin(GL_LINES); - glColor3ub(255,255,255); + glColor3f(1,1,1); glVertex3f( TileBrowserX0,TileBrowserY0,0); glVertex3f( TileBrowserX1,TileBrowserY0,0); @@ -621,7 +621,7 @@ int TileID=1; // Dont bother with blank, its sorted glTranslatef(CamPos.x+Pos.x*(1+TileBrowserGap),CamPos.y-Pos.y*(1+TileBrowserGap),CamPos.z); glBegin(GL_LINES); - glColor3ub(255,255,255); + glColor3f(1,1,1); glVertex3f( TileBrowserX0,TileBrowserY0,0); glVertex3f( TileBrowserX1,TileBrowserY0,0); diff --git a/Utils/MapEdit/resource.h b/Utils/MapEdit/resource.h index 0bdc10e98..ccaf72913 100644 --- a/Utils/MapEdit/resource.h +++ b/Utils/MapEdit/resource.h @@ -64,9 +64,9 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 169 +#define _APS_NEXT_RESOURCE_VALUE 172 #define _APS_NEXT_COMMAND_VALUE 32797 -#define _APS_NEXT_CONTROL_VALUE 1048 +#define _APS_NEXT_CONTROL_VALUE 1053 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif