Help - Search - Members - Calendar
Full Version: MDATA11 problems and questions
Braindead's Mordor Site - Return to Mordor: The Depths Of Dejenol > Mordor: The Depths Of Dejenol > Modding And Development
Ok, so Ive been working on unpacking the MDATA11 file so I can load old Mordor/Mordor 2 map files, and use the current map editors for making maps. Ive been using this as a reference.

One of the problems that I have, is while the wiki is helpful for picking out what is useful, what is the rest of the data? For example, the wiki says this: "Map data is stored in a series of records, each of which are 20 bytes long", yet some of the records are not 20 bytes long, Level Data, for example. This is 12 bytes of data, out of 20. The remaining 8 bytes of data are not empty, null, or anything of the sort. Does any one know what the rest of this data is? This goes on the entire file, any time the data != 20 bytes.

The other problem Im having, is some of the data that Im pulling out is incorrect, while other data is correct. Level data, for example, Im getting the correct sizeX, sizeY, levenNumber and numberOfAreas, but chutes and teleports are incorrect, always displaying as 10/20, respectively. The following data, being the map records, all appears to be correct, aside from having 4 trailing zero, which might just be a problem with how Im unpacking them, not certain yet. Then later on in the file, the number of teleports record, teleport data, chute records and chute data are all incorrect, and dont even match the initial level data numbers.

Here is my current code. All you need to do is have python 2.7.x installed, and put this in the same folder as MDATA11 and run it. I have all of the data printed out as it runs.

Ive been thinking it might be partly struct.unpack giving me troubles, but Ive used it in other programs unpacking binary data structures and have never run into problems.

Note, Im using struct.unpack_from instead of just struct.unpack so I dont have to worry about the excess data mentioned earlier, and avoid a ton of calls, but functionally, they work the same.

Any ideas? Maybe its just a stupid problem Im not seeing and a pair of fresh eyes might help. Thanks in advance!
Ok, update after playing around for a little bit.

The 10/20 teleporter/chute data is correct. I was assuming that it was how many teleporters and chutes were on the level, but in practice, it seems those are the limits. Each level ALWAYS has 10 chutes and 20 teleporter available. As for the bad data, that was due to either me looping 1 time too few in retrieving the area data, or the rest of the data is 20 bytes ahead in the file.

But, good news is, Ive got the file unpacked and usable.

I still have questions about the other data though. If any one knows what it is, please let me know.

Also, still no idea why map data has those extra trailing 0's. :/
Well Braindead would be the one to ask. And also Prospero used to have a map editor, but I'm not sure when he last logged on (a long time ago, I'm afraid).
QUOTE (aardless @ Sep 18 2014, 05:52 AM) *
Well Braindead would be the one to ask. And also Prospero used to have a map editor, but I'm not sure when he last logged on (a long time ago, I'm afraid).

Turns out the extra data is just padding, and the extra 0's seems to be a quirk. I was also correct with my assessment of teleports and chutes.

Based on what Ive gleaned from reading notes on mxp, that is.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.