2001-04-17 18:42:07 +02:00
|
|
|
/**********************/
|
|
|
|
/*** Layer Platform ***/
|
|
|
|
/**********************/
|
|
|
|
|
|
|
|
#include <Davelib.h>
|
|
|
|
#include <List2d.h>
|
|
|
|
|
|
|
|
//#include "MkLevel.h"
|
|
|
|
#include "MkLevelLayerPlatform.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*** Pre-Process *************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CMkLevelLayerPlatform::PreProcess(CMkLevel *Core)
|
|
|
|
{
|
2001-04-23 16:51:44 +02:00
|
|
|
int i,ListSize;
|
|
|
|
ProcessList(Core);
|
|
|
|
|
|
|
|
ListSize=ThingList.size();
|
|
|
|
RemapTable.resize(ListSize);
|
|
|
|
for (i=0; i<ListSize; i++)
|
|
|
|
{
|
|
|
|
sMkLevelLayerThing &ThisThing=ThingList[i];
|
2001-04-30 23:49:54 +02:00
|
|
|
RemapTable[i]=Core->AddModel(ThisThing.Name,ThisThing.Data.Platform.PlatformTriStart,ThisThing.Data.Platform.PlatformTriCount);
|
2001-04-23 16:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
printf("%i Platforms\n",ThingList.size());
|
2001-04-17 18:42:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*** Process *****************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CMkLevelLayerPlatform::Process(CMkLevel *Core)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/** Write ********************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
2001-06-25 17:54:07 +02:00
|
|
|
int CMkLevelLayerPlatform::Write(CMkLevel *Core,FILE *File,const char *LayerName)
|
2001-04-17 18:42:07 +02:00
|
|
|
{
|
|
|
|
int ThisPos=ftell(File);
|
|
|
|
sThingHdr Hdr;
|
|
|
|
int i,ListSize=ThingList.size();
|
|
|
|
|
|
|
|
Hdr.Count=ListSize;
|
|
|
|
fwrite(&Hdr,sizeof(sThingHdr),1,File);
|
|
|
|
|
|
|
|
for (i=0; i<ListSize; i++)
|
|
|
|
{
|
|
|
|
sMkLevelLayerThing &ThisThing=ThingList[i];
|
|
|
|
int p,PointCount=ThisThing.XY.size();
|
|
|
|
sThingPlatform OutThing;
|
|
|
|
|
|
|
|
OutThing.Type=ThisThing.Type;
|
2001-04-30 23:49:54 +02:00
|
|
|
OutThing.Speed=ThisThing.Data.Platform.PlatformSpeed;
|
|
|
|
OutThing.TurnRate=ThisThing.Data.Platform.PlatformTurnRate;
|
2001-05-09 23:56:48 +02:00
|
|
|
OutThing.Flags=0;
|
|
|
|
if (ThisThing.Data.Platform.PlatformCollisionFlag) OutThing.Flags|=THING_FLAG_COLLISION;
|
|
|
|
if (ThisThing.Data.Flip & PC_TILE_FLAG_MIRROR_X) OutThing.Flags|=THING_FLAG_MIRRORX;
|
|
|
|
if (ThisThing.Data.Flip & PC_TILE_FLAG_MIRROR_Y) OutThing.Flags|=THING_FLAG_MIRRORY;
|
|
|
|
|
2001-04-17 18:42:07 +02:00
|
|
|
OutThing.PointCount=PointCount;
|
2001-04-23 16:51:44 +02:00
|
|
|
OutThing.Gfx=RemapTable[i];
|
2001-05-05 23:18:12 +02:00
|
|
|
OutThing.Param0=ThisThing.Data.Platform.PlatformParam0;
|
2001-04-17 18:42:07 +02:00
|
|
|
fwrite(&OutThing,sizeof(sThingPlatform),1,File);
|
|
|
|
|
|
|
|
for (p=0;p<PointCount;p++)
|
|
|
|
{
|
|
|
|
sThingPoint Pnt;
|
|
|
|
Pnt.X=ThisThing.XY[p].x;
|
|
|
|
Pnt.Y=ThisThing.XY[p].y;
|
|
|
|
fwrite(&Pnt,sizeof(sThingPoint),1,File);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-25 17:54:07 +02:00
|
|
|
Size=ftell(File)-ThisPos;
|
2001-04-17 18:42:07 +02:00
|
|
|
return(ThisPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|