This file should probably be located in ftp://ftp.cdrom.com/pub/idgames2/utils/level_edit/misc This is a program to read from the Quake map files. It includes all source code. Use it to learn from. Cameron and myself are not experts but it should help anyone who wants to get jump started reading map files. 11-15-96 -The Martian All right, a few more changes!!! 1)readmap now excepts the filename as a parameter ie readmap.exe (filename) 2)It reads all entities, their attributes and some special brushes like platforms 3)all code include, plus examples of a test run. A test map is included, in it's modified test state it might not actually run in quake, but you can try it. 4)Everything else is for the same reason Cameron talks about below. --------------------------------------------------------------------------------------------- 11-12-96 -The Martian This code has been changed to run as a dos executable. The code was changed using Visual C++ 1.52 Pro and the make file has been included as well as the executable and a sample run of the program(test.out). To run sample just type readmap.exe it will look for the test.map in the same directory. This is something that should be changed to a param. I am no expert C coder but it works. Some changes will probably effect some of the computations. Therefore use this code to learn from. It gives only one of many ways to read a .map file but most of the code is from John Carmack. Most of code is taken from the QuakeED code that was placed on the id ftp site. Happy Coding! ---------------------------------------------------------------------------------------------------- 11-12-96 --------- A fellow hacker, The Martian, reworked the code so that it is a dos executable made with Visual C++ 1.52 Pro. No compiler warnings or errors. Also prints out more information than before. Some changes that effect computations. Something to just look at, if you are trying to write a utility to read .map files than you should check this out. It will save you a lot of time. I am not an expert either but it works so don't sweat it. It still does not read entities only brushes. That gives something for you to do. Should be easy, have fun! ------------------------------------------------------------------------------------------------------ 96/08/29 C version of MAP reading code. By Cameron Newham. About ----- This is my release 1.0 of the C port of id Software's MAP file reader code. I may update it. Consider this an Alpha. Nearly all of the algorithms and the majority of the code was taken from the source files that came with QuakeEd - id Software's Quake Editor. As that code is foreign to me (a C++ derivative? Sorry - I've been out of broad coding for too long... too much ApplixWare and Notes ), I had to translate some of it. And you know how beginner translaters sound when you hear them on the news... Fortunately the maths part of the code was a straight copy - so it should build the brushes correctly. Why? --- Nobody else seems to have released code to read MAP files, so I thought it was about time (and I'm sure most, if not all, of the editor creators out there won't be releasing their code. Not that I blame them - the maths for converting planes into polygons is... yuk! :) ). This is available for free use (hey - most of it is id Software's work). I just converted it into a more readily acceptable form. Who knows, someone may even use it! If you do know of any software source that does this - you can write and tell me that I wasted my time. :) Originally I was going to write my own code - the parsing is the easy part, but I haven't done any serious 3D maths since Uni - nearly 10 years ago. Making this conversion work was testing enough! Unpacking --------- Unzip the file, compile it up (a sh script is included - just type "compile" on UNIX). It should produce an executable called "readmap". This exe reads a map file called "test.map" - it's just there to show that it works. What you do with the code is up to you. Obvious hook points are pointed out in readmap.c. Problems -------- Plenty! Any program type problems are documented in the code itself. This map reader will *only* read the header of the MAP file and the brush information (creating appropriate vertex and polygon info as it proceeds in reading the data). It *does not* currently read entities and their associated brushes. For simple uses this should not be a problem (I achieved 100% of my current objective - to produce something that could convert planes to vertices :) I have yet to even begin to understand the code after the point where it finishes reading brushes - if anyone can enlighten me, please do. Not understanding the code varient id have used is my major hurdle. Comments -------- Please send them to me (cam@iinet.com.au). Technical comments warmly welcomed. General comments acknowledged. Stupid comments curtly replied to. Flames | /dev/null I really don't want to hear that I can't code... ok? I know I'm no Carmack, but I did my best :) And in 24 hours too. And I put some comments in. So settle. I'd appreciate comments and info from people who understand the QuakeEd code/language used - I'm sort of stuck at the moment. Other ----- Notice how *my* readme doesn't stray off the edge of the 80 column page - unlike someone else I could mention ;) Acknowledgements ---------------- Thanks to John Carmack at id software for releasing the QuakeEd code without which none of this would be possible. Legal ----- Probably this code is covered by an id Software copyright. The algorithms may be patented (but I don't know - there is nothing in the QuakeEd docs, to my knowledge, that says anything legal). This software conversion is pretty well untried - USE AT YOUR OWN RISK. I take no responsibility for any loss of data or any damages incurred by the use of this software. So there!