This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: Hiya - new member here. Q about parsing ADTs  (Read 1762 times)

TJoe

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 3
    • View Profile
Hiya - new member here. Q about parsing ADTs
« on: September 12, 2011, 10:28:59 pm »
Hello guys - this seemed to be the best place to post, but if I'm in a wrong forum or website, please feel free to redirect me, as I'm quite new to this scene.
First off - I have never played WoW - not even a test-version. Nor do I plan to. But someone asked my help to make a parser for ADT files, which I did, and hence my question:

When I read the heightmap from the MCNK files (well technically MCVT), I get some odd values.
Some chunks have an all-negative heightmap (which could mean that they're off-limits or the water-level is lowered), but when placing the 256 chunks from a complete MHDR->MCIN in a 16x16 grid, they don't seem to form a complete map (regardless of water-level). Granted I only have a couple of example ADTs, that I got from the guy, I'm helping out, but they still ought to contain a complete map (or a coastline or similar).
I'm convinced that:
1) Either the 145 heightmap values aren't aligned in a 9x9+8x8 grid numbered from the top.
2) The 256 chunks aren't aligned in 16x16 order but in some other way.
3) I'm reading/parsing the floats improperly (ie. they're not little-endian 2s complement).
These are the only 3 things, I can come up with, that I could be doing wrong. The rest of the parser seems to be working, and reading objects/texture etc. is no problem. Ofc there may be something, I'm missing - the Wiki isn't exactly a plethora of information :)

If someone could shed some light on this, I'd aprreciate it.

Regards and thanks in advance
Tom
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Keta

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 210
    • View Profile
Re: Hiya - new member here. Q about parsing ADTs
« Reply #1 on: September 12, 2011, 10:38:23 pm »
Hey Tom. Yes, its me, Newtech from VBForums xP
Anyways, not the point. The only thing I can think of, that you might be thinking of, is the WDT files...? : / They are sorta the map that decides where to display ADTs.
Here's how it works.
64x64 spots. Each accounting for one ADT. Which means that an WDT that got the spot 36, 20 checked, will allow the display of (example) NewWorld_36_20.ADT
Then again, Im not even sure if this is what you're asking xP But I hope it is. Otherwise, Ima pass this topic onto the actual devs ;D

Thanks
Keta
Aka. Newtech
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

TJoe

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 3
    • View Profile
Re: Hiya - new member here. Q about parsing ADTs
« Reply #2 on: September 12, 2011, 10:56:21 pm »
I read the Wiki on WDTs. It's basically just a list of the ADTs contained in the map. I doubt they'll contain any info, that I don't allready have (since I have all the ADTs). And I know about the 64x64 limits on ADT within maps. The location of each ADT is easily calculated (though the coordinate-system used is a bit odd), and looking at the coordinates, I'm fairly sure (read 99%) that each ADT has to be a square.

I made a small property in each mapchunk to return a graphical image of the chunk's heightmap (green->lighter green for higher grounds and blue->darker blue for deeper water). When placing them together in a 16x16 array they don't produce a map - more like some rounded edges that don't fit. I tried switching them around and mirroring them in various ways, but nothing produced a satisfactory result. Which is why I was convinced that something is wrong. Either in how I read things or how I interpret them. I tried using 0 and both water-levels supplied in the MH2O chunk as a baseline for coast, and neither worked.

I read something about a crude version of the heightmap being store externally somewhere - maybe I can use that as a reference and try to get a handle on what's going on. Unless ofc. someone posts here with an explanation.


#EDIT: Aye there seems to be an LQ height-map for long-distance rendering in WDL files. This will probably be sideviews though similar to a reflection map, but there could be a top-view as well for looking down on an area when flying or standing on a mountain. If you have a WDL-file for the 2 example-maps, you emailed me, I'd like to look them through.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: Hiya - new member here. Q about parsing ADTs
« Reply #3 on: September 12, 2011, 11:40:18 pm »
Add MCNK.position.z to all values in MCVT to get the correct heights.
(Note added on the wiki.)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

TJoe

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 3
    • View Profile
Re: Hiya - new member here. Q about parsing ADTs
« Reply #4 on: September 12, 2011, 11:44:44 pm »
Quote from: "schlumpf"
Add MCNK.position.z to all values in MCVT to get the correct heights.
(Note added on the wiki.)

Oh sweet - now why didn't I think of that myself.

Thanks alot :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »