DO/New PRJ Notes

From Dark Omen Wiki

< DO
Revision as of 20:58, 17 November 2008 by Rob (Talk | contribs)
Jump to: navigation, search

Contents

PRJ File format

The PRJ file format represents the world data (as opposed to the mission-specific data) for a Dark Omen battle.

Overall Structure

The Overall structure of a PRJ File is shown below. It is made up of sections, which appear in this order:

Header: The string "Dark Omen Battle File 1.10      " (32 bytes in total, padded with spaces)
'BASE': Indicates the terrain mesh to use
'WATR': Indicates the water mesh to use (if any)
'FURN': Lists the filenames for external meshes (buildings, trees etc)
'INST': Describes the position of external meshes (buildings, trees etc)
'TERR': The terrain heightmap, used for collision detection with the ground
        and possibly has other uses
'ATTR': Attribute flags for parts of the terrain
'EXCL': Unknown function at present
'MUSC': The music to use for this level
'TRAC': Camera tracks for the intro
'EDIT': Unknown function at present

Block Formats

Header

The header merely consists of the string "Dark Omen Battle File 1.10      ", which is used to identify the PRJ format.

'BASE'

The base section looks like this:

struct BASE
{
   unsigned char ID[4]; // = 'BASE'
   unsigned int lengthOfFilenameString;
   unsigned char filename[BASE.lengthOfFilenameString];
}

The minimum length of the filename is 1, since it is always null-terminated

'WATR'

This section is similar to the BASE section:

struct WATR
{
   unsigned char ID[4]; // = 'WATR'
   unsigned int lengthOfFilenameString;
   unsigned char filename[WATR.lengthOfFilenameString];
}

Again, the minimum length of the filename is 1, since it is always null-terminated

'FURN'

This section lists the filenames of any external meshes used in this level.

struct FURN
{
   unsigned int SizeOfCharBuffer; // size of the buffer that the app must allocate to store the list
   unsigned int ExternalMeshCount; // number of external meshes used
   struct emesh
   {
       unsigned int lengthOfFilenameString;
       unsigned char filename[emesh.lengthOfFilenameString];
   } ExternalMeshList[FURN.ExternalMeshCount];
}

Presumably, the original Dark Omen code would:

  1. allocate a buffer to hold all the string data
  2. create an array of pointers to char, one for each filename
  3. load each string into the buffer and set the appropriate pointer to the start of the associated string

Which would explain the slightly strange format.

Personal tools
communication