Vagrant Story/ZND files

From Data Crystal
Jump to navigation Jump to search

This is a sub-page of Vagrant Story.

The ZND files define groups of rooms, i.e. Zones. They define references to enemies (ZUD files) and textures to be used by the individual rooms which are defined by the MPD files.

File Format

$0	4	pointer_MPD
$4	4	lenght_MPD \num_MPD = lenght_MPD/8\
$8	4	pointer_enemies
$c	4	lenght_enemies
$10	4	pointer_TIM
$14	4	lenght_TIM
$18	1	index in WAVE file list (SLUS $3b9b0)
$19	7	? unused?
$20	MPD_section:
	FOR {num_MPD} MPD:
		$0	4	LBA MPD
		$4	4	file size (bytes, rounded up to multiple of $800)
+	enemies_section:
	$0	4	num_enemies
	$4	FOR {num_enemies} ZUD:
		$0	4	LBA ZUD
		$4	4	file size (bytes, rounded up to multiple of $800)
	+	FOR {num_enemies} enemy: // $464 bytes each
		$0	2	? 
		$2	1	location in table for 3d model special effect
		$3	1	? 
		$4	$18str	name
		$1c	main:
			$0	2	HP
			$2	2	MP
			$4	1	STR
			$5	1	INT
			$6	1	AGI
			$7	1	?
			$8	1	? 
			$9	1	walking speed whilst carrrying crates 
			$a	1	? 
			$b	1	running speed
			?
			$14	1	? 
			$15	1	? 
			$16	1	? 
			$17	1	? 
		$34	weapon:
			$0	blade: equip data
			$30	grip: equip data
			$60	gem1: equip data
			$90	gem2: equip data
			$c0	gem3: equip data
			$f0	other:
				$0	1	materials list
				$1	1	drop chance/255
				$2	?	?
				$3	?	?
				$4	$18str	name
		$140	shield:
			$0	shield: equip data
			$30	gem1: equip data
			$60	gem2: equip data
			$90	gem3: equip data
			$c0	other:
				$0	1	materials list
				$1	1	drop chance/255
				$2	?	?
				$3	?	?
		$204	accessory:
			$0	accessory: equip data
			$30	other:
				$0	1	drop chance/255
				$1	?	?
				$2	?	?
				$3	?	?
		$238	FOR 6 bodypart: // $5c bytes each
			$0	2	HP
			$2	1s	AGI defensive bonus
			$3	1s?	chain evasion
			$4	4*1s	types
			$8	8*1s	affinities
			$10	FOR 4 skill: // $4 bytes each
				$0	1	skills list
				$1  	1	?
				$2	1	?
				$3	1	local skill number (0-3)
			$20	armor:
				$0	armor: equip data
				$30	other:
					$0	1	materials list
					$1	1	drop chance/255
					$2	?	? always 1 for armours?
					$3	?	?
			$54	6*1	damage distribution % across each of six body parts
			$5A	?	? unused?
			$5B	?	? unused?
		$460	4	enemy identifier, used by MPD
+	TIM_section:
	$0	4	lenght of section
	$4	12	? unused?
	$10	4	num_TIMs
	$14	FOR {num_TIMs} TIM_data:
		$0	4	TIM lenght
		$4	TIM format

Notes

The TIM format mostly follows wiki.qhimm.com/view/PSX/TIM_file.

However, there are some differences. The last 4 TIMs are usually, with some exceptions, palettes with 16bit actual color values. All the TIMs before are 4-bit color maps, and have been successfully exported as grey textures, without color lookup. All of the TIMs are defined as BPP = 10 and there never are CLUTs (need to confirm this).

Todo

The color lookup for the 4-bit color maps has not been understood yet. Some of the palette TIMs have more than 16 colors and hence, the lookup cannot be a direct palette lookup.