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

MER is useful for combining the resources in two DOOM II wads. MER
takes three parameters:

MER [options] basewad patchwad outwad

The first parameter represents the basewad, the wad that resources
are to be added to. The second parameter, patchwad, contains the
resources to add. The third parameter specifies the name of the
output wad. All three parameters MUST be different.

The merging process attempts to emulate the command line processing
for multiple wads. The output resources include everything in the
basewad, except where it is redefined by replacements in the
patchwad. Everything new in the patchwad is also appended. The result
is written to the output wad, leaving both source wads unchanged. 

As a convenience, the basewad or patchwad parameter can be a text file
that is valid input for the MAK utility. The wad it specifies is
built and then used as the corresponding wad. You must specify the
.RES extension for the parameter to use this feature, .WAD is the
default.

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 +.

New only (no replacement) option:

/N

The -N, /n, +N options are all equivalent and select No replacement
or New only operation. In this mode resources in the patchwad that are
the same name as resources in the base wad are not used. Only new
resources, not occuring in the basewad, are taken from the patchwad.
This is very handy for filling out textures, sprites, or flats with
the ones in DOOM2.WAD. If you didn't specify this switch you would
lose any modified DOOM2 resources present in the base wad.

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 is to copy the basewad's marker, unless all of
that resource type is in the patchwad, in which case its marker is
copied.


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.

Extend option:

/X

This is equivalent to the options: +TSF /N /1. It causes the base wad
to be filled out with the textures, sprites, and flats from the
patchwad. None of the modified resources in the basewad are
overwritten though because of the /N switch. This operation is
required to run a wad that replaces sprites or flats, or does not
contain all the IWADs patchnames and textures, where the IWAD is the
patch wad or second wad, in this case.

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. The /I switch turns on /1 since that is required for IWADs.

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


Applications
-------------

DOOM95 single file play
-----------------------
Levels requiring multiple wads to loaded on the command line
can be used with DOOM95 by successively merging the wads together
with MER, and specifiying the final wad as the Patch WAD to DOOM95.
For example, I distribute STAIRS.WAD and ADDON.WAD, which are used
by:

DOOM2 -file STAIRS.WAD ETERNRES.WAD ADDON.WAD

You can make a single file wad with MER by:

        MER STAIRS ETERNRES S1

        MER S1 ADDON STAIRS1

        DEL S1.WAD

This makes the following equivalent to the long line above:

        DOOM2 -file STAIRS1.WAD 

The price is that STAIRS1.WAD is as large as all three wads. The
benefit is that STAIRS1 can be run with DOOM95, which has no command
line for loading multiple wads.


IWAD and large resource wad modification
----------------------------------------

You can replace resources in IWADs like DOOM2 and large resource wads
like ETERNRES.WAD without keeping an uninstalled or extracted copy.
Update wads can be MER'd directly into IWADs or large wads without
having to reinstall them. You are of course responsible for
maintaining backup copies of any wads you modify.

Creation of small resource addon packs
--------------------------------------

There are 1000 people with ETERNRES.WAD. Its nice to be able to
design a level for Eternal that adds some of your own resources
without requiring that complex operations be necessary for the end
user, or another huge revised ETERNRES be downloaded.

Create a MAK control file and directory structure containing ONLY the
new and replacement resources you wish to add, say its called
NEW.RES. Unzip the ETERN.ZIP in the ETERN subdirectory. Then apply
MAK to ETERN.RES and NEW.RES to produce ETERN.WAD and NEW.WAD. Then:

MER ETERN NEW ADDON

       (Alternately MER can perform both MAKs, for example

        MER ETERN.RES NEW.RES ADDON)

will produce a wad, ADDON.WAD that can be used as a third file on the
command line to play a level with Eternal resources, and the
resources specified in NEW. For example:

DOOM2 -file YOURLEVEL.WAD ETERNRES.WAD ADDON.WAD

The ADDON wad MUST follow the ETERNRES wad on the command line.

The D2 subdirectory can be used to build D2.WAD, which can be used
like ETERN to make DOOM2.WAD based ADDON wads. D2 and ETERN are made
by constructing them with only the base wad TEXTURES and PNAMES but
no patches.

Revision tracking in group projects
-----------------------------------

A large group project resource wad can be easily maintained locally
by all members by having a well defined base revision wad (like
ETERNRES.WAD from ETERNAL.ZIP) and a sequence of small MER patches to
apply to it defining the current revision. Note any sequence of MER
patches can be merged into a single patch for distribution. Everyone
can keep their own resource changes locally in a small wad,
distributed as an addon along with their level to playtesters for use
with the base revision, and also distributed to the revision control
clerk who adds it to the revision sequence and publishes the current
revision patch regularly.

Making playable wads with replaced or new sprites or flats
----------------------------------------------------------

Suppose you've created a wad with sprites and flats, AWAD. You can
build it for DOOM play with the line below:

MER +TSF /N /1 AWAD <yourdir>\DOOM2.WAD PWAD

This is equivalent to

MER /X AWAD <yourdir>\DOOM2.WAD PWAD

This will extend the texture, sprite and flat sets to the entire
DOOM2 set without touching any you have modified in AWAD. 

Making resource wads from wads with levels
------------------------------------------

If RESWAD.WAD is your current resource (no level) wad for editing,
and you've just built your playable wad with level and new textures
LEVWAD.WAD, you can update your RESWAD simply as below:

COPY RESWAD.WAD ORESWAD.WAD
MER -W ORESWAD LEVWAD RESWAD

Note this backs up the wad, then updates it over its usual name. The
-W switch prevents the levels being merged from LEVWAD.


