Vagrant Story/MPD files

From Data Crystal
Jump to navigation Jump to search

This is a sub-page of Vagrant Story.

MPD files store all map data of a single room, i.e. geometry, enemies, doors, and so on. Textures are not part of the MPD, instead they are stored in the ZND files.

File Format

MPD_HEADER =======================================
	$0	4	ptrRoomSection
	$4	4	lenRoomSection
	$8	4	ptrClearedSection
	$C	4	lenClearedSection
	$10	4	ptrScriptSection
	$14	4	lenScriptSection
	$18	4	ptrDoorSection
	$1C	4	lenDoorSection
	$20	4	ptrEnemySection
	$24	4	lenEnemySection
	$28	4	ptrTreasureSection
	$2C	4	lenTreasureSection

+ RoomSection ====================================
	+RoomHeader
		+$00	4	lenGeometrySection
		+$04	4	lenCollisionSection
		+$08	4	lenSubSection03
		+$0C	4	lenDoorSection
		+$10	4	lenLightingSection
 		+$14	4	lenSubSection06
 		+$18	4	lenSubSection07
		+$1C	4	lenSubSection08
		+$20	4	lenSubSection09
		+$24	4	lenSubSection0A
 		+$28	4	lenSubSection0B
  		+$2C	4	lenTextureEffectsSection (Fire, SavePoints, ExitArrows etc)
		+$30	4	lenSubSection0D
		+$34	4	lenSubSection0E
		+$38	4	lenSubSection0F
		+$3C	4	lenSubSection10
		+$40	4	lenSubSection11
		+$44	4	lenSubSection12
		+$48	4	lenSubSection13
		+$4C	4	lenAKAOSubSection (Audio)
		+$50	4	lenSubSection15
		+$54	4	lenSubSection16
		+$58	4	lenSubSection17
		+$5C	4	lenSubSection18
	+ GeometrySection (Polygon groups)
		+$00	4	numGroups
		for (numGroups)
			+$00	$40	GroupHeaderStructure
		for (numGroups)
			+$00	4	numPoly3gts
			+$04	4	numPoly4gts
			for (numPoly3gts)
				+$00	2	p1x
				+$02	2	p1y
				+$04	2	p1z
				+$06	1	p2x ( Relative to p1 )
				+$07	1	p2y ( Relative to p1 )
				+$08	1	p2z ( Relative to p1 )
				+$09	1	p3x ( Relative to p1 )
				+$0A	1	p3y ( Relative to p1 )
				+$0B	1	p3z ( Relative to p1 )
				+$0C	1	r1
				+$0D	1	g1
				+$0E	1	b1
				+$0F	1	type // 52|54 => triangle. 60|62 => quad. maybe doublesided?
				+$10	1	r2
				+$11	1	g2
				+$12	1	b2
				+$13	1	u3
				+$14	1	r3
				+$15	1	g3
				+$16	1	b3
				+$17	1	v3
				+$18	1	u1
				+$19	1	v1
				+$1A	2	texelMask ( Controls texel transparency )
				+$1C	1	u2
				+$1D	1	v2
				+$1E	2	idTexture ( Changes value at runtime )
			for (numPoly4gts)
				+$00	2	p1x
				+$02	2	p1y
				+$04	2	p1z
				+$06	1	p2x ( Relative to p1 )
				+$07	1	p2y ( Relative to p1 )
				+$08	1	p2z ( Relative to p1 )
				+$09	1	p3x ( Relative to p1 )
				+$0A	1	p3y ( Relative to p1 )
				+$0B	1	p3z ( Relative to p1 )
				+$0C	1	r1
				+$0D	1	g1
				+$0E	1	b1
				+$0F	1	type // 52|54 => triangle. 60|62 => quad. maybe doublesided?
				+$10	1	r2
				+$11	1	g2
				+$12	1	b2
				+$13	1	u3
				+$14	1	r3
				+$15	1	g3
				+$16	1	b3
				+$17	1	v3
				+$18	1	u1
				+$19	1	v1
				+$1A	2	texelMask ( Controls texel transparency )
				+$1C	1	u2
				+$1D	1	v2
				+$1E	2	idTexture ( Changes value at runtime )
				+$20	1	p4x ( Relative to p1 )
				+$21	1	p4y ( Relative to p1 )
				+$22	1	p4z ( Relative to p1 )
				+$23	1	u4
				+$24	1	r4
				+$25	1	g4
				+$26	1	b4
				+$27	1	v4
	+ CollisionSection
		+$00	2	TyleWidth
		+$02	2	TyleHeight
		+$04	4	unknown
		for (TyleWidth*TyleHeight) // West to East, South to North
			+$00	1	FloorHeight
		for (TyleWidth*TyleHeight) // West to East, South to North
			+$00	1	CeilingHeight
		for (TyleWidth*TyleHeight/2) // appears to be nibble based
			+$00	1/2?	Incline (angle of the floor tyle)
		+$00	?	unknown (some form of bitmask one bit per tyle)
	+ SubSection03
	+ DoorSection
		for (numDoors) // numDoors = lenDoorSection/0x0C
			+$00	1	destZone
			+$01	1	destRoom
			+$02	6	unknown
			+$08	4	idCurrentDoor
	+ LightingSection
 	+ SubSection06
 	+ SubSection07
	+ SubSection08
	+ SubSection09
	+ SubSection0A
 	+ SubSection0B
  	+ TextureEffectsSection (Fire, SavePoints, ExitArrows etc)
	+ SubSection0D
	+ SubSection0E
	+ SubSection0F
	+ SubSection10
	+ SubSection11
	+ SubSection12
	+ SubSection13
	+ AKAOSubSection (Audio)
	+ SubSection15
	+ SubSection16
	+ SubSection17
	+ SubSection18
+ ClearedSection ====================================
+ ScriptSection =====================================
       +$00	2	lenScriptSection
       +$02	2	ptrDialogText
       +$04	2	ptrUnknown1
       +$06	2	ptrUnknown2
       +$08	2	Unknown1 (Always == 0?)
       +$0A	2	Unknown2 (Always == 0?)
       +$0C	2	Unknown3 (Always == 0?)
       +$0E	2	Unknown4 (Always == 0?)
       +$10 ScriptOpcodes
               +$00	?	Opcodes (as per Script Opcodes)
       +(ptrDialogText) DialogText
               +$00	2	numDialogs/ptrDialogText[0]
               for (numDialogs-1)
                       +$00	2	ptrDialogText
               for (numDialogs-1)
                       +$00	$	Dialog Text (as per VS Character Set)
       +(ptrUnknown1) Unknown1
               +$00	?	Unknown data
       +(ptrUnknown2) Unknown2
               +$00	2	Unknown data

+ DoorSection ====================================
+ EnemySection ===================================
+ TreasureSection ================================
       +$000 weapon blade
             +$0    $4    ? unknown (always 3 if item exists 0 otherwise)
             +$4    $1    itemnames list
             +$5    $1    items list
             +$6    $1    WEP files
             +$7    $1    item categories
             +$8    $2    DPmax*100
             +$A    $2    PPmax
             +$C    $2    DPcurrent*100
             +$E    $2    PPcurrent
             +$10   $1    STR
             +$11   $1    INT
             +$12   $1    AGL
             +$13   $1    cost value
             +$14   $1    bits 0+1 = damage type bits 3 and above = stat affected
             +$15   $3    ? unknown (always zero)
             +$18   $4    range
             +$1C   $8    classes
             +$24   $8    affinities
             +$2C   $2    materials list
             +$2E   $2    ? unknown (always zero)
       +$030 weapon grip
             +$0    $2    itemnames list
             +$2    $1    items list
             +$3    $1    item categories
             +$4    $1    number of gem slots
             +$5    $1    STR
             +$6    $1    INT
             +$7    $1    AGL
             +$8    $4    types
             +$C    $4    ? unknown (always zero)
       +$040 weapon gem slot 1
             +$0    $2    itemnames list
             +$2    $1    items list
             +$3    $1    ? unknown (always zero)
             +$4    $1    ? unknown (most likely this is special effect)
             +$5    $1    STR
             +$6    $1    INT
             +$7    $1    AGL
             +$8    $8    classes
             +$10   $8    affinities
             +$18   $4    ? unknown (always zero)
       +$05C weapon gem slot 2
             +$0    $2    itemnames list
             +$2    $1    items list
             +$3    $1    ? unknown (always zero)
             +$4    $1    ? unknown (most likely this is special effect)
             +$5    $1    STR
             +$6    $1    INT
             +$7    $1    AGL
             +$8    $8    classes
             +$10   $8    affinities
             +$18   $4    ? unknown (always zero)
       +$078 weapon gem slot 3
             +$0    $2    itemnames list
             +$2    $1    items list
             +$3    $1    ? unknown (always zero)
             +$4    $1    ? unknown (most likely this is special effect)
             +$5    $1    STR
             +$6    $1    INT
             +$7    $1    AGL
             +$8    $8    classes
             +$10   $8    affinities
             +$18   $4    ? unknown (always zero)
       +$094 weapon name
             +00    $18   $18str weapon name
       +$0AC blade
             +$0    $4    ? unknown (always 3 if item exists 0 otherwise)
             +$4    $1    itemnames list
             +$5    $1    items list
             +$6    $1    WEP files
             +$7    $1    item categories
             +$8    $2    DPmax*100
             +$A    $2    PPmax
             +$C    $2    DPcurrent*100
             +$E    $2    PPcurrent
             +$10   $1    STR
             +$11   $1    INT
             +$12   $1    AGL
             +$13   $1    cost value
             +$14   $1    bits 0+1 = damage type bits 3 and above = stat affected
             +$15   $3    ? unknown (always zero)
             +$18   $4    range
             +$1C   $8    classes
             +$24   $8    affinities
             +$2C   $2    materials list
             +$2E   $2    ? unknown (always zero)
       +$0CC grip
             +$0    $4    unknown (always 3 if item exists 0 otherwise)
             +$4    $2    itemnames list
             +$6    $1    items list
             +$7    $1    item categories
             +$8    $1    number of gem slots
             +$9    $1    STR
             +$A    $1    INT
             +$B    $1    AGL
             +$C    $4    types
             +$10   $4    ? unknown (always zero)
       +$0DC sheild
             +$0    $4    unknown (always 3 if item exists 0 otherwise)
             +$4    $1    itemnames list
             +$5    $1    items list
             +$6    $1    WEP files
             +$7    $1    item categories
             +$8    $2    DPmax*100
             +$A    $2    PPmax
             +$C    $2    DPcurrent*100
             +$E    $2    PPcurrent
             +$10   $1    number of gem slots
             +$11   $1    STR
             +$12   $1    INT
             +$13   $1    AGL
             +$18   $4    types
             +$1C   $8    classes
             +$24   $8    affinities
             +$2C   $2    materials list
             +$2E   $2    ? unknown (always zero)
       +$11C sheild gem slot 1
             +$0    $2    itemnames list
             +$2    $1    items list
             +$3    $1    ? unknown (always zero)
             +$4    $1    ? unknown (most likely this is special effect)
             +$5    $1    STR
             +$6    $1    INT
             +$7    $1    AGL
             +$8    $8    classes
             +$10   $8    affinities
             +$18   $4    ? unknown (always zero)
       +$138 sheild gem slot 2
             +$0    $2    itemnames list
             +$2    $1    items list
             +$3    $1    ? unknown (always zero)
             +$4    $1    ? unknown (most likely this is special effect)
             +$5    $1    STR
             +$6    $1    INT
             +$7    $1    AGL
             +$8    $8    classes
             +$10   $8    affinities
             +$18   $4    ? unknown (always zero)
       +$154 sheild gem slot 3
             +$0    $2    itemnames list
             +$2    $1    items list
             +$3    $1    ? unknown (always zero)
             +$4    $1    ? unknown (most likely this is special effect)
             +$5    $1    STR
             +$6    $1    INT
             +$7    $1    AGL
             +$8    $8    classes
             +$10   $8    affinities
             +$18   $4    ? unknown (always zero)
       +$170 armour 1
             +$0    $4    unknown (always 3 if item exists 0 otherwise)
             +$4    $1    itemnames list
             +$5    $1    items list
             +$6    $1    ? unknown (always zero)
             +$7    $1    item categories
             +$8    $2    DPmax*100
             +$A    $2    PPmax (always zero)
             +$C    $2    DPcurrent*100
             +$E    $2    PPcurrent (always zero)
             +$10   $1    ? unknown (always zero)
             +$11   $1    STR
             +$12   $1    INT
             +$13   $1    AGL
             +$18   $4    types
             +$1C   $8    classes
             +$24   $8    affinities
             +$2C   $2    materials list
             +$2E   $2    ? unknown (always zero)
       +$1A0 armour 2
             +$0    $4    unknown (always 3 if item exists 0 otherwise)
             +$4    $1    itemnames list
             +$5    $1    items list
             +$6    $1    ? unknown (always zero)
             +$7    $1    item categories
             +$8    $2    DPmax*100
             +$A    $2    PPmax (always zero)
             +$C    $2    DPcurrent*100
             +$E    $2    PPcurrent (always zero)
             +$10   $1    ? unknown (always zero)
             +$11   $1    STR
             +$12   $1    INT
             +$13   $1    AGL
             +$18   $4    types
             +$1C   $8    classes
             +$24   $8    affinities
             +$2C   $2    materials list
             +$2E   $2    ? unknown (always zero)
       +$1D0 accessory
             +$0    $4    unknown (always 3 if item exists 0 otherwise)
             +$4    $1    itemnames list
             +$5    $1    items list
             +$6    $1    ? unknown (always zero)
             +$7    $1    item categories
             +$8    $2    DPmax*100 (always zero)
             +$A    $2    PPmax (always zero)
             +$C    $2    DPcurrent*100 (always zero)
             +$E    $2    PPcurrent (always zero)
             +$10   $1    ? unknown (always zero)
             +$11   $1    STR
             +$12   $1    INT
             +$13   $1    AGL
             +$18   $4    types
             +$1C   $8    classes
             +$24   $8    affinities
             +$2C   $4    ? unknown (always zero)
       +$200 gem
             +$0    $4    unknown (always 3 if item exists 0 otherwise)
             +$4    $2    itemnames list
             +$6    $1    items list
             +$7    $1    ? unknown (always zero)
             +$8    $1    ? unknown (most likely this is special effect)
             +$9    $1    STR
             +$A    $1    INT
             +$B    $1    AGL
             +$C    $8    classes
             +$14   $8    affinities
             +$1C   $4    ? unknown (always zero)
       +$220 misc items
             for 4 misc items
                    +$0    $2    itemnames list
                    +$2    $1    ? unknown (always 3 if item exists 0 otherwise)
                    +$3    $1    quantity

Notes

Polygons are defined as an absolute base vector p1 and offsets p2,p3, and p4 in case of a quad. The offsets need to be scaled, usually by a factor of 8. For example, the absolute p2' is (p1 + p2 * 8).

Todo

Some offset vectors are not scaled by 8. The table, e.g. in 001.MPD (group 4) is scaled by 1. It is unknown where this scale factor is defined or applied. Need to investigate this.