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;
|
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)
|
int CExport::ExportLayerHeader(sLayerDef &LayerDef)//(int Type,int SubType,int Width,int Height)
|
||||||
{
|
{
|
||||||
PadFile(File);
|
PadFile();
|
||||||
sExpLayerHdr LayerHdr;
|
sExpLayerHdr LayerHdr;
|
||||||
int ThisFilePos=ftell(File);
|
int ThisFilePos=ftell(File);
|
||||||
|
|
||||||
|
@ -143,7 +143,10 @@ CTileBank *TileBank=Core->GetTileBank();
|
||||||
|
|
||||||
ASSERT(ThisTile.GetElemWidth()==FileHdr.TileW);
|
ASSERT(ThisTile.GetElemWidth()==FileHdr.TileW);
|
||||||
ASSERT(ThisTile.GetElemHeight()==FileHdr.TileH);
|
ASSERT(ThisTile.GetElemHeight()==FileHdr.TileH);
|
||||||
if (ThisTile.IsElem3d()) ExportTile3d(Core,ThisTile,OutTile);
|
if (ThisTile.IsElem3d())
|
||||||
|
{
|
||||||
|
ExportTile3d(Core,ThisTile,OutTile);
|
||||||
|
}
|
||||||
OutTile.Set=SetNames.Add(SetName);
|
OutTile.Set=SetNames.Add(SetName);
|
||||||
fwrite(&OutTile,sizeof(sExpTile),1,File);
|
fwrite(&OutTile,sizeof(sExpTile),1,File);
|
||||||
fwrite(ThisTile.GetElemRGB(),FileHdr.TileW*FileHdr.TileH*3,1,File); // Write RGB
|
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)
|
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();
|
CTexCache &TexCache=Core->GetTexCache();
|
||||||
std::vector<sTriFace> &TileTriList=ThisTile.GetTriList();
|
std::vector<sTriFace> &TileTriList=ThisTile.GetTriList();
|
||||||
|
|
||||||
int TriCount=TileTriList.size();
|
TriStart=TriList.size();
|
||||||
|
TriCount=TileTriList.size();
|
||||||
OutTile.TriStart=TriList.size();
|
|
||||||
OutTile.TriCount=TriCount;
|
|
||||||
|
|
||||||
for (int T=0; T<TriCount; T++)
|
for (int T=0; T<TriCount; T++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,10 +28,11 @@ public:
|
||||||
void Write(void *Addr,int Len);
|
void Write(void *Addr,int Len);
|
||||||
int ExportLayerHeader(sLayerDef &LayerDef);//int Type,int SubType,int Width,int Height);
|
int ExportLayerHeader(sLayerDef &LayerDef);//int Type,int SubType,int Width,int Height);
|
||||||
int AddTile(sExpTile &Tile) {return(UsedTileList.Add(Tile));}
|
int AddTile(sExpTile &Tile) {return(UsedTileList.Add(Tile));}
|
||||||
|
void PadFile();
|
||||||
void ExportTiles(CCore *Core);
|
void ExportTiles(CCore *Core);
|
||||||
void ExportStrList(CCore *Core);
|
void ExportStrList(CCore *Core);
|
||||||
|
|
||||||
|
void ExportElem3d(CCore *Core,CElem &ThisElem,int &TriStart,int &TriCount);
|
||||||
protected:
|
protected:
|
||||||
void ExportTile(CCore *Core,sExpTile &ThisElem);
|
void ExportTile(CCore *Core,sExpTile &ThisElem);
|
||||||
void ExportTile3d(CCore *Core,CElem &ThisTile,sExpTile &OutTile);
|
void ExportTile3d(CCore *Core,CElem &ThisTile,sExpTile &OutTile);
|
||||||
|
|
|
@ -130,7 +130,8 @@ struct sLayerThingData
|
||||||
// Boxes
|
// Boxes
|
||||||
int Width,Height;
|
int Width,Height;
|
||||||
// Spare
|
// Spare
|
||||||
int Spare[4];
|
int TriStart,TriCount;
|
||||||
|
int Spare[2];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,6 @@ CComboBox &List=GUIPlatform.m_Type;
|
||||||
List.AddString("Weighted");
|
List.AddString("Weighted");
|
||||||
List.AddString("Rotating");
|
List.AddString("Rotating");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -171,3 +169,18 @@ void CLayerPlatform::SetThingParams(sLayerThing &Thing)
|
||||||
break;
|
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 GUIThingUpdate(bool OnlySel=false);
|
||||||
void GUIThingPointUpdate(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:
|
protected:
|
||||||
void SetThingParams(sLayerThing &Thing);
|
void SetThingParams(sLayerThing &Thing);
|
||||||
|
|
|
@ -720,18 +720,19 @@ int i,ListSize=ThingList.size();
|
||||||
Exp.Write(&ListSize,sizeof(int));
|
Exp.Write(&ListSize,sizeof(int));
|
||||||
for (i=0;i<ListSize; i++)
|
for (i=0;i<ListSize; i++)
|
||||||
{
|
{
|
||||||
ExportThing(Exp,ThingList[i]);
|
ExportThing(Core,Exp,ThingList[i]);
|
||||||
}
|
}
|
||||||
ExportThingNames(Exp);
|
ExportThingNames(Exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerThing::ExportThing(CExport &Exp,sLayerThing &ThisThing)
|
void CLayerThing::ExportThing(CCore *Core,CExport &Exp,sLayerThing &ThisThing)
|
||||||
{
|
{
|
||||||
int i,ListSize=ThisThing.XY.size();
|
int i,ListSize=ThisThing.XY.size();
|
||||||
sLayerThingData OutThing=ThisThing.Data;
|
sLayerThingData OutThing=ThisThing.Data;
|
||||||
|
|
||||||
OutThing.WaypointCount=ListSize;
|
OutThing.WaypointCount=ListSize;
|
||||||
|
ExportThingData(Core,Exp,ThisThing,OutThing);
|
||||||
Exp.Write(&OutThing,sizeof(sLayerThingData));
|
Exp.Write(&OutThing,sizeof(sLayerThingData));
|
||||||
|
|
||||||
// Point List
|
// Point List
|
||||||
|
@ -753,3 +754,4 @@ int i,ListSize=ThingList.size();
|
||||||
Exp.Write(Txt,strlen(Txt)+1);
|
Exp.Write(Txt,strlen(Txt)+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,8 @@ virtual void SaveThingNames(CFile *File);
|
||||||
virtual void LoadThingScript(const char *Filename);
|
virtual void LoadThingScript(const char *Filename);
|
||||||
|
|
||||||
virtual void Export(CCore *Core,CExport &Exp);
|
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);
|
virtual void ExportThingNames(CExport &Exp);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
|
|
|
@ -16,6 +16,18 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CMkLevelLayerPlatform::PreProcess(CMkLevel *Core)
|
void CMkLevelLayerPlatform::PreProcess(CMkLevel *Core)
|
||||||
{
|
{
|
||||||
|
int i,ListSize;
|
||||||
|
ProcessList(Core);
|
||||||
|
|
||||||
|
ListSize=ThingList.size();
|
||||||
|
RemapTable.resize(ListSize);
|
||||||
|
for (i=0; i<ListSize; i++)
|
||||||
|
{
|
||||||
|
sMkLevelLayerThing &ThisThing=ThingList[i];
|
||||||
|
RemapTable[i]=Core->AddPlatform(ThisThing);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%i Platforms\n",ThingList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -25,8 +37,6 @@ void CMkLevelLayerPlatform::PreProcess(CMkLevel *Core)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CMkLevelLayerPlatform::Process(CMkLevel *Core)
|
void CMkLevelLayerPlatform::Process(CMkLevel *Core)
|
||||||
{
|
{
|
||||||
ProcessList(Core);
|
|
||||||
printf("%i Platforms\n",ThingList.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -54,6 +64,7 @@ int i,ListSize=ThingList.size();
|
||||||
OutThing.TurnRate=ThisThing.Data.TurnRate;
|
OutThing.TurnRate=ThisThing.Data.TurnRate;
|
||||||
OutThing.Flags=ThisThing.Data.CollisionFlag;
|
OutThing.Flags=ThisThing.Data.CollisionFlag;
|
||||||
OutThing.PointCount=PointCount;
|
OutThing.PointCount=PointCount;
|
||||||
|
OutThing.Gfx=RemapTable[i];
|
||||||
fwrite(&OutThing,sizeof(sThingPlatform),1,File);
|
fwrite(&OutThing,sizeof(sThingPlatform),1,File);
|
||||||
|
|
||||||
for (p=0;p<PointCount;p++)
|
for (p=0;p<PointCount;p++)
|
||||||
|
|
|
@ -19,6 +19,8 @@ const char *GetTypeName() {return("PLATFORM");}
|
||||||
void Process(CMkLevel *Core);
|
void Process(CMkLevel *Core);
|
||||||
int Write(FILE *File,const char *LayerName,const char *MapName);
|
int Write(FILE *File,const char *LayerName,const char *MapName);
|
||||||
|
|
||||||
|
CList<int> RemapTable;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -111,7 +111,6 @@ GFName Path;
|
||||||
FlatFace[1].uv[0][0]=0; FlatFace[1].uv[0][1]=0;
|
FlatFace[1].uv[0][0]=0; FlatFace[1].uv[0][1]=0;
|
||||||
FlatFace[1].uv[1][0]=1; FlatFace[1].uv[1][1]=1;
|
FlatFace[1].uv[1][0]=1; FlatFace[1].uv[1][1]=1;
|
||||||
FlatFace[1].uv[2][0]=0; FlatFace[1].uv[2][1]=1;
|
FlatFace[1].uv[2][0]=0; FlatFace[1].uv[2][1]=1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
@ -146,7 +145,7 @@ int Size;
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
void CMkLevel::LoadStrList(CList<GString> &List,char *TexPtr,int Count)
|
void CMkLevel::LoadStrList(CList<GString> &List,char *TexPtr,int Count)
|
||||||
{
|
{
|
||||||
char FullName[256];
|
char FullName[1024];
|
||||||
GString FilePath;
|
GString FilePath;
|
||||||
|
|
||||||
for (int i=0; i<Count; i++)
|
for (int i=0; i<Count; i++)
|
||||||
|
@ -154,6 +153,8 @@ GString FilePath;
|
||||||
GString InName=InPath;
|
GString InName=InPath;
|
||||||
InName+=TexPtr;
|
InName+=TexPtr;
|
||||||
GFName::makeabsolute(InPath,InName,FullName);
|
GFName::makeabsolute(InPath,InName,FullName);
|
||||||
|
InName=FullName;
|
||||||
|
_fullpath( FullName, FullName, 1024);
|
||||||
List.push_back(GString(FullName));
|
List.push_back(GString(FullName));
|
||||||
TexPtr+=strlen(TexPtr)+1;
|
TexPtr+=strlen(TexPtr)+1;
|
||||||
}
|
}
|
||||||
|
@ -264,6 +265,7 @@ u8 *ByteHdr=(u8*)FileHdr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
//*** Process ***************************************************************
|
//*** Process ***************************************************************
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
@ -320,7 +322,7 @@ int i,ListSize=Tile2dList.size();
|
||||||
for (i=1; i<ListSize; i++)
|
for (i=1; i<ListSize; i++)
|
||||||
{ // Skip blank
|
{ // Skip blank
|
||||||
sExpLayerTile &ThisTile=Tile2dList[i];
|
sExpLayerTile &ThisTile=Tile2dList[i];
|
||||||
ThisTile.Tile=Create2dTex(ThisTile);
|
ThisTile.Tile=Create2dTex(ThisTile.Tile,ThisTile.Flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,8 +393,62 @@ u8 Outx0, Outy0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
int CMkLevel::AddPlatform(sMkLevelLayerThing &ThisThing)
|
||||||
|
{
|
||||||
|
sMkLevelPlatform ThisPlatform;
|
||||||
|
int Idx;
|
||||||
|
|
||||||
|
ThisPlatform.Name=ThisThing.Name;
|
||||||
|
Idx=PlatformList.Find(ThisPlatform);
|
||||||
|
|
||||||
|
if (Idx!=-1)
|
||||||
|
{
|
||||||
|
return(Idx);
|
||||||
|
}
|
||||||
|
Idx=PlatformList.size();
|
||||||
|
ThisPlatform.TriStart=OutFaceList.GetFaceCount();
|
||||||
|
ThisPlatform.TriCount=ThisThing.Data.TriCount;
|
||||||
|
|
||||||
|
PlatformList.Add(ThisPlatform);
|
||||||
|
|
||||||
|
// Add tri data
|
||||||
|
for (int i=0;i<ThisPlatform.TriCount; i++)
|
||||||
|
{
|
||||||
|
// sExpTri &ThisTri=InTriList[ThisPlatform.TriStart+i];
|
||||||
|
sExpTri &ThisTri=InTriList[i];
|
||||||
|
CFace F;
|
||||||
|
|
||||||
|
ExpTri2Face(ThisTri,F);
|
||||||
|
OutFaceList.AddFace(F);
|
||||||
|
}
|
||||||
|
return(Idx);
|
||||||
|
}
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
//***************************************************************************
|
||||||
|
void CMkLevel::ExpTri2Face(sExpTri &ThisTri,CFace &F,bool ImportTex)
|
||||||
|
{
|
||||||
|
if (ImportTex)
|
||||||
|
{
|
||||||
|
F.TexName=InTexNameList[ThisTri.TexID];
|
||||||
|
F.Mat=-1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
F.Mat=ThisTri.TexID;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int p=0; p<3; p++)
|
||||||
|
{
|
||||||
|
F.vtx[p]=ThisTri.vtx[p];
|
||||||
|
F.vtx[p].y=F.vtx[p].y;
|
||||||
|
F.uvs[p].u=ThisTri.uv[p][0];
|
||||||
|
F.uvs[p].v=ThisTri.uv[p][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//***************************************************************************
|
||||||
CMkLevelLayer *CMkLevel::FindLayer(int Type,int SubType)
|
CMkLevelLayer *CMkLevel::FindLayer(int Type,int SubType)
|
||||||
{
|
{
|
||||||
int ListSize=LayerList.size();
|
int ListSize=LayerList.size();
|
||||||
|
@ -429,13 +485,13 @@ int TileID=OutTile3dList.size();
|
||||||
float ThisZPos;
|
float ThisZPos;
|
||||||
|
|
||||||
ThisZPos=ThisTri.vtx[0].z;
|
ThisZPos=ThisTri.vtx[0].z;
|
||||||
if (ThisZPos>ThisTri.vtx[1].z) ThisZPos=ThisTri.vtx[1].z;
|
if (ThisZPos<ThisTri.vtx[1].z) ThisZPos=ThisTri.vtx[1].z;
|
||||||
if (ThisZPos>ThisTri.vtx[2].z) ThisZPos=ThisTri.vtx[2].z;
|
if (ThisZPos<ThisTri.vtx[2].z) ThisZPos=ThisTri.vtx[2].z;
|
||||||
|
|
||||||
ListSize=SortList.size();
|
ListSize=SortList.size();
|
||||||
for (ListPos=0; ListPos<ListSize; ListPos++)
|
for (ListPos=0; ListPos<ListSize; ListPos++)
|
||||||
{
|
{
|
||||||
if (ZPosList[ListPos]<ThisZPos) break;
|
if (ZPosList[ListPos]>ThisZPos) break;
|
||||||
}
|
}
|
||||||
SortList.insert(ListPos,ThisTri);
|
SortList.insert(ListPos,ThisTri);
|
||||||
ZPosList.insert(ListPos,ThisZPos);
|
ZPosList.insert(ListPos,ThisZPos);
|
||||||
|
@ -443,8 +499,8 @@ int TileID=OutTile3dList.size();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // create flat tile
|
{ // create flat tile (This is WRONG, flip tex are gen, need to flip goem)
|
||||||
int TexID=Create2dTex(InTile);
|
int TexID=Create2dTex(InTile.Tile,InTile.Flags);
|
||||||
|
|
||||||
ThisTile.TriCount=2;
|
ThisTile.TriCount=2;
|
||||||
for (int i=0; i<2; i++)
|
for (int i=0; i<2; i++)
|
||||||
|
@ -452,6 +508,7 @@ int TileID=OutTile3dList.size();
|
||||||
FlatFace[i].TexID=TexID;
|
FlatFace[i].TexID=TexID;
|
||||||
SortList.push_back(FlatFace[i]);
|
SortList.push_back(FlatFace[i]);
|
||||||
}
|
}
|
||||||
|
InTile.Flags=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add sorted list to main list
|
// Add sorted list to main list
|
||||||
|
@ -475,10 +532,10 @@ int TileID=OutTile3dList.size();
|
||||||
for (p=0; p<3; p++)
|
for (p=0; p<3; p++)
|
||||||
{
|
{
|
||||||
F.vtx[p]=ThisTri.vtx[p];
|
F.vtx[p]=ThisTri.vtx[p];
|
||||||
|
F.vtx[p].y=F.vtx[p].y;
|
||||||
F.uvs[p].u=ThisTri.uv[p][0];
|
F.uvs[p].u=ThisTri.uv[p][0];
|
||||||
F.uvs[p].v=ThisTri.uv[p][1];
|
F.uvs[p].v=ThisTri.uv[p][1];
|
||||||
}
|
}
|
||||||
// Flip 3d tiles
|
|
||||||
|
|
||||||
if (InTile.Flags & PC_TILE_FLAG_MIRROR_X)
|
if (InTile.Flags & PC_TILE_FLAG_MIRROR_X)
|
||||||
{
|
{
|
||||||
|
@ -495,6 +552,7 @@ int TileID=OutTile3dList.size();
|
||||||
F.vtx[2].y =1.0-F.vtx[2].y;
|
F.vtx[2].y =1.0-F.vtx[2].y;
|
||||||
SwapPnt^=1;
|
SwapPnt^=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SwapPnt)
|
if (SwapPnt)
|
||||||
{
|
{
|
||||||
Vector3 TmpV=F.vtx[0];
|
Vector3 TmpV=F.vtx[0];
|
||||||
|
@ -504,12 +562,7 @@ int TileID=OutTile3dList.size();
|
||||||
F.uvs[0]=F.uvs[1];
|
F.uvs[0]=F.uvs[1];
|
||||||
F.uvs[1]=TmpUV;
|
F.uvs[1]=TmpUV;
|
||||||
}
|
}
|
||||||
// Adjust Depth
|
|
||||||
for (p=0;p<3;p++)
|
|
||||||
{
|
|
||||||
// F.vtx[p].z-=4.0f;
|
|
||||||
// printf("%f\n",F.vtx[p].z);
|
|
||||||
}
|
|
||||||
|
|
||||||
OutFaceList.AddFace(F,true);
|
OutFaceList.AddFace(F,true);
|
||||||
}
|
}
|
||||||
|
@ -521,15 +574,14 @@ int TileID=OutTile3dList.size();
|
||||||
|
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
int CMkLevel::Create2dTex(sExpLayerTile &InTile)
|
int CMkLevel::Create2dTex(int Tile,int Flags)
|
||||||
{
|
{
|
||||||
sExpTile &SrcTile=InTileList[InTile.Tile];
|
sExpTile &SrcTile=InTileList[Tile];
|
||||||
int Idx;
|
int Idx;
|
||||||
sMkLevelTex InTex;
|
sMkLevelTex InTex;
|
||||||
|
|
||||||
// InTex.Set=UsedSetNameList.Add(InSetNameList[SrcTile.Set]);
|
InTex.Set=SrcTile.Set;
|
||||||
InTex.Set=SrcTile.Set;//UsedSetNameList.Add(InSetNameList[SrcTile.Set]);
|
InTex.Flags=Flags;
|
||||||
InTex.Flags=InTile.Flags;
|
|
||||||
InTex.XOfs=SrcTile.XOfs;
|
InTex.XOfs=SrcTile.XOfs;
|
||||||
InTex.YOfs=SrcTile.YOfs;
|
InTex.YOfs=SrcTile.YOfs;
|
||||||
InTex.RGB=SrcTile.RGB;
|
InTex.RGB=SrcTile.RGB;
|
||||||
|
@ -550,7 +602,6 @@ sMkLevelTex InTex;
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
int CMkLevel::BuildTileTex(sMkLevelTex &InTex)
|
int CMkLevel::BuildTileTex(sMkLevelTex &InTex)
|
||||||
{
|
{
|
||||||
ASSERT(InTex.Set>=0 && InTex.Set<InSetNameList.size())
|
|
||||||
Frame &InFrame=BmpList[InTex.Set];
|
Frame &InFrame=BmpList[InTex.Set];
|
||||||
Frame ThisFrame;
|
Frame ThisFrame;
|
||||||
Rect ThisRect;
|
Rect ThisRect;
|
||||||
|
@ -737,6 +788,7 @@ int i,ListSize;
|
||||||
|
|
||||||
// VtxList
|
// VtxList
|
||||||
LevelHdr.VtxList=(sVtx*)WriteVtxList();
|
LevelHdr.VtxList=(sVtx*)WriteVtxList();
|
||||||
|
// LevelHdr.VtxList=(sVtx*)OutFaceList.WriteVtxList(File);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -816,21 +868,21 @@ int CMkLevel::WriteVtxList()
|
||||||
vector<sVtx> const &VtxList=OutFaceList.GetVtxList();
|
vector<sVtx> const &VtxList=OutFaceList.GetVtxList();
|
||||||
int i,ListSize=VtxList.size();
|
int i,ListSize=VtxList.size();
|
||||||
int Pos=ftell(File);
|
int Pos=ftell(File);
|
||||||
sVtx Ofs;
|
//sVtx Ofs;
|
||||||
|
|
||||||
Ofs.vx=-0;
|
// Ofs.vx=-0;
|
||||||
Ofs.vy=-0;
|
// Ofs.vy=-0;
|
||||||
Ofs.vz=-4*Scale;
|
// Ofs.vz=-4*Scale;
|
||||||
|
|
||||||
for (i=0; i<ListSize; i++)
|
for (i=0; i<ListSize; i++)
|
||||||
{
|
{
|
||||||
sVtx const &In=VtxList[i];
|
sVtx const &In=VtxList[i];
|
||||||
sVtx Out;
|
sVtx Out;
|
||||||
|
|
||||||
Out.vx=+(In.vx+Ofs.vx);
|
Out.vx=+In.vx;
|
||||||
Out.vy=-(In.vy+Ofs.vy);
|
Out.vy=-In.vy;
|
||||||
Out.vz=+(In.vz+Ofs.vz);
|
Out.vz=+In.vz;
|
||||||
|
// printf("%i\n",Out.vz);
|
||||||
fwrite(&Out,1,sizeof(sVtx),File);
|
fwrite(&Out,1,sizeof(sVtx),File);
|
||||||
}
|
}
|
||||||
return(Pos);
|
return(Pos);
|
||||||
|
@ -863,6 +915,7 @@ void CMkLevel::WriteLayers()
|
||||||
LevelHdr.PlatformList=WriteThings(LAYER_TYPE_PLATFORM,"Platform List");
|
LevelHdr.PlatformList=WriteThings(LAYER_TYPE_PLATFORM,"Platform List");
|
||||||
LevelHdr.TriggerList=WriteThings(LAYER_TYPE_TRIGGER,"Trigger List");
|
LevelHdr.TriggerList=WriteThings(LAYER_TYPE_TRIGGER,"Trigger List");
|
||||||
LevelHdr.FXList=WriteThings(LAYER_TYPE_FX,"FX List");
|
LevelHdr.FXList=WriteThings(LAYER_TYPE_FX,"FX List");
|
||||||
|
LevelHdr.PlatformGfx=(sModel*)WritePlatformGfx();
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
@ -899,3 +952,23 @@ int Ofs;
|
||||||
PadFile(File);
|
PadFile(File);
|
||||||
return(Ofs);
|
return(Ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//***************************************************************************
|
||||||
|
int CMkLevel::WritePlatformGfx()
|
||||||
|
{
|
||||||
|
int i,ListSize=PlatformList.size();
|
||||||
|
int Ofs=ftell(File);
|
||||||
|
|
||||||
|
for (i=0; i<ListSize; i++)
|
||||||
|
{
|
||||||
|
sModel Out;
|
||||||
|
sMkLevelPlatform &ThisPlatform=PlatformList[i];
|
||||||
|
|
||||||
|
Out.TriCount=ThisPlatform.TriCount;
|
||||||
|
Out.TriStart=ThisPlatform.TriStart;
|
||||||
|
printf("Writing Platform %s (%i/%i)- %i Tris\n",ThisPlatform.Name,i+1,ListSize,Out.TriCount);
|
||||||
|
fwrite(&Out,1,sizeof(sModel),File);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(Ofs);
|
||||||
|
}
|
||||||
|
|
|
@ -37,6 +37,17 @@ bool operator ==(sMkLevelTex const &v1)
|
||||||
};
|
};
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
struct sMkLevelPlatform
|
||||||
|
{
|
||||||
|
GString Name;
|
||||||
|
int TriStart;
|
||||||
|
int TriCount;
|
||||||
|
|
||||||
|
bool operator ==(sMkLevelPlatform const &v1) {return(Name==v1.Name);}
|
||||||
|
};
|
||||||
|
|
||||||
|
//***************************************************************************
|
||||||
|
struct sMkLevelLayerThing;
|
||||||
class CMkLevelLayer;
|
class CMkLevelLayer;
|
||||||
class CMkLevel
|
class CMkLevel
|
||||||
{
|
{
|
||||||
|
@ -52,10 +63,11 @@ public:
|
||||||
void Process();
|
void Process();
|
||||||
int AddTile3d(sExpLayerTile &Tile) {return(Tile3dList.Add(Tile));}
|
int AddTile3d(sExpLayerTile &Tile) {return(Tile3dList.Add(Tile));}
|
||||||
int AddTile2d(sExpLayerTile &Tile) {return(Tile2dList.Add(Tile));}
|
int AddTile2d(sExpLayerTile &Tile) {return(Tile2dList.Add(Tile));}
|
||||||
|
int AddPlatform(sMkLevelLayerThing &ThisThing);
|
||||||
|
|
||||||
void Write();
|
void Write();
|
||||||
|
|
||||||
int Create2dTex(sExpLayerTile &ThisTile);
|
int Create2dTex(int Tile,int Flags);
|
||||||
int Create3dTile(sExpLayerTile &ThisTile);
|
int Create3dTile(sExpLayerTile &ThisTile);
|
||||||
int FindRGBMatch(sMkLevelTex &ThisTex);
|
int FindRGBMatch(sMkLevelTex &ThisTex);
|
||||||
bool IsRGBSame(const sMkLevelTex &Tile0,const sMkLevelTex &Tile1);
|
bool IsRGBSame(const sMkLevelTex &Tile0,const sMkLevelTex &Tile1);
|
||||||
|
@ -88,6 +100,7 @@ protected:
|
||||||
void WriteLayers();
|
void WriteLayers();
|
||||||
int WriteLayer(int Type,int SubType,const char *LayerName);
|
int WriteLayer(int Type,int SubType,const char *LayerName);
|
||||||
int WriteThings(int Type,const char *LayerName);
|
int WriteThings(int Type,const char *LayerName);
|
||||||
|
int WritePlatformGfx();
|
||||||
int WriteTriList();
|
int WriteTriList();
|
||||||
int WriteQuadList();
|
int WriteQuadList();
|
||||||
int WriteVtxList();
|
int WriteVtxList();
|
||||||
|
@ -95,6 +108,8 @@ protected:
|
||||||
|
|
||||||
void BuildTiles();
|
void BuildTiles();
|
||||||
|
|
||||||
|
void ExpTri2Face(sExpTri &In,CFace &Out,bool ImportTex=true);
|
||||||
|
|
||||||
FILE *File;
|
FILE *File;
|
||||||
GString InFilename,InPath,LevelName;
|
GString InFilename,InPath,LevelName;
|
||||||
GString OutName;
|
GString OutName;
|
||||||
|
@ -120,10 +135,10 @@ protected:
|
||||||
CTexGrab TexGrab;
|
CTexGrab TexGrab;
|
||||||
CList<Frame> BmpList;
|
CList<Frame> BmpList;
|
||||||
|
|
||||||
|
CList<sMkLevelPlatform> PlatformList;
|
||||||
vector<CMkLevelLayer*> LayerList;
|
vector<CMkLevelLayer*> LayerList;
|
||||||
|
|
||||||
sLevelHdr LevelHdr;
|
sLevelHdr LevelHdr;
|
||||||
// sTileBankHdr TileBankHdr;
|
|
||||||
sExpTri FlatFace[2];
|
sExpTri FlatFace[2];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue