Hey Guys,
Merry Xmas ALL!
Been making Slow progression on my navigation system, bassed off old PPather (3.5) style source code for reading in all the mapchunks,
im not using it to create a path, just to get Z value of a X Y,
ok now i have overcome a fair few obsticles with this, from finding out you need to patch it, to finding out they split the files.
now i have been stuck again trying to figure out why i cannot get a solid ground base
ive been searching high and low, debugging my project trying to figure out why its always returning the wrong values,
it was loading everything find exept for the ground.
i tracked it back to this, and slowly found out the offset isnt working correct.
whole function
int off = mcnk_offsets[j * 16 + i];Code:private void ReadNewADT(string CurADT) { stream = System.IO.File.OpenRead(CurADT); file = new System.IO.BinaryReader(stream); bool done = false; do { try { uint type = file.ReadUInt32(); uint size = file.ReadUInt32(); long curpos = file.BaseStream.Position; if (type == ChunkReader.MVER) // Original ADT HandleMVER(size); if (type == ChunkReader.MCIN) // Doesnt Exist anymore but we need it HandleMCIN(size); else if (type == ChunkReader.MTEX) // Dont load this, will delete later. HandleMTEX(size); else if (type == ChunkReader.MMDX) // Obj HandleMMDX(size); else if (type == ChunkReader.MWMO) // OBJ HandleMWMO(size); else if (type == ChunkReader.MDDF) // OBJ HandleMDDF(size); else if (type == ChunkReader.MODF) // oBJ HandleMODF(size); else if (type == ChunkReader.MH2O) // Water Original HandleMH2O(size); else { //System.Logging.DebugLog("MapTile Unknown " + type); //done = true; } file.BaseStream.Seek(curpos + size, System.IO.SeekOrigin.Begin); } catch (System.IO.EndOfStreamException) { done = true; } } while (!done); for (int j = 0; j < 16; j++) { for (int i = 0; i < 16; i++) { int off = mcnk_offsets[j * 16 + i]; file.BaseStream.Seek(off, System.IO.SeekOrigin.Begin); MapChunk chunk = new MapChunk(); ReadMapChunk(chunk); Logging.DebugLog("Chunk " + i + " " + j + " at off " + off); if (LiquidDataChunk != null) //not null means an MH2O chunk was found { //set liquid info from the MH2O chunk since the old MCLQ is no more chunk.haswater = (LiquidDataChunk[j * 16 + i].used & 1) == 1; if (LiquidDataChunk[j * 16 + i].data1 != null) { chunk.water_height1 = LiquidDataChunk[j * 16 + i].data1.heightLevel1; chunk.water_height2 = LiquidDataChunk[j * 16 + i].data1.heightLevel2; } //TODO: set height map and flags, very important chunk.water_height = LiquidDataChunk[j * 16 + i].water_height; chunk.water_flags = LiquidDataChunk[j * 16 + i].water_flags; } tile.chunks[j, i] = chunk; } } //file.Close(); //stream.Close(); }
My Issue now
i was reading the WoW Dev Wiki only to find out that they have removed MCINCode:int[] mcnk_offsets = new int[256]; int[] mcnk_sizes = new int[256]; private void HandleMCIN(uint size) { for (int i = 0; i < 256; i++) { mcnk_offsets[i] = file.ReadInt32(); mcnk_sizes[i] = file.ReadInt32(); file.ReadInt32(); // crap file.ReadInt32();// crap } }
now the code above relys heavly on MCIN.3.x to 4.x adt : schema. Most of the data inside the chunks seems to be close to identical to what it was before Cataclysm. MCIN is gone, and chunk sizes now have to be right.
so the question is,
how is every one handling the change from MCIN to nothing ?
how should i go by handling this change ?