summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
Diffstat (limited to 'man')
-rw-r--r--man/CMDLINE.template6
-rw-r--r--man/INSTALL.template171
-rw-r--r--man/Makefile.am112
-rwxr-xr-xman/docgen70
-rw-r--r--man/doom.template41
-rw-r--r--man/environ.man25
-rw-r--r--man/heretic.template43
-rw-r--r--man/hexen.template43
-rw-r--r--man/manpage.template63
-rwxr-xr-xman/simplecpp88
-rw-r--r--man/strife.template83
11 files changed, 538 insertions, 207 deletions
diff --git a/man/CMDLINE.template b/man/CMDLINE.template
index fee4a3f9..2c599383 100644
--- a/man/CMDLINE.template
+++ b/man/CMDLINE.template
@@ -1,8 +1,8 @@
== Command line parameters ==
-This is a list of the command line parameters supported by Chocolate Doom.
-A number of additional parameters are supported in addition to those
-present in Vanilla Doom.
+This is a full list of the supported command line parameters. A number of
+additional parameters are supported in addition to those present in the DOS
+version.
@content
diff --git a/man/INSTALL.template b/man/INSTALL.template
index 19d3c88d..5597439f 100644
--- a/man/INSTALL.template
+++ b/man/INSTALL.template
@@ -1,16 +1,31 @@
+#ifdef DOOM
+#define LONG_GAME_NAME Chocolate Doom
+#define LONG_EXE_NAME chocolate-doom
+#define DEFAULT_IWAD doom2.wad
+#elif HERETIC
+#define LONG_GAME_NAME Chocolate Heretic
+#define LONG_EXE_NAME chocolate-heretic
+#define DEFAULT_IWAD heretic.wad
+#elif HEXEN
+#define LONG_GAME_NAME Chocolate Hexen
+#define LONG_EXE_NAME chocolate-hexen
+#define DEFAULT_IWAD hexen.wad
+#elif STRIFE
+#define LONG_GAME_NAME Chocolate Strife
+#define LONG_EXE_NAME chocolate-strife
+#define DEFAULT_IWAD strife1.wad
+#endif
-Chocolate Doom installation
-===========================
+== LONG_GAME_NAME installation ==
-These are instructions for how to install and set up Chocolate Doom
+These are instructions for how to install and set up LONG_GAME_NAME
for play.
-#ifn PRECOMPILED
-Building Chocolate Doom
------------------------
+#if !PRECOMPILED
+== Building LONG_GAME_NAME ==
-Before you can play Chocolate Doom, you need to compile a binary that
-you can run. For compilation, Chocolate Doom requires the following
+Before you can play LONG_GAME_NAME, you need to compile a binary that
+you can run. For compilation, LONG_GAME_NAME requires the following
to be installed:
* A C compiler (gcc is recommended)
@@ -36,79 +51,82 @@ document. Please see the GNU autoconf / automake documentation for more
information.
#endif
-Obtaining an IWAD file
-----------------------
+== Obtaining an IWAD file ==
-To play Doom, you need an IWAD file. This file contains the game data
-(graphics, sounds, etc). The full versions of the Doom games are
+To play, you need an IWAD file. This file contains the game data
+(graphics, sounds, etc). The full versions of the games are
proprietary and need to be bought. The IWAD file has one of the
following names:
+#if DOOM
doom1.wad (Shareware Doom)
doom.wad (Registered / Ultimate Doom)
doom2.wad (Doom 2)
tnt.wad (Final Doom: TNT: Evilution)
plutonia.wad (Final Doom: Plutonia Experiment)
chex.wad (Chex Quest)
+#endif
+#if HERETIC
+ heretic1.wad (Shareware Heretic)
+ heretic.wad (Registered / Commercial Heretic)
+#endif
+#if HEXEN
+ hexen.wad (Hexen)
+#endif
+#if STRIFE
+ strife1.wad (+voices.wad) (Strife)
+#endif
+#if DOOM
If you don't have a copy of a commercial version, you can download
-the shareware version (extract the file named doom1.wad):
+the shareware version of Doom (extract the file named doom1.wad):
* http://www.doomworld.com/idgames/index.php?id=7053
(idstuff/doom/win95/doom95.zip in your nearest /idgames mirror)
-If you have a commercial version, obtaining the IWAD file is usually
-straightforward. The method depends on how you obtained your copy of
-the game:
-
-#if _WIN32
- * The Doom games are available to buy for download on Steam
- (http://www.steampowered.com/). Chocolate Doom will autodetect
- IWADs installed by Steam and you do not need to do anything.
-#else
- * The Doom games are available to buy for download on Steam
- (http://www.steampowered.com/). To find the IWAD files on a
- Windows system, look in the Steam directory (usually within
- "Program Files"), under the "steamapps/common" path.
#endif
+If you have a commercial version on a CD-ROM, obtaining the IWAD
+file is usually straightforward. Simply locate the IWAD file on the
+disc and copy it off.
- * There have been several CD-based versions of Doom. Generally, the
- IWAD files can be found on the CD and copied off directly.
-
+#if !STRIFE
#if _WIN32
- * If the IWAD files are not directly available on the CD, or you have
- a floppy disk version, you will need to run the install program to
- install the game to your hard disk. As the installer is DOS-based,
- you may not be able to do this on 64-bit versions of Windows. In
- this case, the best suggestion is to use a DOS emulator (such as
- DOSbox) to run the installer.
+The Doom games, along with Heretic and Hexen, are also available to
+purchase for download on Steam (http://www.steampowered.com/).
+LONG_GAME_NAME will autodetect IWADs installed by Steam and you do
+not need to do anything.
#else
- * If the IWAD files are not directly available on the CD, or you have
- a floppy disk version, installation is more difficult. The best
- suggestion is to use a DOS emulator (such as DOSbox) to run the
- installer.
+The Doom games, along with Heretic and Hexen, are available to buy
+for download on Steam (http://www.steampowered.com/), but are only
+available for Windows. To find the IWAD files on a Windows system,
+look in the Steam directory (usually within "Program Files"), under
+the "steamapps/common" path.
#endif
- * As an alternative to using an emulator, it is possible to extract
- the files manually. On the install disk(s), you will find several
- files with numbered extensions (with CD versions there may be a
- single large file with the extension .1, eg. "resource.1").
+#endif
+#if DOOM || HERETIC
+Older floppy disk versions are harder to deal with. The easiest way
+to install from floppies is to run the original installer program
+inside an emulator such as DOSbox (http://www.dosbox.com/).
+As an alternative to using an emulator, it is possible to extract the
+files manually. On the install disk(s), you will find several files
+with numbered extensions (eg. "doom_se.1").
- From the command line it is possible to combine these files into a
- single large file, using a command similar to the following:
+From the command line it is possible to combine these files into a
+single large file, using a command similar to the following:
#if _WIN32
- copy doom_se.1+doom_se.2+doom_se.3+doom_se.4+doom_se.5 doom_se.lha
+ copy doom_se.1+doom_se.2+doom_se.3+doom_se.4+doom_se.5 doom_se.lha
#else
- cat doom_se.1 doom_se.2 doom_se.3 doom_se.4 doom_se.5 > doom_se.lha
+ cat doom_se.1 doom_se.2 doom_se.3 doom_se.4 doom_se.5 > doom_se.lha
#endif
- The resulting file is an LHA archive file, and it can be extracted
- using an LHA archive tool (there is one available for almost every
- operating system).
+The resulting file is an LHA archive file, and it can be extracted
+using an LHA archive tool (there is one available for almost every
+operating system).
-Running the game
-----------------
+#endif
+== Running the game ==
#if __MACOSX__
Once you have an IWAD file, you can specify its location within the
@@ -124,19 +142,19 @@ to point to the locations of the IWAD files set within the launcher.
You can launch the game with a specific IWAD file by typing, for
example:
- chocolate-doom -iwad tnt.wad
+ LONG_EXE_NAME -iwad tnt.wad
#else
-Chocolate Doom needs to know where to find your IWAD file. To do this,
+LONG_GAME_NAME needs to know where to find your IWAD file. To do this,
do one of the following:
#if _WIN32
* Within Explorer, simply place the IWAD file in the same folder as
- the Chocolate Doom files, and double-click chocolate-doom.exe.
+ the LONG_GAME_NAME files, and double-click LONG_EXE_NAME.exe.
- * Run Chocolate Doom from the command prompt with the '-iwad' command
+ * Run LONG_GAME_NAME from the command prompt with the '-iwad' command
line parameter to specify the IWAD file to use, eg.
- chocolate-doom -iwad c:\games\doom2.wad
+ LONG_EXE_NAME -iwad c:\games\DEFAULT_IWAD
* Set the environment variable DOOMWADDIR to the location of a
directory containing your IWAD files.
@@ -146,10 +164,10 @@ do one of the following:
of directories to search (similar to the PATH environment
variable).
#else
- * Run Chocolate Doom from the Unix console with the '-iwad' command
+ * Run LONG_GAME_NAME from the Unix console with the '-iwad' command
line parameter to specify the IWAD file to use, eg.
- chocolate-doom -iwad /root/doom2.wad
+ LONG_EXE_NAME -iwad /root/DEFAULT_IWAD
* Put the file into one of the following directories:
@@ -166,12 +184,12 @@ do one of the following:
#endif
#endif
-Playing with Chex Quest
------------------------
+#if DOOM
+== Playing with Chex Quest ==
Chex Quest is a game based on Doom with some minor modifications that
was distributed with boxes of Chex cereal in 1997. It is possible to
-play Chex Quest using Chocolate Doom. To do this, the following files
+play Chex Quest using LONG_GAME_NAME. To do this, the following files
are needed:
* The IWAD file 'chex.wad', from the Chex Quest CD.
@@ -183,12 +201,11 @@ are needed:
Copy these files into a directory together and use the '-iwad' command
line parameter to specify the Chex Quest IWAD file:
- chocolate-doom -iwad chex.wad
+ LONG_EXE_NAME -iwad chex.wad
-Installing upgrades
--------------------
+== Installing upgrades ==
-Chocolate Doom requires a version 1.9 IWAD file. Generally, if you
+LONG_GAME_NAME requires a version 1.9 IWAD file. Generally, if you
install a recent version of Doom you should have a version 1.9 IWAD.
However, if you are installing from a very old CD version or from
floppy disks, you might find you have an older version.
@@ -214,12 +231,12 @@ As the patches are binary patches that run as DOS executables, you
will need to use a DOS emulator (such as DOSBox) to run them.
#endif
-Music support
--------------
+#endif
+== Music support ==
-Chocolate Doom includes OPL emulation code that accurately reproduces
+LONG_GAME_NAME includes OPL emulation code that accurately reproduces
the way that the in-game music sounded under DOS when using an
-Adlib/Soundblaster card. This is, however, not to everyone's taste.
+Adlib/Soundblaster card. This is, however, not to everyone's taste.
#if _WIN32
Better quality MIDI playback is possible by using Windows' native
@@ -244,10 +261,18 @@ be found here:
http://www.doomworld.com/idgames/index.php?id=13928
(Doom idgames archive, /sounds/eawpats.zip)
-#ifn PRECOMPILED
-When compiling from source, be sure to compile and install timidity
+LONG_GAME_NAME also has provides a very limited form "emulation" of
+the Gravis Ultrasound (GUS) card, using Timidity's GUS patch file
+support. To use this requires a copy of the GUS patch files, found
+here:
+
+ http://www.doomworld.com/idgames/index.php?id=17127
+ (Doom idgames archive, /music/dgguspat.zip)
+
+#if !PRECOMPILED
+When compiling from source, be sure to compile and install Timidity
before installing SDL_mixer.
-#endif
+#endif
# vim: tw=70
diff --git a/man/Makefile.am b/man/Makefile.am
index 618c0bde..204e6c95 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,29 +1,115 @@
-MANPAGE_GEN_FILES=manpage.template docgen default.cfg.template extra.cfg.template
+MANPAGE_GEN_FILES = environ.man \
+ doom.template \
+ heretic.template \
+ hexen.template \
+ strife.template \
+ docgen \
+ default.cfg.template \
+ extra.cfg.template
-docdir=$(prefix)/share/doc/@PACKAGE@
+doomdocsdir = $(prefix)/share/doc/@PROGRAM_PREFIX@doom
+hereticdocsdir = $(prefix)/share/doc/@PROGRAM_PREFIX@heretic
+hexendocsdir = $(prefix)/share/doc/@PROGRAM_PREFIX@hexen
+strifedocsdir = $(prefix)/share/doc/@PROGRAM_PREFIX@strife
if HAVE_PYTHON
-man_MANS=chocolate-doom.6 \
- chocolate-server.6 \
- chocolate-setup.6 \
- default.cfg.5 \
- $(PACKAGE).cfg.5
+man_MANS = chocolate-server.6 \
+ chocolate-setup.6 \
+ chocolate-doom.6 \
+ default.cfg.5 \
+ chocolate-doom.cfg.5 \
+ chocolate-heretic.6 \
+ heretic.cfg.5 \
+ chocolate-heretic.cfg.5 \
+ chocolate-hexen.6 \
+ hexen.cfg.5 \
+ chocolate-hexen.cfg.5 \
+ chocolate-strife.6 \
+ strife.cfg.5 \
+ chocolate-strife.cfg.5
-nodist_doc_DATA=INSTALL
+doomdocs_DATA = INSTALL.doom CMDLINE.doom
+hereticdocs_DATA = INSTALL.heretic CMDLINE.heretic
+hexendocs_DATA = INSTALL.hexen CMDLINE.hexen
+strifedocs_DATA = INSTALL.strife CMDLINE.strife
chocolate-doom.6: ../src $(MANPAGE_GEN_FILES)
- ./docgen -m manpage.template ../src > $@
+ ./docgen -g doom -m doom.template ../src ../src/doom > $@
default.cfg.5: ../src default.cfg.template
- ./docgen -m default.cfg.template -c default.cfg ../src > $@
+ ./docgen -g doom -m default.cfg.template \
+ -c default ../src/m_config.c > $@
+
+chocolate-doom.cfg.5: ../src extra.cfg.template
+ ./docgen -g doom -m extra.cfg.template \
+ -c extended ../src/m_config.c > $@
+
+CMDLINE.doom : CMDLINE.template ../src ../src/doom
+ ./docgen -p CMDLINE.template ../src/ ../src/doom/ > $@
+
+INSTALL.doom: INSTALL.template
+ ./simplecpp -DDOOM -DPRECOMPILED < INSTALL.template > $@
+
+
+chocolate-heretic.6: ../src $(MANPAGE_GEN_FILES)
+ ./docgen -g heretic -m heretic.template ../src ../src/heretic > $@
+
+heretic.cfg.5: ../src default.cfg.template
+ ./docgen -g heretic -m default.cfg.template \
+ -c default ../src/m_config.c > $@
+
+chocolate-heretic.cfg.5: ../src extra.cfg.template
+ ./docgen -g heretic -m extra.cfg.template \
+ -c extended ../src/m_config.c > $@
+
+CMDLINE.heretic : CMDLINE.template ../src ../src/heretic
+ ./docgen -p CMDLINE.template ../src/ ../src/heretic/ > $@
+
+INSTALL.heretic: INSTALL.template
+ ./simplecpp -DHERETIC -DPRECOMPILED < INSTALL.template > $@
+
+
+chocolate-hexen.6: ../src $(MANPAGE_GEN_FILES)
+ ./docgen -g hexen -m hexen.template ../src ../src/hexen > $@
+
+hexen.cfg.5: ../src default.cfg.template
+ ./docgen -g hexen -m default.cfg.template \
+ -c default ../src/m_config.c > $@
+
+chocolate-hexen.cfg.5: ../src extra.cfg.template
+ ./docgen -g hexen -m extra.cfg.template \
+ -c extended ../src/m_config.c > $@
+
+CMDLINE.hexen : CMDLINE.template ../src ../src/hexen
+ ./docgen -p CMDLINE.template ../src/ ../src/hexen/ > $@
+
+INSTALL.hexen: INSTALL.template
+ ./simplecpp -DHEXEN -DPRECOMPILED < INSTALL.template > $@
+
+
+chocolate-strife.6: ../src $(MANPAGE_GEN_FILES)
+ ./docgen -g strife -m strife.template ../src ../src/strife > $@
+
+strife.cfg.5: ../src default.cfg.template
+ ./docgen -g strife -m default.cfg.template \
+ -c default ../src/m_config.c > $@
+
+chocolate-strife.cfg.5: ../src extra.cfg.template
+ ./docgen -g strife -m extra.cfg.template \
+ -c extended ../src/m_config.c > $@
+
+CMDLINE.strife : CMDLINE.template ../src ../src/strife
+ ./docgen -p CMDLINE.template ../src/ ../src/strife/ > $@
+
+INSTALL.strife: INSTALL.template
+ ./simplecpp -DSTRIFE -DPRECOMPILED < INSTALL.template > $@
-$(PACKAGE).cfg.5: ../src extra.cfg.template
- ./docgen -m extra.cfg.template -c $(PACKAGE).cfg ../src > $@
INSTALL: INSTALL.template
- ./simplecpp -DPRECOMPILED < INSTALL.template > $@
+ ./simplecpp -DDOOM -DHERETIC -DHEXEN -DSTRIFE \
+ -DPRECOMPILED < INSTALL.template > $@
endif
diff --git a/man/docgen b/man/docgen
index 3016dc5a..d9535be8 100755
--- a/man/docgen
+++ b/man/docgen
@@ -19,7 +19,7 @@
#
# For configuration file values:
#
-# //! @begin_config_file myconfig.cfg
+# //! @begin_config_file myconfig
#
# //!
# // Description of the configuration file value.
@@ -34,6 +34,8 @@ import re
import glob
import getopt
+INCLUDE_STATEMENT_RE = re.compile("@include\s+(\S+)")
+
# Find the maximum width of a list of parameters (for plain text output)
def parameter_list_width(params):
@@ -160,6 +162,7 @@ class Parameter:
self.platform = None
self.category = None
self.vanilla_option = False
+ self.games = None
def should_show(self):
return not self.vanilla_option or show_vanilla_options
@@ -184,12 +187,21 @@ class Parameter:
self.category = data
elif option_type == "vanilla":
self.vanilla_option = True
+ elif option_type == "game":
+ self.games = re.split(r'\s+', data.strip())
else:
raise "Unknown option type '%s'" % option_type
else:
self.text += text + " "
+ def _games_only_text(self, pattern="(%s only)"):
+ if not match_game and self.games:
+ games_list = ", ".join(map(str.capitalize, self.games))
+ return " " + (pattern % games_list)
+ else:
+ return ""
+
def manpage_output(self):
result = self.name
@@ -205,7 +217,7 @@ class Parameter:
escaped = re.sub('\\\\', '\\\\\\\\', self.text)
- result += escaped + "\n"
+ result += escaped + self._games_only_text() + "\n"
return result
@@ -221,6 +233,7 @@ class Parameter:
if self.platform:
result += "'''(%s only)'''" % self.platform
+ result += self._games_only_text("'''(%s only)'''")
return result
@@ -243,6 +256,8 @@ class Parameter:
if self.platform:
description += " (%s only)" % self.platform
+ description += self._games_only_text()
+
# Build the complete text for the argument
# Split the description into words and add a word at a time
@@ -291,18 +306,25 @@ def add_wiki_links(text):
def add_parameter(param, line, config_file):
+ # If we're only targeting a particular game, check this is one of
+ # the ones we're targeting.
+
+ if match_game and param.games and match_game not in param.games:
+ return
+
# Is this documenting a command line parameter?
- match = re.search('M_CheckParm(WithArgs)?\s*\(\s*"(.*?)"', line)
+ match = re.search('(M_CheckParm(WithArgs)|M_ParmExists)?\s*\(\s*"(.*?)"',
+ line)
if match:
- param.name = match.group(2)
+ param.name = match.group(3)
categories[param.category].add_param(param)
return
# Documenting a configuration file variable?
- match = re.search('CONFIG_VARIABLE_\S+\s*\(\s*(\S+?),', line)
+ match = re.search('CONFIG_VARIABLE_\S+\s*\(\s*(\S+?)\),', line)
if match:
param.name = match.group(1)
@@ -357,9 +379,9 @@ def process_file(file):
if match:
# Beginning a configuration file
- filename = match.group(1)
- current_config_file = ConfigFile(filename)
- config_files[filename] = current_config_file
+ tagname = match.group(1)
+ current_config_file = ConfigFile(tagname)
+ config_files[tagname] = current_config_file
else:
# Start of a normal comment
param = Parameter()
@@ -367,26 +389,31 @@ def process_file(file):
finally:
f.close()
-def process_files(dir):
+def process_files(path):
# Process all C source files.
- if os.path.isdir(dir):
- files = glob.glob(dir + "/*.c")
+ if os.path.isdir(path):
+ files = glob.glob(path + "/*.c")
for file in files:
process_file(file)
else:
# Special case to allow a single file to be specified as a target
- process_file(dir)
+ process_file(path)
def print_template(template_file, content):
f = open(template_file)
try:
for line in f:
- line = line.replace("@content", content)
- print(line.rstrip())
+ match = INCLUDE_STATEMENT_RE.search(line)
+ if match:
+ filename = match.group(1)
+ print_template(filename, content)
+ else:
+ line = line.replace("@content", content)
+ print(line.rstrip())
finally:
f.close()
@@ -416,22 +443,25 @@ def plaintext_output(targets, template_file):
print_template(template_file, content)
def usage():
- print("Usage: %s [-V] [-c filename ]( -m | -w | -p ) <directory>" \
+ print("Usage: %s [-V] [-c tag] [-g game] ( -m | -w | -p ) <dir>..." \
% sys.argv[0])
print(" -c : Provide documentation for the specified configuration file")
+ print(" (matches the given tag name in the source file)")
print(" -m : Manpage output")
print(" -w : Wikitext output")
print(" -p : Plaintext output")
print(" -V : Don't show Vanilla Doom options")
+ print(" -g : Only document options for specified game.")
sys.exit(0)
# Parse command line
-opts, args = getopt.getopt(sys.argv[1:], "m:wp:c:V")
+opts, args = getopt.getopt(sys.argv[1:], "m:wp:c:g:V")
output_function = None
template = None
doc_config_file = None
+match_game = None
for opt in opts:
if opt[0] == "-m":
@@ -446,14 +476,16 @@ for opt in opts:
show_vanilla_options = False
elif opt[0] == "-c":
doc_config_file = opt[1]
+ elif opt[0] == "-g":
+ match_game = opt[1]
-if output_function == None or len(args) != 1:
+if output_function == None or len(args) < 1:
usage()
else:
-
# Process specified files
- process_files(args[0])
+ for path in args:
+ process_files(path)
# Build a list of things to document
diff --git a/man/doom.template b/man/doom.template
new file mode 100644
index 00000000..b587d153
--- /dev/null
+++ b/man/doom.template
@@ -0,0 +1,41 @@
+.TH chocolate\-doom 6
+.SH NAME
+chocolate\-doom \- historically compatible Doom engine
+.SH SYNOPSIS
+.B chocolate\-doom
+[\fIOPTIONS\fR]
+.SH DESCRIPTION
+.PP
+Chocolate Doom is a port of Id Software's 1993 game "Doom" that is designed
+to behave as similar to the original DOS version of Doom as is possible.
+.br
+@content
+.SH ENVIRONMENT
+This section describes environment variables that control Chocolate Doom's
+behavior.
+@include environ.man
+.SH FILES
+.TP
+\fB$HOME/.chocolate-doom/default.cfg\fR
+The main configuration file for Chocolate Doom. See \fBdefault.cfg\fR(5).
+.TP
+\fB$HOME/.chocolate-doom/chocolate-doom.cfg\fR
+Extra configuration values that are specific to Chocolate Doom and not
+present in Vanilla Doom. See \fBchocolate-doom.cfg\fR(5).
+.SH SEE ALSO
+\fBchocolate-server\fR(6),
+\fBchocolate-setup\fR(6),
+\fBchocolate-heretic\fR(6),
+\fBchocolate-hexen\fR(6),
+\fBchocolate-strife\fR(6)
+.SH AUTHOR
+Chocolate Doom is written and maintained by Simon Howard. It is based on
+the LinuxDoom source code, released by Id Software.
+.SH COPYRIGHT
+Copyright \(co id Software Inc.
+Copyright \(co 2005-2013 Simon Howard.
+.br
+This is free software. You may redistribute copies of it under the terms of
+the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
+There is NO WARRANTY, to the extent permitted by law.
+
diff --git a/man/environ.man b/man/environ.man
new file mode 100644
index 00000000..502e965c
--- /dev/null
+++ b/man/environ.man
@@ -0,0 +1,25 @@
+.TP
+\fBDOOMWADDIR\fR, \fBDOOMWADPATH\fR
+These environment variables provide paths to search for Doom .WAD files when
+looking for a game IWAD file or a PWAD file specified with the `-file' option.
+\fBDOOMWADDIR\fR specifies a single path in which to look for WAD files,
+while \fBDOOMWWADPATH\fR specifies a colon-separated list of paths to search.
+.TP
+\fBPCSOUND_DRIVER\fR
+When running in PC speaker sound effect mode, this environment variable
+specifies a PC speaker driver to use for sound effect playback. Valid
+options are "Linux" for the Linux console mode driver, "BSD" for the
+NetBSD/OpenBSD PC speaker driver, and "SDL" for SDL-based emulated PC speaker
+playback (using the digital output).
+.TP
+\fBOPL_DRIVER\fR
+When using OPL MIDI playback, this environment variable specifies an
+OPL backend driver to use. Valid options are "SDL" for an SDL-based
+software emulated OPL chip, "Linux" for the Linux hardware OPL driver,
+and "OpenBSD" for the OpenBSD/NetBSD hardware OPL driver.
+
+Generally speaking, a real hardware OPL chip sounds better than software
+emulation; however, modern machines do not often include one. If
+present, it may still require extra work to set up and elevated
+security privileges to access.
+
diff --git a/man/heretic.template b/man/heretic.template
new file mode 100644
index 00000000..e9afa96d
--- /dev/null
+++ b/man/heretic.template
@@ -0,0 +1,43 @@
+.TH chocolate\-heretic 6
+.SH NAME
+chocolate\-heretic \- historically compatible Heretic engine
+.SH SYNOPSIS
+.B chocolate\-heretic
+[\fIOPTIONS\fR]
+.SH DESCRIPTION
+.PP
+Chocolate Heretic is a port of Raven Software's 1994 game "Heretic" that
+aims to behave as similar to the original DOS version of Heretic as
+possible.
+.br
+@content
+.SH ENVIRONMENT
+This section describes environment variables that control Chocolate Heretic's
+behavior.
+@include environ.man
+.SH FILES
+.TP
+\fB$HOME/.chocolate-doom/heretic.cfg\fR
+The main configuration file for Chocolate Heretic. See \fBheretic.cfg\fR(5).
+.TP
+\fB$HOME/.chocolate-doom/chocolate-heretic.cfg\fR
+Extra configuration values that are specific to Chocolate Heretic and not
+present in Vanilla Heretic. See \fBchocolate-heretic.cfg\fR(5).
+.SH SEE ALSO
+\fBchocolate-doom\fR(6),
+\fBchocolate-hexen\fR(6),
+\fBchocolate-server\fR(6),
+\fBchocolate-setup\fR(6)
+.SH AUTHOR
+Chocolate Heretic is part of the Chocolate Doom project, written and
+maintained by Simon Howard. It is based on the Heretic source code,
+released by Raven Software.
+.SH COPYRIGHT
+Copyright \(co id Software Inc.
+Copyright \(co Raven Software Inc.
+Copyright \(co 2005-2013 Simon Howard.
+.br
+This is free software. You may redistribute copies of it under the terms of
+the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
+There is NO WARRANTY, to the extent permitted by law.
+
diff --git a/man/hexen.template b/man/hexen.template
new file mode 100644
index 00000000..4c0524a4
--- /dev/null
+++ b/man/hexen.template
@@ -0,0 +1,43 @@
+.TH chocolate\-hexen 6
+.SH NAME
+chocolate\-hexen \- historically compatible Hexen engine
+.SH SYNOPSIS
+.B chocolate\-hexen
+[\fIOPTIONS\fR]
+.SH DESCRIPTION
+.PP
+Chocolate Hexen is a port of Raven Software's 1995 game "Hexen" that
+aims to behave as similar to the original DOS version of Hexen as
+possible.
+.br
+@content
+.SH ENVIRONMENT
+This section describes environment variables that control Chocolate Hexen's
+behavior.
+@include environ.man
+.SH FILES
+.TP
+\fB$HOME/.chocolate-doom/hexen.cfg\fR
+The main configuration file for Chocolate Hexen. See \fBhexen.cfg\fR(5).
+.TP
+\fB$HOME/.chocolate-doom/chocolate-hexen.cfg\fR
+Extra configuration values that are specific to Chocolate Hexen and not
+present in Vanilla Hexen. See \fBchocolate-hexen.cfg\fR(5).
+.SH SEE ALSO
+\fBchocolate-doom\fR(6),
+\fBchocolate-heretic\fR(6),
+\fBchocolate-server\fR(6),
+\fBchocolate-setup\fR(6)
+.SH AUTHOR
+Chocolate Hexen is part of the Chocolate Doom project, written and
+maintained by Simon Howard. It is based on the Hexen source code,
+released by Raven Software.
+.SH COPYRIGHT
+Copyright \(co id Software Inc.
+Copyright \(co Raven Software Inc.
+Copyright \(co 2005-2013 Simon Howard.
+.br
+This is free software. You may redistribute copies of it under the terms of
+the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
+There is NO WARRANTY, to the extent permitted by law.
+
diff --git a/man/manpage.template b/man/manpage.template
deleted file mode 100644
index 41f06dc0..00000000
--- a/man/manpage.template
+++ /dev/null
@@ -1,63 +0,0 @@
-.TH chocolate\-doom 6
-.SH NAME
-chocolate\-doom \- historically compatible doom engine
-.SH SYNOPSIS
-.B chocolate\-doom
-[\fIOPTIONS\fR]
-.SH DESCRIPTION
-.PP
-Chocolate Doom is a modern doom engine designed to behave
-as similar to the original doom game as is possible.
-.br
-
-@content
-
-.SH ENVIRONMENT
-This section describes environment variables that control Chocolate Doom's
-behavior.
-.TP
-\fBDOOMWADDIR\fR, \fBDOOMWADPATH\fR
-These environment variables provide paths to search for Doom .WAD files when
-looking for a game IWAD file or a PWAD file specified with the `-file' option.
-\fBDOOMWADDIR\fR specifies a single path in which to look for WAD files,
-while \fBDOOMWWADPATH\fR specifies a colon-separated list of paths to search.
-.TP
-\fBPCSOUND_DRIVER\fR
-When running in PC speaker sound effect mode, this environment variable
-specifies a PC speaker driver to use for sound effect playback. Valid
-options are "Linux" for the Linux console mode driver, "BSD" for the
-NetBSD/OpenBSD PC speaker driver, and "SDL" for SDL-based emulated PC speaker
-playback (using the digital output).
-.TP
-\fBOPL_DRIVER\fR
-When using OPL MIDI playback, this environment variable specifies an
-OPL backend driver to use. Valid options are "SDL" for an SDL-based
-software emulated OPL chip, "Linux" for the Linux hardware OPL driver,
-and "OpenBSD" for the OpenBSD/NetBSD hardware OPL driver.
-
-Generally speaking, a real hardware OPL chip sounds better than software
-emulation; however, modern machines do not often include one. If
-present, it may still require extra work to set up and elevated
-security privileges to access.
-.SH FILES
-.TP
-\fB$HOME/.chocolate-doom/default.cfg\fR
-The main configuration file for Chocolate Doom. See \fBdefault.cfg\fR(5).
-.TP
-\fB$HOME/.chocolate-doom/chocolate-doom.cfg\fR
-Extra configuration values that are specific to Chocolate Doom and not
-present in Vanilla Doom. See \fBchocolate-doom.cfg\fR(5).
-.SH SEE ALSO
-\fBchocolate-server\fR(6),
-\fBchocolate-setup\fR(6)
-.SH AUTHOR
-Chocolate Doom is written and maintained by Simon Howard. It is based on
-the LinuxDoom source code, released by Id Software.
-.SH COPYRIGHT
-Copyright \(co id Software Inc.
-Copyright \(co 2005-8 Simon Howard.
-.br
-This is free software. You may redistribute copies of it under the terms of
-the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
-There is NO WARRANTY, to the extent permitted by law.
-
diff --git a/man/simplecpp b/man/simplecpp
index d277f278..000940fc 100755
--- a/man/simplecpp
+++ b/man/simplecpp
@@ -31,39 +31,24 @@
#
# simple cpp-style preprocessor
#
-# Understands:
+# Understands most features of the C preprocessor, including:
+# #if .. #elif .. #else .. #endif
+# - with expressions
+# #ifdef
+# #define
+# #include
#
-# #define NAME
-#
-# Set an option
-# You can use -D on the command line too
-#
-# #undef NAME
-#
-# Unset an option if it is set
-#
-# #if .. #endif / #ifdef .. #endif
-#
-# Specify a list of options set, eg #ifdef DOOM2 || ULTDOOM || SHAREWARE
-# The block is only displayed if one of the options is set
-#
-# #ifn .. #endif / #ifndef .. #endif
-#
-# Similarly specify a list of options
-# The block is displayed if none of the options are set
-#
-# #include "filename"
-#
-# include the contents of a file
+import collections
import sys
import re
debug = False
-defines = {}
+defines = collections.defaultdict(lambda: False)
-command_re = re.compile("\#(\w+)(\s+(.*))?")
-include_re = re.compile("\s*\"(.*)\"\s*")
+command_re = re.compile(r"\#(\w+)(\s+(.*))?")
+include_re = re.compile(r"\s*\"(.*)\"\s*")
+define_re = re.compile(r"\s*(\S+)\s*(.*?)\s*$")
def debug_msg(message):
if debug:
@@ -73,9 +58,16 @@ def debug_msg(message):
def parse_cmdline():
for arg in sys.argv[1:]:
- if arg.startswith("-D"):
- name = arg[2:]
- defines[name] = True
+ if not arg.startswith("-D"):
+ continue
+
+ name = arg[2:]
+ if '=' in name:
+ name, value = name.split('=', 1)
+ else:
+ value = True
+
+ defines[name] = value
def parse_stream(stream):
result = read_block(stream, False)
@@ -91,6 +83,17 @@ def parse_file(filename):
finally:
f.close()
+# Evaluate an expression using Python's eval() function.
+
+def eval_expr(expr):
+ expr = expr.replace("||", " or ") \
+ .replace("&&", " and ") \
+ .replace("!", "not ")
+
+ code = compile(expr, "", "eval")
+ result = eval(code, {}, defines)
+ return result
+
# #include
def cmd_include(arg):
@@ -110,7 +113,13 @@ def cmd_include(arg):
# #define
def cmd_define(arg):
- defines[arg] = True
+ match = define_re.match(arg)
+ name = match.group(1)
+ value = match.group(2)
+ if value == '':
+ value = True
+
+ defines[name] = value
# #undef
@@ -123,20 +132,19 @@ def cmd_undef(arg):
def cmd_ifdef(arg, command, stream, ignore):
# Get the define name
- name = arg.strip()
debug_msg("%s %s >\n" % (command, arg))
# Should we ignore the contents of this block?
- sub_ignore = (name not in defines)
+ sub_ignore = not eval_expr(arg)
if "n" in command:
sub_ignore = not sub_ignore
# Parse the block
- result = read_block(stream, ignore or sub_ignore)
+ result, newarg = read_block(stream, ignore or sub_ignore)
debug_msg("%s %s < (%s)\n" % (command, arg, result))
@@ -144,9 +152,14 @@ def cmd_ifdef(arg, command, stream, ignore):
if result == "else":
debug_msg("%s %s else >\n" % (command, arg))
- result = read_block(stream, ignore or (not sub_ignore))
+ result, arg = read_block(stream, ignore or (not sub_ignore))
debug_msg("%s %s else < (%s)\n" % (command, arg, result))
+ if result == "elif":
+ debug_msg("%s %s elif %s>\n" % (command, arg, newarg))
+ cmd_ifdef(newarg, "if", stream, ignore or (not sub_ignore))
+ result = "endif"
+
# Should end in an endif:
if result != "endif":
@@ -181,8 +194,8 @@ def read_block(stream, ignore):
command = match.group(1)
arg = match.group(3)
- if command == "else" or command == "endif":
- return command
+ if command in ("else", "elif", "endif"):
+ return (command, arg)
elif command not in commands:
raise Exception("Unknown command: '%s'" % \
command)
@@ -204,6 +217,9 @@ def read_block(stream, ignore):
func(arg)
else:
if not ignore:
+ for key, value in defines.iteritems():
+ if isinstance(value, str):
+ line = line.replace(key, value)
print(line)
parse_cmdline()
diff --git a/man/strife.template b/man/strife.template
new file mode 100644
index 00000000..ddcc12f9
--- /dev/null
+++ b/man/strife.template
@@ -0,0 +1,83 @@
+.TH chocolate\-strife 6
+.SH NAME
+chocolate\-strife \- historically compatible strife engine
+.SH SYNOPSIS
+.B chocolate\-strife
+[\fIOPTIONS\fR]
+.SH DESCRIPTION
+.PP
+Chocolate Strife is an accurate and complete recreation of Rogue
+Entertainment's "Strife: Quest for the Sigil". It was created through
+more than two years of reverse engineering effort with the blessings
+of the original programmers of the game (see the section HISTORY below).
+
+@content
+
+.SH ENVIRONMENT
+This section describes environment variables that control Chocolate Strife's
+behavior.
+@include environ.man
+
+.SH FILES
+.TP
+\fB$HOME/.chocolate-doom/strife.cfg\fR
+The main configuration file for Chocolate Strife. See \fBstrife.cfg\fR(5).
+.TP
+\fB$HOME/.chocolate-doom/chocolate-strife.cfg\fR
+Extra configuration values that are specific to Chocolate Strife and not
+present in Vanilla Strife. See \fBchocolate-strife.cfg\fR(5).
+.SH SEE ALSO
+\fBchocolate-doom\fR(6),
+\fBchocolate-server\fR(6),
+\fBchocolate-setup\fR(6)
+
+.SH HISTORY
+The source code for Strife was lost, which means, unlike the code for all the
+other commercial DOOM-engine games, it cannot be released. The only access we
+have to the code is the binary executable file. Reverse engineering tools
+were employed to disassemble and decompile the executables, which were cross-
+referenced against the Linux DOOM and DOS Heretic sources and painstakingly
+combed over multiple times, instruction-by-instruction, to ensure that the
+resulting Chocolate-Doom-based executable is as close as possible to the
+original.
+
+.SH LEGALITY
+Reverse engineering is a protected activity so long as the original code is
+not used directly in the product. Due to the vast amount of information lost
+through the process of compilation, and the need to refactor large portions
+of code in order to eliminate non-portable idioms or to adapt them properly to
+Chocolate Doom's framework, the resulting code behaves the same, but is not
+the *same* code.
+
+In addition, James Monroe and John Carmack have both stated that they have no
+objections to the project. Because they are the original authors of the code,
+and neither Rogue nor their publisher, Velocity, Inc., exist any longer as
+legal entities, this is effectively legal permission.
+
+.SH BUGS
+Chocolate Strife is almost, but not entirely perfect, in recreating the
+behavior of Vanilla Strife. Help us by reporting any discrepancies you
+might notice between this executable and the vanilla DOS program.
+
+However, do *not* report any glitch that you can replicate in the vanilla EXE
+as a bug. The point of Chocolate Strife, like Chocolate Doom before it, is to
+be as bug-compatible with the original game as possible. Also be aware that
+some glitches are impossible to compatibly recreate, and wherever this is the
+case, Chocolate Strife has erred on the side of not crashing the program,
+for example by initializing pointers to NULL rather than using them without
+setting a value first.
+
+.SH AUTHORS
+Chocolate Strife is part of the Chocolate Doom project. It was reverse
+engineered from the DOS versions of Strife by James Haley and Samuel
+Villarreal.
+Chocolate Doom was written and maintained by Simon Howard, and is based
+on the LinuxDoom source code released by Id Software.
+.SH COPYRIGHT
+Copyright \(co id Software Inc.
+Copyright \(co 2005-2013 Simon Howard, James Haley, Samuel Villarreal.
+.br
+This is free software. You may redistribute copies of it under the terms of
+the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
+There is NO WARRANTY, to the extent permitted by law.
+