This commit is contained in:
parent
e32dc5fe93
commit
eb27a81e2c
11 changed files with 178 additions and 50 deletions
|
@ -56,7 +56,7 @@ int LayerCount=LayerOfs.size();
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void PadFile(FILE *File)
|
||||
void CExport::PadFile()
|
||||
{
|
||||
int Pad=ftell(File) & 3;
|
||||
|
||||
|
@ -75,7 +75,7 @@ void CExport::Write(void *Addr,int Len)
|
|||
/*****************************************************************************/
|
||||
int CExport::ExportLayerHeader(sLayerDef &LayerDef)//(int Type,int SubType,int Width,int Height)
|
||||
{
|
||||
PadFile(File);
|
||||
PadFile();
|
||||
sExpLayerHdr LayerHdr;
|
||||
int ThisFilePos=ftell(File);
|
||||
|
||||
|
@ -143,7 +143,10 @@ CTileBank *TileBank=Core->GetTileBank();
|
|||
|
||||
ASSERT(ThisTile.GetElemWidth()==FileHdr.TileW);
|
||||
ASSERT(ThisTile.GetElemHeight()==FileHdr.TileH);
|
||||
if (ThisTile.IsElem3d()) ExportTile3d(Core,ThisTile,OutTile);
|
||||
if (ThisTile.IsElem3d())
|
||||
{
|
||||
ExportTile3d(Core,ThisTile,OutTile);
|
||||
}
|
||||
OutTile.Set=SetNames.Add(SetName);
|
||||
fwrite(&OutTile,sizeof(sExpTile),1,File);
|
||||
fwrite(ThisTile.GetElemRGB(),FileHdr.TileW*FileHdr.TileH*3,1,File); // Write RGB
|
||||
|
@ -154,14 +157,18 @@ CTileBank *TileBank=Core->GetTileBank();
|
|||
|
||||
/*****************************************************************************/
|
||||
void CExport::ExportTile3d(CCore *Core,CElem &ThisTile,sExpTile &OutTile)
|
||||
{
|
||||
ExportElem3d(Core,ThisTile,OutTile.TriStart,OutTile.TriCount);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CExport::ExportElem3d(CCore *Core,CElem &ThisTile,int &TriStart,int &TriCount)
|
||||
{
|
||||
CTexCache &TexCache=Core->GetTexCache();
|
||||
std::vector<sTriFace> &TileTriList=ThisTile.GetTriList();
|
||||
|
||||
int TriCount=TileTriList.size();
|
||||
|
||||
OutTile.TriStart=TriList.size();
|
||||
OutTile.TriCount=TriCount;
|
||||
TriStart=TriList.size();
|
||||
TriCount=TileTriList.size();
|
||||
|
||||
for (int T=0; T<TriCount; T++)
|
||||
{
|
||||
|
|
|
@ -28,10 +28,11 @@ public:
|
|||
void Write(void *Addr,int Len);
|
||||
int ExportLayerHeader(sLayerDef &LayerDef);//int Type,int SubType,int Width,int Height);
|
||||
int AddTile(sExpTile &Tile) {return(UsedTileList.Add(Tile));}
|
||||
|
||||
void PadFile();
|
||||
void ExportTiles(CCore *Core);
|
||||
void ExportStrList(CCore *Core);
|
||||
|
||||
|
||||
void ExportElem3d(CCore *Core,CElem &ThisElem,int &TriStart,int &TriCount);
|
||||
protected:
|
||||
void ExportTile(CCore *Core,sExpTile &ThisElem);
|
||||
void ExportTile3d(CCore *Core,CElem &ThisTile,sExpTile &OutTile);
|
||||
|
|
|
@ -130,7 +130,8 @@ struct sLayerThingData
|
|||
// Boxes
|
||||
int Width,Height;
|
||||
// Spare
|
||||
int Spare[4];
|
||||
int TriStart,TriCount;
|
||||
int Spare[2];
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -67,8 +67,6 @@ CComboBox &List=GUIPlatform.m_Type;
|
|||
List.AddString("Weighted");
|
||||
List.AddString("Rotating");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -171,3 +169,18 @@ void CLayerPlatform::SetThingParams(sLayerThing &Thing)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayerPlatform::Export(CCore *Core,CExport &Exp)
|
||||
{
|
||||
CLayerThing::Export(Core,Exp);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayerPlatform::ExportThingData(CCore *Core,CExport &Exp,sLayerThing &ThisThing,sLayerThingData &OutThing)
|
||||
{
|
||||
CElem &ThisElem=ThingBank->GetElem(ThisThing.ElemID,0);
|
||||
|
||||
Exp.ExportElem3d(Core,ThisElem,OutThing.TriStart,OutThing.TriCount);
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
void GUIThingUpdate(bool OnlySel=false);
|
||||
void GUIThingPointUpdate(bool OnlySel=false);
|
||||
|
||||
void Export(CCore *Core,CExport &Exp);
|
||||
void ExportThingData(CCore *Core,CExport &Exp,sLayerThing &ThisThing,sLayerThingData &OutThing);
|
||||
|
||||
protected:
|
||||
void SetThingParams(sLayerThing &Thing);
|
||||
|
|
|
@ -720,18 +720,19 @@ int i,ListSize=ThingList.size();
|
|||
Exp.Write(&ListSize,sizeof(int));
|
||||
for (i=0;i<ListSize; i++)
|
||||
{
|
||||
ExportThing(Exp,ThingList[i]);
|
||||
ExportThing(Core,Exp,ThingList[i]);
|
||||
}
|
||||
ExportThingNames(Exp);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayerThing::ExportThing(CExport &Exp,sLayerThing &ThisThing)
|
||||
void CLayerThing::ExportThing(CCore *Core,CExport &Exp,sLayerThing &ThisThing)
|
||||
{
|
||||
int i,ListSize=ThisThing.XY.size();
|
||||
sLayerThingData OutThing=ThisThing.Data;
|
||||
|
||||
OutThing.WaypointCount=ListSize;
|
||||
ExportThingData(Core,Exp,ThisThing,OutThing);
|
||||
Exp.Write(&OutThing,sizeof(sLayerThingData));
|
||||
|
||||
// Point List
|
||||
|
@ -753,3 +754,4 @@ int i,ListSize=ThingList.size();
|
|||
Exp.Write(Txt,strlen(Txt)+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,8 @@ virtual void SaveThingNames(CFile *File);
|
|||
virtual void LoadThingScript(const char *Filename);
|
||||
|
||||
virtual void Export(CCore *Core,CExport &Exp);
|
||||
virtual void ExportThing(CExport &Exp,sLayerThing &ThisThing);
|
||||
virtual void ExportThing(CCore *Core,CExport &Exp,sLayerThing &ThisThing);
|
||||
virtual void ExportThingData(CCore *Core,CExport &Exp,sLayerThing &ThisThing,sLayerThingData &OutThing){}
|
||||
virtual void ExportThingNames(CExport &Exp);
|
||||
|
||||
// Functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue