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
<cough>), 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!

