This commit is contained in:
parent
51e8f52d9b
commit
6c5c1fba9b
9 changed files with 116 additions and 11 deletions
|
@ -73,7 +73,7 @@ int Width,Height;
|
|||
|
||||
// Create Tile Layers
|
||||
AddLayer(LAYER_TYPE_TILE,LAYERTILE_ACTION, Width, Height);
|
||||
// AddLayer(LAYER_TYPE_COLLISION,-1, Width, Height);
|
||||
AddLayer(LAYER_TYPE_COLLISION,-1, Width, Height);
|
||||
|
||||
ActiveLayer=FindActionLayer();
|
||||
MapCam.Zero();
|
||||
|
|
|
@ -27,3 +27,26 @@ CExport::~CExport()
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CExport::BuildColTable(CTile &ThisTile)
|
||||
{
|
||||
u8 *RGB=ThisTile.GetGBTexRGB();
|
||||
int Width=ThisTile.GetGBTexW();
|
||||
int Height=ThisTile.GetGBTexH();
|
||||
|
||||
int X,Y;
|
||||
ColTable.resize(Width);
|
||||
|
||||
for (X=0; X<Width; X++)
|
||||
{
|
||||
for (Y=Height; Y ; Y--)
|
||||
{
|
||||
int Ofs=X+((Y-1)*Width);
|
||||
u8 R=RGB[(Ofs*3)+0];
|
||||
u8 G=RGB[(Ofs*3)+1];
|
||||
u8 B=RGB[(Ofs*3)+2];
|
||||
if (R==255 && G==255 && B==255) break;
|
||||
}
|
||||
ColTable[X]=Y-1;
|
||||
}
|
||||
|
||||
}
|
|
@ -29,14 +29,18 @@ public:
|
|||
~CExport();
|
||||
|
||||
virtual void ExportLayerTile(CCore *Core,char *LayerName,int SubType,CMap &Map)=0;
|
||||
virtual void ExportLayerCollision(CCore *Core,char *LayerName,int SubType,CMap &Map)=0;
|
||||
|
||||
virtual void ExportTiles(CCore *Core)=0;
|
||||
|
||||
protected:
|
||||
void BuildColTable(CTile &ThisTile);
|
||||
|
||||
GFName Filename;
|
||||
FILE *File;
|
||||
int Count;
|
||||
GFName Filename;
|
||||
FILE *File;
|
||||
int Count;
|
||||
|
||||
std::vector<int> ColTable;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -101,7 +101,7 @@ void CLayerCollision::UpdateGUI(CCore *Core)
|
|||
/*****************************************************************************/
|
||||
void CLayerCollision::Export(CCore *Core,CExport &Exp)
|
||||
{
|
||||
// Exp.ExportLayerTile(Core,GetName(),SubType,Map);
|
||||
Exp.ExportLayerCollision(Core,GetName(),SubType,Map);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#define __LAYER_DEFS_HEADER__
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
// Max size is 8 * 6
|
||||
|
||||
enum LAYER_TYPE
|
||||
{
|
||||
LAYER_TYPE_TILE=0,
|
||||
|
|
|
@ -43,7 +43,7 @@ GString Filename;
|
|||
|
||||
// Get application path
|
||||
#ifdef _DEBUG
|
||||
ExePath="C:/Spongebob/tools/mapedit/mapedit/";
|
||||
ExePath="C:/Spongebob/tools/mapedit/";
|
||||
#else
|
||||
char ExeFilename[2048];
|
||||
GetModuleFileName(GetModuleHandle(NULL),ExeFilename,2048);
|
||||
|
@ -85,6 +85,21 @@ void CTileBank::SetCollision(bool f)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
char *FixName(const char *In)
|
||||
{
|
||||
char *Ptr=(char*)In;
|
||||
while (*Ptr)
|
||||
{
|
||||
if (Ptr[0]=='T' &&
|
||||
Ptr[1]=='I' &&
|
||||
Ptr[2]=='L' &&
|
||||
Ptr[3]=='E') return(Ptr);
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
return(Ptr);
|
||||
}
|
||||
|
||||
void CTileBank::Load(CFile *File,int Version)
|
||||
{
|
||||
int ListSize;
|
||||
|
@ -105,16 +120,24 @@ GString FilePath;
|
|||
{
|
||||
CurrentSet++;
|
||||
}
|
||||
|
||||
// New Style rel storage
|
||||
for (int i=0;i<ListSize;i++)
|
||||
{
|
||||
char c=1,RelName[256+64],FullName[256+64];
|
||||
char c=1,FullName[256+64];
|
||||
GString RelName;
|
||||
int Len=0;
|
||||
while (c)
|
||||
{
|
||||
File->Read(&c,1);
|
||||
RelName[Len++]=c;
|
||||
RelName.Append(c);
|
||||
}
|
||||
RelName.Upper();
|
||||
|
||||
{ // Dodgy arse artist fix
|
||||
RelName=FixName(RelName);
|
||||
}
|
||||
|
||||
RootPath.makeabsolute(FilePath,RelName,FullName);
|
||||
AddTileSet(FullName);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
void SetCurrent(int Set) {CurrentSet=Set+1;}
|
||||
int GetCurrent() {return(CurrentSet);}
|
||||
int GetSetCount() {return(TileSet.size());}
|
||||
|
||||
|
||||
CMap &GetLBrush() {return(Brush[LBrush]);}
|
||||
CMap &GetRBrush() {return(Brush[RBrush]);}
|
||||
CMap &GetBrush(int i) {return(Brush[i]);}
|
||||
|
@ -67,6 +67,7 @@ public:
|
|||
BOOL IsTileValidGB(int Set,int Tile);
|
||||
|
||||
void SetCollision(bool f);
|
||||
CTileSet &GetSet(int Set) {return(TileSet[Set]);}
|
||||
|
||||
// Functions
|
||||
BOOL SelectL(BOOL DownFlag) {return(Select(LBrush,DownFlag));}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue