So redsector want’s to know the next chapter…
<redsector> its just like getting into a book
<redsector> but the book is not finished yet
<redsector> i enjoy your writing style
The problem is… this is about all I have:
Refactoring all the code was a big job and a needed one, I still have roughly 25% to go which is where a lot of the holdup is at the moment. To give an idea here’s an excerpt from the new WMOManager (instead of lumping everything into the damned ADTManager like I was):
/// /// Adds a WMO to the manager /// /// Filename of the WMO from the Adt - i.e. world\wmo\azeroth\buildings\redridge_stable\redridge_stable.wmo /// Base path to where the MPQ is extract - i.e. c:\mpq\ public void addWMO(String fileName, String filePath) { if (File.Exists(filePath + fileName)) { this.addName(fileName); BinaryReader br = new BinaryReader(File.OpenRead(filePath + fileName)); WMO currentWMO = new WMO(); currentWMO.name = fileName; br.ReadBytes(20); // Skip the header UInt32 nTextures = br.ReadUInt32(); UInt32 nGroups = br.ReadUInt32(); // This is the number of "sub-wmos" or group files that we need to read UInt32 nPortals = br.ReadUInt32(); UInt32 nLights = br.ReadUInt32(); UInt32 nModels = br.ReadUInt32(); UInt32 nDoodads = br.ReadUInt32(); UInt32 nSets = br.ReadUInt32(); UInt32 ambientColor = br.ReadUInt32(); UInt32 WMOID = br.ReadUInt32(); // Column 2 in the WMOAreaTable.dbc float bb1_x = (float)(br.ReadSingle() * -1); float bb1_z = (float)br.ReadSingle(); float bb1_y = (float)br.ReadSingle(); float bb2_x = (float)(br.ReadSingle() * -1); float bb2_z = (float)br.ReadSingle(); float bb2_y = (float)br.ReadSingle(); currentWMO.createAABB(Vector3(bb1_x, bb1_y, bb1_z), Vector3(bb2_x, bb2_y, bb2_z)); currentWMO.total_groups = (int)nGroups; for (int wmoGroup = 0; wmoGroup < nGroups; wmoGroup++) { String currentFileName = currentWMO.name.Substring(0, currentWMO.name.Length - 4) + "_" + wmoGroup.ToString().PadLeft(3, "0".ToCharArray()[0]) + ".wmo"; currentWMO.addWMO_Sub(this.processWMOSub(currentFileName, filePath, wmoGroup)); } } else { throw new Exception("File does not exist: " + fileName + filePath); } } |
Do you see what I see? Comments, not doing everything in one little huge method, error checking, proper variable usage… OH HOW SWEET IT IS!
Now imagine doing that to all the code and changing the entire control flow, that’s what I’ve been doing. When I’m not doing that but still find freetime somewhere somehow I have also been reviewing a few other nifty little options for the program that are on my list of implementation.
Over at codeplex is a great little setup for a console in XNA: http://www.codeplex.com/XnaConsole
Google code has a C# implementation of MPQ extraction: http://code.google.com/p/mpqtool/
Both are going to make their way into the source at one time or another (with due credit of course) and both should really make things a lot more fun. Instead of having to hardcode which maps to load, it will become a console command. Where you extracted MPQ files are located will be an external setting. The MPQExtractor will look to see if the files exist in said location, and if they don’t it will automatically extract them.
This will also allow me to run incremental collision tests (say a small area at a time) without have to constantly start and stop the program (of course it will let you do it as well).
Another big addition I’d love to put in for fun/ease of use is mouse control for the camera. I’ve been digging and it shouldn’t be too difficult at all (that’s at the very end of the list though).
Well this wasn’t much of an update but I should get brownie points for the Photoshop mastery at least!
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Keep it up! Can’t wait to see where your project goes from here