PEW File Format
Introduction
- To do...
Legend
Type | Description |
---|---|
byte | 8 bit (1 byte) |
short | 16 bit signed short (2 bytes) |
int | 32 bit signed integer (4 bytes) |
float | 32 bit signed single precision floating point value (4 bytes) |
double | 64 bit signed single precision floating point value (8 bytes) |
asciiz | Null terminated (0x00) variable length ascii string |
ascii | fixed length ascii string |
Although technically there should never be negetive values for many of the 16 bit & 32 bit values, it's 'safer' in programming terms to use signed datatypes as opposed to unsigned datatypes.
File Format
- The following is a mix of pseudo-code and structure references that could be used to describe the file format of POSEW60.pew project design file.
- Any naming definitions or naming conventions used may or may not be accurate.
- This file format is principally used with Armed Assault v1.09 and later plus the ArmA Tools Suite Final release (v1.14).
POSEW60
{
structHeader Header;
int NoOfObjectTypes;
structObjectType[NoOfObjectTypes] ObjectTypes;
short Unknown;
short Unknown;
short RoadNetworkTypesIndicator;
if(RoadNetworkTypesIndicator == 0)
{
int NoOfRoadNetworkTypes;
structRoadNetworkType[NoOfRoadNetworkTypes] RoadNetworkTypes;
int Unknown;//?Cross?
}
int TerrainGrid_X;
int TerrainGrid_Z;
float[TerrainGrid_Z,TerrainGrid_X] TerrainGridHeights;
int NoOfBlueFloats = (TerrainGrid_X / 16) * TerrainGrid_X;
float[NoOfBlueFloats] BlueEdgeTerrainHeights; //Always zero values.
int Unknown;
int NoOfObjects;
if (NoOfObjects != 0)
{
structObject[NoOfObjects] Objects;
while (i < NoOfObjects)
{
short Indicator;
if (Indicator != 0)
{
short Unknown;
int InstanceId;
float TransformColumn[4][3]; // described here to solidly illustrate to reader
// this is a standard DirectX Transform matrix
// but in COLUMN format;
double SomeCoef;
int NoOfCharsInInstanceName;
ascii[NoOfCharsInInstanceName] InstanceName;
float RelativeSurfaceElevation;
byte[4] OutlineColour; // rgba 0xFFFF FFFF means 'default'
byte[4] ObjectColour; // rgba 0xFFFF FFFF means 'default'
int ObjectTypeId;
}
}
}
int NoOfLayers;
structLayer[NoOfLayers] Layers;
}
Structures
structLayer
struct structLayer
{
int NoOfCharsInLayerName1;
ascii[NoOfCharsInLayerName1] LayerName1;
int LayerSizeType;
int NoOfCharsInLayerName2;
ascii[NoOfCharsInLayerName2] LayerName2;
short DefaultIndicator;
int NoOfTerrainMaterials;
if (NoOfTerrainMaterials != 0)
{
structTerrainMaterial[NoOfTerrainMaterials] TerrainMaterials;
}
}
structTerrainMaterial
struct structTerrainMaterial
{
int Unknown;
int NoOfCharsInMaterialName;
ascii[NoOfCharsInMaterialName] MaterialName;
int Unknown;
}
structObjectType
struct structObjectType
{
int NoOfCharsInObjectModelFilename;
ascii[NoOfCharsInObjectModelFilename] ModelFilename;
int NoOfCharsInObjectName;
ascii[NoOfCharsInObjectName] ObjectTypeName;
int ObjectClassId;
byte[4] OutlineColour; // rgba 0xFFFF FFFF means 'default'
byte[4] ObjectColour; // rgba 0xFFFF FFFF means 'default'
switch (ObjectClassId)
{
case ObjectClassEnum.Natural // 1
{
byte[118] VariousInfo;
}
case ObjectClassEnum.Artificial // 2
{
byte[118] VariousInfo;
}
case ObjectClassEnum.Road // 3
{
byte[214] VariousInfo;
}
}
int NoOfArtificialSubObjects;
if (NoOfArtificialSubObjects != 0)
{
structArtificialSubObject[NoOfArtificialSubObjects] ArtificialSubObjects;
}
int MarkerType; //See MarkerTypeEnum
int ObjectTypeId = VariousInfo.Offset(16).[4].ToInt; // The 4-bytes at offset 16 in the VariousInfo is the ObjectTypeId.
}
- NB: While the 'VariousInfo' byte array is decernable at this time it essentially defines various floats, integers, transforms etc. that denote the 'default' and/or 'seed' values for a given ObjectType.
- The most important data is the ObjectTypeId found at the 16th byte and is an 4-byte int.
structArtificialSubObject
struct structArtificialSubObject
{
int NoOfCharsInArtificialSubObjectName;
ascii[NoOfCharsInArtificialSubObjectName] ArtificialSubObjectName;
int Something1;
int Something2;
float[3][2] StartEndPosXYZ;
}
structRoadNetworkType
struct structRoadNetworkType
{
int NoOfCharsInRoadNetworkTypeName;
ascii[NoOfCharsInRoadNetworkTypeName] NetworkTypeName;
byte[4] KeyPartsColour; // rgba 0xFFFF FFFF means 'default'
byte[4] NormalPartsColour; // rgba 0xFFFF FFFF means 'default'
short FilledLine; // 0x0000=No, 0x0100=Yes
double MaxAngle; // degrees
double MaxBankAngle; // degrees
int NoOfStraightParts;
if (NoOfStraightParts != 0)
{
structRoadNetworkTypeStraightPart[NoOfStraightParts] RoadNetworkTypeStraightParts;
}
int NoOfCurveParts;
if (NoOfCurveParts != 0)
{
structRoadNetworkTypeCurvePart[NoOfCurveParts] RoadNetworkTypeCurveParts;
}
int NoOfSpecialParts;
if (NoOfSpecialParts != 0)
{
structRoadNetworkTypeSpecialPart[NoOfSpecialParts] RoadNetworkTypeSpecialParts;
}
int NoOfTerminatorParts;
if (NoOfTerminatorParts != 0)
{
structRoadNetworkTypeTerminatorPart[NoOfTerminatorParts] RoadNetworkTypeTerminatorParts;
}
}
structRoadNetworkTypeStraightPart
struct structRoadNetworkTypeStraightPart
{
int NoOfCharsInStraightPartName;
ascii[NoOfCharsInStraightPartName] StraightPartName;
int ObjectId;
short StraightPartType;
short CanChangeBankAngle;
}
structRoadNetworkTypeCurvePart
struct structRoadNetworkTypeCurvePart
{
int NoOfCharsInCurvePartName;
ascii[NoOfCharsInCurvePartName] CurvePartName;
int ObjectId;
short CurvePartType;
}
structRoadNetworkTypeSpecialPart
struct structRoadNetworkTypeSpecialPart
{
int NoOfCharsInSpecialPartName;
ascii[NoOfCharsInSpecialPartName] SpecialPartName;
int ObjectId;
short SpecialPartType;
short CanChangeBankAngle;
}
structRoadNetworkTypeTerminatorPart
struct structRoadNetworkTypeTerminatorPart
{
int NoOfCharsInTerminatorPartName;
ascii[NoOfCharsInTerminatorPartName] TerminatorPartName;
int ObjectId;
short TerminatorPartType;
short CanChangeBankAngle;
}
structLayer
struct structLayer
{
int NoOfCharsInTerminatorPartName;
ascii[NoOfCharsInTerminatorPartName] TerminatorPartName;
int ObjectId;
short TerminatorPartType;
short CanChangeBankAngle;
}
Enums
ObjectClassEnum
enum ObjectClassEnum
{
Natural = 1,
Artificial = 2,
Road = 3
}
MarkerTypeEnum
enum MarkerTypeEnum
{
Rectangular = 0,
Elliptical = 1
}