---------------------------------------------------------
MAK v1.2 by Jim Flynn, copyright 1996. -FREEWARE-
---------------------------------------------------------

MAK is useful for constructing DOOM II wads from resources organized
into subdirectories according to a list in a text file called the
resource file with extension .RES. 

MAK takes a single parameter, the name of a text file, with
extension .RES. This file lists in sections the resources that make
up the wad to be built. Corresponding to each section is a
subdirectory containing the resource files to be used in
construction.

The text file contains sections delimited by lines starting with
strings of the form [SECTION]. Any blank line, or line starting with
a space or semicolon is a comment. Each section ends when the next
begins or the file ends. We describe each section MAK supports below,
and provide example sections.

MAK also has a feature allowing you to create sign textures to guide
and hint the player easily. The characters of the DOOM fonts used for
game messages and menu screens are used to create a patch containing
the text. Embedded escapes allow changing the color or brightness or
starting a new line within one text string. These strings may occur
as the fourth item on any [TEXTURES] or [GRAPHICS] section line
containing an "=" character.

---------------------------------------------------------

Options are strings on the command line that start with -, /, or +.
In some cases which may matter, in others it does not.

Resource selection option:

-[L][W][T][E][M][G][S][P][F] or +[L][W][T][E][M][G][S][P][F]

The letters LWTEMGSPF are used to represent resource classes:

        L LUMPS      W WADS       T TEXTURES   Note: Sound effects = E
        E EFFECTS    M MUSICS     G GRAPHICS                Levels = W
        S SPRITES    P PATCHES    F FLATS

To operate on ONLY textures, sprites and flats you would use the
option +TSF. To operate on all resources BUT textures and graphics
you would use the option -TG. Any combination of letters may be
used. If no resource selection option is specified, all resources
are affected. You can only use one selection option per command. The
/ option introducer is equivalent to +.

Single and Double marker style option:

/1 /2

The -1, /1 and +1 options are all equivalent and cause the output wad
to use only single letter style resource markers. For example if
PP_END were output normally P_END would be output instead. The -2 /2
and +2 option causes the opposite, P_START would be converted to
PP_START. The default for MAK is to use double markers.

Verbose option:

/V

Turns on any debug outputs lying around the code. May vary greatly
from release to release and sometimes might impede operation even.

IWAD option:

/I

This simply causes the output wad to be tagged as an IWAD. It is up
to you to make sure it has the resources and form needed to run as an
IWAD. It also causes the IWAD directory structure to be used, with
single letter tags.

/R

Resource WAD option.

This just uses the IWAD directory structure without setting the IWAD
tag in the header. The default is the PWAD directory structure with
double letter tags.

Options may occur anywhere on the command line, and their position
does not affect their meaning.

---------------------------------------------------------

The sections that may occur in a MAK file are documented below. 

[TEXTURES] section
----------

You may also denote the section [TEXTURE1] for compatibility.
The textures section is used to specify the textures and their
composition from patch resources. Since only the textures specified
are present in the output wad, you may need to extend the texture set
by pasting in the base texture set description from D2.RES or
ETERN.RES or to use MER on the output wad to merge it over either D2
or ETERN.

Also for compatibility, any line in the textures section that
begins with TEXTURE1 causes redirection of file input to 
TEXTURES\\TEXTURE1.TXT until end-of-file. The remainder of the
textures section is then processed. This, with the alternate naming of
the textures section, implies that an extraction by that other
program can be rebuilt after simply renaming WADINFO.TXT <something>.RES.

Each line in the textures section defines a texture or a patch. Each
line defining a patch starts with an asterisk,"*". Each line defining
a texture is followed by one or more lines defining a patch used in
that texture. Each line contains a name and two numbers. For a
texture definition the name is the texture name. The two numbers are
the texture width and height in order. For a patch definition the
name is the patch name and the numbers are the x and y offset of the
patch within the texture space. Spaces between the * and a patchname
are optional. The * or the first letter of a texture name must occur
in the first column.

Normal Syntaxes:

texturename width height

*patchname xoffset yoffset

An example texture section that defines two textures, each
composed of two patches is shown below.

[TEXTURES]
ANEWTEXT        64      128                     define 64X128 ANEWTEXT 
*       OLDPATCH        0       0                OLDPATCH to upperleft 
*       NEWPAT1         0       64               NEWPAT1 halfway down
ANOTEXT         64      128                     define 64X128 ANOTEXT
*       OLDPATCH        0       0                OLDPATCH to upperleft
*       NEWPAT2         0       64               NEWPAT2 halfway down

The wad resulting from MAK and the above section would have three
PNAMES OLDPATCH, NEWPAT1, and NEWPAT2, and two textures ANEWTEXT and
ANOTEXT. This is very different from other programs which would also
include all DOOM2 PNAMES and textures.

Any texture or patch line may define a sign using the DOOM font. If a
sign is specified by a texture, MAK inserts a patch by the same name
that implements the sign as a single-patch transparency. Multiple
signs may be created as part of a texture definition, though this is
uncommon.

Sign Creation Syntaxes:

texturename=width,height string to make sign from

*patchname=xoffset,yoffset string to make sign from

An example of a texture section creating some signs is shown below:

[TEXTURES]
SAVED   64      128
*SAVED=0,4 \yARE\n\rYOU\n\gSAVED?
SECACC  128     64
*SECACC=0,4 \gSECRET IS NOW\n\yACCESSIBLE

The delimiters =, space, tab, comma, semicolon, and colon can be used
interchangeably except at least ONE "=" must occur as a delimiter.
Quotes are not necessary to delimit the string, it is taken as
everything following the first three parameters and any delimiters
immediately after them.

In order to change color and brightness within a string and to create
multiple line signs, escapes are employed. These are character
sequences starting with backslash "\". For example to start a new
line you include \n in the string at the point you want the break.

Text sign escape codes
-----------------------

Global escapes (affects entire sign if present anywhere)

none currently

-----------------------------

Line escapes (affects entire row of text it occurs anywhere within)

Horizontal alignment
"""""""""""""""""""""
\< left horizontal alignment
\| center horizontal alignment
\> right horizontal alignment

The codes \<. \|,and \> are implemented as the horizontal alignment
escapes for left, center and right alignment. Each specifies the
alignment of the row of text it occurs within, the last being used if
there is more than one. If none occurs in a row, that row is center
aligned.

-----------------------------

Char escapes (affects only those characters following until another
              escape of the same class)

Font support
"""""""""""""
\f0     default small font              select 12 high font
\f1     select large font               select 8 high font

These two codes can also be used anywhere and choose the large or
small font (small=0). The large font is only numbers and uppercase
letters with a character height of 12 pixels for letters, 16 for
numbers. The small font has everything ASCII from 32-95, and is 8
pixels high.

Vertical alignment
"""""""""""""""""""
\^ top vertical alignment               align text so tops of chars are flush
\- middle vertical alignment            align text so centers split the row
\v bottom vertical alignment            align so bottoms of chars are flush

These codes, like all others can be used anywhere. They cause
succeeding characters in the same sign to use the style of alignment
specified, until the next alignment code is encountered. Top alignment
aligns the tops of the charcters flush with the top of the row.
Bottom alignment does the same, but with the bottom of the row.
Middle alignment centers each character vertically within the row.

Line break
"""""""""""
\n end of line                          start new line with following text

This code is simply inserted in the sign text description everywhere
a line break in the output is desired. Currently it is the sign
designer's lookout to keep the size of the lines of text within the
horizontal size for the picture created. The large font is about 16
wide, the small about 8, but it varies from char to char. Due to a
DOOM limitation all sign patches must be a power of two in horizontal
size.

[A future version will either warn of overflow or
automatically rewrap or resize the sign... or something.]

Color change escapes
"""""""""""""""""""""
\r      red text                        change to red
\b      blue text                       change to blue
\g      green text                      change to green
\s      silver text                     change to silver (gray)
\w      white text                      change to white
\y      yellow text                     change to yellow

Brightness change escapes
""""""""""""""""""""""""""
\0      100% bright                     max brightness
\1      88% bright
\2      75% bright
\3      68% bright
\4      50% bright
\5      38% bright
\6      25% bright
\7      13% bright                      min brightness

The defaults are horizontally center aligned, red, max brightness. and
small font, vertically top aligned.

[LUMPS] section
-------

The lumps section is used to add some special purpose data to the
wad, normally provided by DOOM2.WAD, but replaceable by a PWAD. The
MAK program looks in the LUMPS subdirectory for a file with the same
name as the resources listed below [LUMPS] and with extension .LMP.

[LUMPS]
PLAYPAL                         14 palettes used by DOOM II
COLORMAP                        34 color maps for intensity
ENDOOM                          4000 char text/attr end screen
DEMO1                           first built-in demo
DEMO2                           second built-in demo
DEMO3                           third built-in demo
GENMIDI                         general midi data
DMXGUSC                         memory size based gus patch selection

[LEVELS] section
--------

The levels section is used to add any number of levels to the wad.
The level wads can be renamed MAPnn.WAD and stored in the LEVELS
subdirectory, with the correct level tag set. The MAPnn tags
to be included are then listed below the levels header, e.g. a
three level wad:

[LEVELS]
MAP07                           MAP07 will be included in built wad
MAP15                           MAP15 will be included in built wad
MAP31                           MAP31 will be included in built wad

You can also use named levels, AND convert their level number on
wad build with the following syntax:

[LEVELS]
MAP01=ENTRYWAY                  ENTRYWAY.WAD must exist in LEVELS subdir
MAP02=UNDERHAL                  UNDERHAL.WAD must exist in LEVELS subdir

[SOUNDS] section
--------

The sounds section is used to add any sound effect replacements to
the built wad. The .WAV files, 8-bit and sampled at 11025Hz, with
65535 samples or less, must be placed in the SOUNDS subdirectory. For
PC speaker effects the text files (.TXT) should also be placed in the
SOUNDS subdirectory. The .WAV's correspond to resource names starting
DS, and the speaker effects are those starting with DP.

[SOUNDS]
DPTELEPT                        use DPTELEPT.TXT for pc speaker effect
DSTELEPT                        use DSTELEPT.WAV for sound effect

[MUSICS] section
--------

The musics section is used to add any music replacements to
the built wad. The .MUS files should be renamed to the standard 
names corresponding to the levels the music is for and copied to the
MUSICS subdirectory.

[MUSICS]
D_RUNNIN                        use D_RUNNIN.MUS(level 1) music


[GRAPHICS] section
----------

The graphics section adds the intermission bitmap replacements, the
status bar pictures and other miscellaneous graphical information. The
.BMP files should be given the standard resource names and copied to
the GRAPHICS subdirectory. The lines listed under the graphics
section each list two numbers that set the x and y offset the graphic is
drawn with.

[GRAPHICS]
CWILV00   0   0                 use CWILV00.BMP for endscreen level name
CWILV01   0   0                 use CWILV01.BMP for endscreen level name

The graphics section also supports creation of text graphics with
similar syntax to textures and patches:

CWILV00=0,0 string to make sign from


[SPRITES] section
---------

The sprites section lists the sprite replacements you wish in the
built wad. The .BMP files should be given the sprite resource name and
copied to the SPRITES subdirectory. The lines listed under the
sprites section each contain two numbers that determine the x and y
offset for sprite drawing.

[SPRITES]
BKEYA0    7   19                use BKEYA0.BMP as replacement sprite graphic


[FLATS] section
-------

The flats section lists the flat replacements you wish in the built
wad. The .BMP files should be copied to the FLATS subdirectory.

[FLATS]
RROCK03                         use RROCK03.BMP as replacement flat graphic


[PATCHES] section
---------

The patches section is optional for compatibility, primarily.
It can be used to add patches to a wad that don't occur in any
texture of the wad however.

---------------------------------------------------------------------

Three examples are provided with MAK. ETERN.ZIP, D2.ZIP, and
PUZZ.ZIP. These should each be unzipped in a new directory with the
-d switch (preserves directory structure). The directories they are
created in when you unzip PATCHER -d are fine for this.

Running MAK on the ETERN.RES file builds ETERN.WAD - a small base wad
containing just the PNAMES and TEXTURE descriptions in DOOM2 as
modified by ETERNRES from Eternal I.

D2.RES builds D2.WAD - a small base wad containing just the PNAMES
and TEXTURE descriptions in DOOM2.

PUZZ.RES builds a wad containing a replacement of each type, and also
creates three signs. The wad can be made playable as PUZZ2.WAD with:

    MAK PUZZ                          (builds small wad containing resources)

    MER /x PUZZ [path]DOOM2 PUZZ2     (extend wad with DOOM2 sprites and flats)

This is a small level containing a vicious puzzle. It is NOT a speed
trap.

See PATCHER.TXT and MER.TXT for information on how to use these
wads with the MER utility to create patches for distribution with
your levels.

---------------------------------------------------------------------




