M3 SC2

From wowdev
Revision as of 17:53, 23 February 2010 by Unknown user (talk)
Jump to navigation Jump to search

This file format is actually no WoW file format. Its the next generation of the MDX model format which had MDX (m1) in WC3 / prior to WoW, MDX2 (m2) in WoW, MDX2.2 (m2 with skin and anim) in WoW:WotLK and MDX3 (m3) in SC2.

As always, the format has similarities but also big revamps like on references this time.

Instead of using direct references, the references are now all in one global list. This list also contains the type and number of entries referenced (as well as another uint32). If one block references another one, it only says, how many of that data is referenced (similar to the entry in the reference table) and which reference is referenced (the id in the global list).

The reference table consists of entries of this structure:

struct referenceentry 
{
  /*0x00*/ uint32_t type;
  /*0x04*/ uint32_t offset;
  /*0x08*/ uint32_t entries;
  /*0x0C*/ uint32_t unk_0C;
};

When a block is referenced somewhere, the reference looks like this:

struct reference 
{
  /*0x00*/ uint32_t entries;
  /*0x04*/ uint32_t referenceid;
};

The position of the reference table is not fixed and mostly on the end of the file due to easier saving. The position is told in the header of the file:

struct MD33
{
  /*0x00*/ uint32_t token; // 'MD33'
  /*0x04*/ uint32_t offsettotable;
  /*0x08*/ uint32_t entriesoftable;
  /*0x0C*/ reference MODL;
};

The MODL block is the actual information about the model.

Typelist

'CHAR' = char, contains a zero-terminated string of Length nEntries

'U32_' = uint32

'I32_' = int32

'U16_' = uint16

'U8__' = uint8 = unsigned char


'STC_'

Size: 0x8D

Follows after some blocks, additional information?

'SDEV'

Size: 0x18

'EVNT'

Size: 0x5C

Events?

'SDG_'

'MODL'

type: 'MODL'
size: 0x228

The 'CHAR'-block following contains the *.max filename at blizzard.

Sequences

type: 'SEQS'
Size: 0x58

This defines the Animation sequences. The 'CHAR'-block after 'SEQS' contains the name of the Animation (like 'Stand', 'Stand Work' etc.)

Bones

type: 'BONE'
Size: 0x9C

This block contains the bones, the 'CHAR'-block afterwards contains the name of the bone.