Friday, July 17, 2009

Silkroad maps (SMViewer) project


Hereby, I am announcing it as my new project. I am going to use VC++ and DirectX (9.x), so project wont be Mac/Linux portable.

I have many reasons why I am doing this; one of them is that I would like to make IntroScript editor.

Surface map file (.m)
Brief description of m-map file, which contains surface height and surface texture mapping (with rendering options and brightness).

Header
Size    Type            Name            Description
---------------------------------------------------
8 char type File format type
4 char version Version of file format type
Content
Map block
  • Each map block contains header with unknown meaning.
  • Each map block contains data block with unknown meaning.
  • Each map block contains 17x17 grid of cells.
Size    Type            Name            Description
---------------------------------------------------
6 char header Header, unknown meaning
2023 - - Cells
546 char unknown Unknown data block
Map cell
  • Water begins on level 0.
Size    Type            Name            Description
---------------------------------------------------
4 float height Height of map cell
10b surfaceId Surface texture ID
1b flag_6
1b flag_5
1b flag_4
1b flag_3
1b flag_2
1b flag_1
1 char light Lightness of texture
VC++ notation
struct MBlock
{
        unsigned char header[6];
        MCell grid[17][17];
        unsigned char unknown[546];
};


struct MCell
{
        float height;
        unsigned short surfaceId : 10;
        unsigned short flag_6 : 1;
        unsigned short flag_5 : 1;
        unsigned short flag_4 : 1;
        unsigned short flag_3 : 1;
        unsigned short flag_2 : 1;
        unsigned short flag_1 : 1;
        unsigned char light;
};


Object map file (.o)
Brief description of o-map file, which maps objects into world.

Content
Group
Size    Type            Name            Description
---------------------------------------------------
2 short objectCount Amount of objects in group
Block
Size    Type            Name            Description
---------------------------------------------------
4 long objectId Object model ID
4 float positionX X coord (from left bottom corner of region)
4 float positionY Y coord
4 float positionZ Z coord
2 short unknown 0xffff or 0x0000
4 float theta Angle on Axis Y
4 long unique Unique id of object, if same, object is not shown
2 short unknown 0x0000 or 0x0001
1 char regionX X of region to be used as offset
1 char regionY Y of region to be used as offset
VC++ notation
struct OGroup
{
unsigned short objectCount;
};

struct OBlock
{
unsigned int objectId;
float positionX;
float positionY;
float positionZ;
unsigned short unknown_1;
float theta;
unsigned int unique;
unsigned short unknown_2;
unsigned char regionX;
unsigned char regionY;
};

No comments:

Post a Comment