
        DOOM II Patch Utilities v1.2 for DOS, Win95 and WinNT
             by Jim Flynn, Copyright 1996, --Freeware--
            E-mail: 72713.3334@compuserve.com  11/01/96

--introduction-------------------------------------------------------

The patch utility consists of three executables, MAK, MER, and BRK.
The first, MAK, constructs a .WAD file from a text control file and the
raw resources it specifies. The second, MER, merges the resources of a
second wad to a first to create a third combining the two. The BRK
utility extracts some or all resources from a wad.

These three utilities are intended for the DOS command line using wad
author. They work in a DOS window of Win95 or WinNT, there is no
graphical interface. It is intended that they be simple to use, yet
powerful, too. In terms of compatibility, MAK will work directly on
any existing DeuTex extraction, after renaming wadinfo.txt to anything
with extension .RES. Wads built by NWT or DeuTex can be disassembled
with BRK, though NWT may require the /a switch.

--contents----------------------------------------------------------

The distribution archive PATCHER.ZIP contains files and
subdirectories so it should be unzipped with -d. You get:

MAK.EXE                 Wad construction utility
MER.EXE                 Wad combination utility
BRK.EXE                 Wad extraction utility
MAK.TXT                 Wad constructor documentation
MER.TXT                 Wad combiner documentation
BRK.TXT                 Wad extractor documentation
PATCHER.TXT             This file you are reading now
PATCHER.LST             Distribution list you see on left
ETERN\ETERN.ZIP         Construction kit for Eternal texture/pnames base wad
D2\D2.ZIP               Kit for DOOM2 texture/pnames base wad
PUZZ\PUZZ.ZIP           Kit for example level with new sprite, music, etc.
SOURCE\SOURCE.ZIP       Utility source code
PATCHER.BAT             Types out FLOW.TXT
FLOW.TXT                Chart showing basic operation of utility
RELEASE.NOT             List of changes by version

Bugs fixed this release:

MAK....	Fixed level map name overflow in remapped level syntax
       	Extended patch size to next power of 2 > width of texture in signs
       	
MER.... Fixed crash due to failure to allocate sign creation data
         when a RES file on the command line tried to create a sign

Features added this release:

MAK.... Allow path in redirection line to TEXTURE1 (shared textures)
	Added full horizontal sign alignment with \<, \|, and \>

MER.... /Z:file now supports arbitrary level remapping from input wads

--credits------------------------------------------------------------

These utilities use the PMODE/W v1.24 DOS extender, provided without
charge for use in free utilities like these. I'd like to thank the
authors for the use of this excellent assembly language product.

PMODE for Watcom C/C++ - v1.24,
PMODE/W is Copyright (c) 1994-1996, Charles Scheffold and Thomas Pytel.
All rights reserved. http://www.di.net/pmw/

Thanks to Peter Zahner and Bob Evans for testing the utilities, and to
Team Eternal for providing the impetus to write them. The text sign
creation function was first suggested by Maxwell(Mad Max).

--use---------------------------------------------------------------

Basic Utility Operation

The following diagram can be brought up anytime by typing PATCHER in
the installation directory. In addition typing any utility name
without parameters will provide brief syntax help for that utility.

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

  Construction Flow for            D2      MER base patch addon
  addon and standalone            ETERN    to extend to base
  style wads.                   +--------+ texture set  +--------+
                                |texture |              | addon  | (playable
  BRK start                     |  base  |------------->|  wad   |  if no
  to create initial             +--------+        /     |        |  sprites
  resource tree from                             /      +--------+ or flats)
  start.wad                                     /
                                +--------+     /        +--------+
            MAK from resources  | patch  |    /         |  play  |
  YOURWAD.RES------------------>|  wad   |------------->|  wad   |
  TEXTURE1.TXT---/ / / / / / /  |        |         /    |        |
  *.BMP-----------/ / / / / /   +--------+        /     +--------+
  *.LMP------------/ / / / /                     /
  *.WAV-------------/ / / /                     / MER /X patch resrc play
  *.TXT--------------/ / /      +--------+     /  to extend to resrc
  *.WAD---------------/ /       | resrc  |    /   textures/sprites/flats
  *.MUS----------------/        |  wad   |----
                                +--------+     DOOM2 -file resrc.wad addon.wad
 PATCHER v1.1, by Jim Flynn       DOOM2        DOOM2 -file play.wad
  Copyright 1996, Freeware       ETERNRES

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

Utility operation is only for DOOM II at this time. Extension to
DOOM and Ultimate DOOM is likely, but not in place yet. The three
operating systems supported so far are DOS, Win95, and WinNT. Note you
must insure sufficient disk space for any operation before starting
it, and this can be twice the size of all wads on the command line.

BRK is useful for extracting patches and other resources from
existing wads for reuse (possibly modified) in your current wad. 

[NOTE: You need permission to reuse other's resources. Id has given
permission for reuse of most anything but trademark/logo information,
extracted music or unmodified levels from their IWADs. To reuse
resources created by PWAD authors, you need the author's permission.]

MAK is useful for constructing wads from resources organized into
subdirectories - but unlike other resource utilities it does not
assume a fixed textures/pnames base of DOOM2. It can require an extra
step to extend the texture set, but this is preferable to having to
redistribute a large resource wad. MAK only builds EXACTLY the
resources you specify in the resource (.RES) text file.

MAK adds two useful new features - signs can be created by
specifying their text in the texture definition section, or graphics
section, and levels can be remapped from named sources in the
levels section.

MER is useful for adding the resources in one wad to another. MER
takes three parameters on its command line, a base wad, a patch wad,
and an output wad, which must all be different. It creates a wad that
has everything the base wad has, but with any changes to old
resources in the patch wad, and adds any new resources in the patch.
The wad with the combined resources is written as the output wad. It
will overwrite a wad by the same name without query if one exists.

--options------------------------------------------------------------

Utility options

MAK 

MER has a /Z:file option that reads a file to determine how to merge
the levels in the base and patch wads. Each line of the file is of
the form Map07=P13 or Map03=B2, which mean resp, use Map13 from the
patch wad as Map07 of the output, and use the second map of the base
wad for third level of the output wad.

MER also has a No Replacement option /N that makes it useful for
extending textures/pnames, sprites, and flats from the IWADs. When
this switch is present the resources in the base wad are filled out
with any resources in the patchwad that do not occur in the base.

All three utilites have a Resource Selection option that defaults to
all resources selected. The option is specified with a + sign
followed by the letters corresponding to the resources to act on, or
with a - sign followed by the letters of resources NOT to act on.

MAK and MER have an IWAD option /I that causes the output wad to be
tagged as an IWAD. It is your responsibility to make sure it has
everything it needs to BE an IWAD though. The directory structure
will use single letter section markers if /I or /R is specified, else
it will use the double letter markers usually found in PWADs.

MAK and MER also have a Single Marker option, /1, that forces all
directory tags like FF_END to be written as single letter markers
like F_END instead. The corresponding Double Marker option, /2,
forces all single markers like P_START to PP_START. The default
operation for MER is to copy the marker in the basewad, unless all of that
kind of resource is in the patchwad in which case the patchwad marker
style is copied. For MAK the default is double markers.

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

Environment options:

MER, MAK, and BRK each support an environment variable by the same
name as the utility that sets the default options for the utility.
For example,

SET MER=/1

placed in your AUTOEXEC, or typed before running MER, will cause /1
to be added at the beginning of every MER command line. You can
remove the variable from the environment with:

SET MER=

It is important that there be no spaces on the left side of the equal
sign, or they will be treated as part of the environment variable name.

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

Differences from other resource utilities:

DOOM2.WAD is not used by the utilities unless you specify it as a
parameter. Output is always written to the current directory and
subdirectories immediately under it.

MAK constructs wads containing ONLY the resources you explicitly
specify in the control file. Wads D2 and ETERN are provided for use
with MER to expand wads created with MAK to the full DOOM2 or Eternal
texture sets, when necessary. To play it you must extend it but if it
is used as a patch MER'd over another already extended wad it won't
be required.

MAK/BRK provide no color matching or translation when creating or
reading BMPs - it is assumed that all patches use the first PLAYPAL
translated by the 0th COLORMAP. A .BMP file, DOOMPAL.BMP, that
contains this palette is provided that can be loaded in your paint
program for the purpose of saving this palette in its format. The
palette is also provided as a raw binary PALETTE.RAW file (in image
form suitable for inclusion in a .BMP), and as a C data declaration
in PALETTE.C.

MAK only uses .BMPs for graphical input - .WAD, .GIF, and .PPM are
NOT supported. These readers are troublesome to write so this may not
change soon without very strong feedback requesting it and explaining
why it is necessary.

MAK does not yet provide resampling of .WAV input or use of .MID, but
these are possible future features.

MER provides functions useful for installation and revision of wads.

BRK will not extract patches from a wad build with NWT unless you
specify the /a switch. NWT does not surround the patches with
directory markers, as BRK usually expects.

All utilites are beta versions, and error checking is
primitive, though I'm working on it.

-------------------------------------------------------------------
An example:

After unzipping the archive into its subdirectories, and moving the
executables MER, MAK, and BRK.EXE into your path, change to the
PUZZ subdirectory and carry out the following commands:

MAK PUZZ

MER /X PUZZ.WAD <yourDOOM2path>\DOOM2.WAD PUZZ1.WAD

COPY PUZZ1.WAD <yourDOOM2path>

CD <yourDOOM2path>

DOOM2 -file PUZZ1.WAD -warp 1

(Note you may have to change drive as well as directory in step 4)

This builds and plays a wad that replaces a lump, a graphic, a level,
a sprite, a flat, a sound, the music, and some textures. It also
contains a fairly vicious puzzle that is NOT a speed trap. The
replaced graphic can only be seen if you solve the puzzle and press
the switch <G>.

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

Possible future features:

* Addition of two more components DIF and SUB. DIF will compare two
wads and write two wads, the first wad consists of the parts of the
first input wad that are missing from the second input wad. The
second output wad is the parts of the second input wad that are
missing or changed from the first input wad. This is useful for
patching, as SUB and MER can then be used to produce a wad
functionally identical to the second input wad, using the first input
wad and the the two (small) DIF output wads.

For example, if ETERNRES is a base revision, and ETERNR2 is a
revision that you'd like others to have, the following would be
the procedure:

DIF ETERNRES ETERNR2            produces DELRES.WAD and ADDRES.WAD

distribute DELRES.WAD, ADDRES.WAD, SUB.EXE, MER.EXE as a patch with
the following batch file included:

SUB ETERNRES DELRES W1          delete from ETERNRES parts not in ETERNR2
MER W1 ADDRES ETERNR2           add parts of ETERNR2 changed or not in ETERNRES
DEL W1.WAD                      delete intermediate wad

* .WAV resampling for sample rate matching

* .MID support

* An option to select the color value for the transparent color slot, 0xf7.

* Wad diagnostics and repair, probably a pair DIA(gnose) and FIX.

* Resource sorting.

* A shell to provide help for non-command line oriented users

Please suggest any features that occur to you as being useful. If
they don't interfere with normal operation or add too much
complexity, I'll likely include them.

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

Limited Distribution Rights
---------------------------

These utilities are freely redistributable as PATCHER.ZIP, intact and
unmodified, for any non-commercial purpose. License free
redistribution with commercial packages may be negotiable, but you
must ask first. The MAK.EXE, MER.EXE, and BRK.EXE files may be
individually, or in combination, packaged with any freeware DOOM II
PWAD in its distribution, for the purpose of installing it, but that
is the only exception to the intact distribution rule.

You may freely copy sections of the source code for your own
applications, at your own risk. I'd appreciate being credited for
anything of significance you borrowed. The code is only moderately
commented, and somewhat dense in places, not the best code for
beginners to learn from possibly <g>.

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

Porting
-------

The current version should run under DOS, Win95, and WinNT.

An OS/2 version may be available soon. Anyone interested in doing
MAC, Sun, Linux, or other ports, please contact me, as I'd like
official ports to be conditionally compilable from one source. I'll
be happy to provide any help I can. 

Jim Flynn
72713.3334@compuserve.com.

-end----------------------------------------------------------------
