Quote:
Originally Posted by viper4513
i shall give it another go looking at what you posted.
|
the boring thing is the map-height at beginning of the file...
a .wld file is as follows:
- format identifier ('FLD\0' or 'DUN\0')
for FLD format only:
- map size (long), all map are square, this is the length of a side
- the map-height, ... a mess (so far), if the map size is 1024 (Apu & others) this block is 789507 long, so skip that length
- textures-waves array, a number of records as long and then record defined as:
- texture name (256 char)
- ident (long)
- wave name (256 chars)
then for FLD & DUN:
- name of ground file (256 chars)
- buildings (Element)
- shapes (Element)
- trees (Element)
- grass (Element)
- VANI (Element)
- VANI(2) (Element)
- more (Element)
- MANI (Element) (coords have a additional long ident)
- name of effects file (char 256)
- vertices (array of locations: counter +
N * 40 bytes)
- 3 longs always null (maybe linked to the vertices just before)
- Objects (Element)
- Sound/Music items
- Sound/Back items
- trailing data
(for sound areas (x,y,z) is the first point, (r,s,t) is the second - the columns u,v,w are used by Element coordinates only)
an 'Element' is:
- an array of names, ie nb of string as long,
N string as char256
- an array of locations, ie nb of records,
N records of 40 bytes (44 for MANI records)
a Sound array is:
- an array of file names, ie nb of string as long,
N string as char256
- an array of locations, ie nb of records and N records of 36 bytes (as listed in previous post)
with this info you can write a Q&D piece of code to read/write a .wld and modify on the fly the Sound arrays - the only constraint is to copy the full map-height block as well as the trailing data, and to comply with structures of each Element & Sound array, you will simply adjust the number of records according the added / removed filenames and/or locations.
Also note that "Environnement Sound" (Sound/Back) areas are usually larger (of course) and they don't stop to play while a "Background Music" (Sound/Music) is played when the toon enters its area.
(quoted name are those of the game sound control panel).