MergeT3D 1.2 - .MAP/.T3D to .T3D merge utility.

Copyright 1997, 1998 Alexander Malmberg <alexander@malmberg.org>
Copyright 1998, Gyro Gearloose
Copyright 1996, 1996 Chris Carollo and Trey Harrison

This program is distributed under the terms of the GNU General Public
License as published by the Free Software Foundation. A copy of it is in
the file legal.txt. This program comes with ABSOLUTELY NO WARRANTY.


Note:
-----
This program was originally written by Gyro Gearloose based on Quest
by Chris Carollo and Trey Harrison. It's currently maintained by
me (Alexander Malmberg), so all feedback should be sent to me
<alexander@malmberg.org>.

  The program was mostly undocumented when I got it. The rest of this
file is a collection of scraps of information about it. Some of it is
probably partially outdated. If you want more details, read the source.
Especially t3d.c has a lot of information in the comments. Also, the
entity set for Quest that is included (unquest.qc) has some information.

  This program can probably be improved a lot on, but since I don't have
Unreal, I don't have the information needed. If you want to help with
information, suggestions and testing, e-mail me.

- Alexander Malmberg <alexander@malmberg.org>


--------------
This tool takes a Quest .MAP geometry file and an UnrealEd .T3D geometry
file as input and applies any texture data it finds in the UnrealEd file
to identical brushes in the Quest file.  Finally, it produces a .T3D file
as output.

This permits Quest to provide geometry and UnrealEd to provide texturing
on an evolving map without having to lose changes along the way.


Quest MAP geometry ------\
                           MergeT3D ----> T3D for UnrealEd
UnrealEd T3D texture ----/
         /|\                                        |
          |                                         |
           \-------- Texture mapping work ---------/
	   

Usage: MERGET3D <input MAP> <input T3D> <output T3D>


If no input T3D file is available, or if the program is being run for
the first time to convert a MAP file to a T3D, just specify a nonexistant
T3D file, like this:

c:\foo>merget3d amador2.map xyzzy amador2.t3d


This program works by scanning the input T3D file and building a list of
all of the surfaces that have texture data that we would like to preserve.

As it writes polygons from the MAP file, if the brush location, surface
normal, and first three vertices matches a surface in the T3D file, then
it uses the texture alignment info from the T3D file for that surface
rather than from the MAP file.

Texture alignment data from the T3D file that does not match any of the
surfaces in the source MAP file is ignored.

Texture alignment info from the T3D file that is used includes the texture
name, Origin, Pan U and V values, TextureU, and TextureV.
--------------
Quest is a very powerful and easy-to-use interface for constructing
3D geometry, and this is a hack to permit it to be used to create
geometry data for UnrealEd.

Quest does not, however, do texture alignment, and does not read .T3D
files produced by UnrealEd.  To prevent texture alignment work done in
UnrealEd from being lost, however, it is capable of scavenging alignment
data from a .T3D file and applying it to identical unaligned brushes of
its .MAP files.

Designing Unreal levels using Quest is very different from that of Quake
levels.  When a brush is added to the world, it is by default a subtractive
brush.  That is, the player can be inside it.  Changing the brush to any
kind of class causes it to become an additive brush.  So, creating a func_wall
out of a brush, for example, will cause it to be an additive brush to UnrealEd.

Player Starts and Lights are the only entities currently supported.
I recommend creating func_wall scripts to specify an additive brush.
I pass any spawnflags set on to the brush's PolyFlags field.
Setting spawnflags 32 will set the func_wall to a semi-solid brush.
Setting spawnflags 8 will set the func_wall to a non-solid brush.
Setting spawnflags 256 will cause textures to be double-sided (use w/ 8 for water)

Texture names may be specified, although all alignment and scaling will need to
be performed in UnrealEd.

The worlds of Quake and Unreal seem to reverse the sign of the y axis,
so I must invert the sign of all Y coordinates when writing.  By leaving the
sign alone and writing the polygon's vertices in the reverse order, a
mirror image of the level can be had.

Setting Flags=16 on an individual texture is "Environment Map" (sky)
Setting Flags=8192 on an individual texture is "Small Wavy" (water)
I am deriving some of the texture flags from the texture names, sky and
water.  This is a kludge, and the right way to do it would be to add a
bitfield to the faces and allow the edface dialog to modify it.
--------------

