ref: 21a82fa12400568b67b378048a822f73f6d32a81
parent: 5df59601283df3d3c3889a350086f4bb0dce248c
author: Simon Howard <[email protected]>
date: Thu Dec 13 17:26:16 EST 2007
Add @vanilla tag for Vanilla doom command line options. Add missing documentation for -nosound, -nomusic, -nosfx. Fix up some bugs with the docgen wikitext output and allow control over output of Vanilla options. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 984
--- a/man/docgen
+++ b/man/docgen
@@ -6,7 +6,7 @@
# //!
# // @arg <extra arguments>
# // @category Category
-# // @platform <some platform that the parameter is specific to
+# // @platform <some platform that the parameter is specific to>
# //
# // Long description of the parameter
# //
@@ -19,6 +19,7 @@
import sys
import re
import glob
+import getopt
class Category:
def __init__(self, description):
@@ -54,7 +55,8 @@
w = self.paramtext_width()
for p in self.params:
- result += p.plaintext_output(w)
+ if p.should_show():
+ result += p.plaintext_output(w)
result = result.rstrip() + "\n"
@@ -66,8 +68,9 @@
self.params.sort()
for p in self.params:
- result += ".TP\n"
- result += p.manpage_output()
+ if p.should_show():
+ result += ".TP\n"
+ result += p.manpage_output()
return result
@@ -77,8 +80,15 @@
self.params.sort()
for p in self.params:
- result += "; " + p.wiki_output() + "\n"
+ if p.should_show():
+ result += "; " + p.wiki_output() + "\n"
+ # Escape special HTML characters
+
+ result = result.replace("&", "&")
+ result = result.replace("<", "<")
+ result = result.replace(">", ">")
+
return result
categories = {
@@ -90,6 +100,10 @@
"compat": Category("Compatibility"),
}
+# Show options that are in Vanilla Doom? Or only new options?
+
+show_vanilla_options = True
+
class Parameter:
def __cmp__(self, other):
if self.name < other.name:
@@ -103,12 +117,16 @@
self.args = None
self.platform = None
self.category = None
+ self.vanilla_option = False
+ def should_show(self):
+ return not self.vanilla_option or show_vanilla_options
+
def add_text(self, text):
if len(text) <= 0:
pass
elif text[0] == "@":
- match = re.match('@(\S+)\s+(.*)', text)
+ match = re.match('@(\S+)\s*(.*)', text)
if not match:
raise "Malformed option line: %s" % text
@@ -122,6 +140,8 @@
self.platform = data
elif option_type == "category":
self.category = data
+ elif option_type == "vanilla":
+ self.vanilla_option = True
else:
raise "Unknown option type '%s'" % option_type
@@ -158,7 +178,7 @@
result += self.text
if self.platform:
- result += "'''(%s only)'''"
+ result += "'''(%s only)'''" % self.platform
return result
@@ -305,12 +325,32 @@
if c != None:
print categories[c].plaintext_output()
-if len(sys.argv) > 2 and sys.argv[1] == "-m":
- manpage_output(sys.argv[2])
-elif len(sys.argv) > 2 and sys.argv[1] == "-w":
- wiki_output(sys.argv[2])
-elif len(sys.argv) > 2 and sys.argv[1] == "-p":
- plaintext_output(sys.argv[2])
+def usage():
+ print "Usage: %s [-V] ( -m | -w | -p ) <directory>" % sys.argv[0]
+ print " -m : Manpage output"
+ print " -w : Wikitext output"
+ print " -p : Plaintext output"
+ print " -V : Don't show Vanilla Doom options"
+ sys.exit(0)
+
+# Parse command line
+
+opts, args = getopt.getopt(sys.argv[1:], "mwpV")
+
+output_function = None
+
+for opt in opts:
+ if opt[0] == "-m":
+ output_function = manpage_output
+ elif opt[0] == "-w":
+ output_function = wiki_output
+ elif opt[0] == "-p":
+ output_function = plaintext_output
+ elif opt[0] == "-V":
+ show_vanilla_options = False
+
+if output_function == None or len(args) != 1:
+ usage()
else:
- print "%s [ -m | -w | -p ] <directory>" % sys.argv[0]
+ output_function(args[0])
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -851,6 +851,8 @@
modifiedgame = false;
//!
+ // @vanilla
+ //
// Disable monsters.
//
@@ -857,6 +859,8 @@
nomonsters = M_CheckParm ("-nomonsters");
//!
+ // @vanilla
+ //
// Monsters respawn after being killed.
//
@@ -863,6 +867,8 @@
respawnparm = M_CheckParm ("-respawn");
//!
+ // @vanilla
+ //
// Monsters move faster.
//
@@ -869,6 +875,8 @@
fastparm = M_CheckParm ("-fast");
//!
+ // @vanilla
+ //
// Developer mode. F1 saves a screenshot in the current working
// directory.
//
@@ -877,6 +885,7 @@
//!
// @category net
+ // @vanilla
//
// Start a deathmatch game.
//
@@ -886,6 +895,7 @@
//!
// @category net
+ // @vanilla
//
// Start a deathmatch 2.0 game. Weapons do not stay in place and
// all items respawn after 30 seconds.
@@ -903,6 +913,7 @@
//!
// @arg <x>
+ // @vanilla
//
// Turbo mode. The player's speed is multiplied by x%. If unspecified,
// x defaults to 200. Values are rounded up to 10 and down to 400.
@@ -1065,6 +1076,7 @@
//!
// @arg <files>
+ // @vanilla
//
// Load the specified PWAD files.
//
@@ -1125,6 +1137,7 @@
//!
// @arg <demo>
// @category demo
+ // @vanilla
//
// Play back the demo named demo.lmp.
//
@@ -1136,6 +1149,7 @@
//!
// @arg <demo>
// @category demo
+ // @vanilla
//
// Play back the demo named demo.lmp, determining the framerate
// of the screen.
@@ -1216,6 +1230,7 @@
//!
// @arg <skill>
+ // @vanilla
//
// Set the game skill, 1-5 (1: easiest, 5: hardest). A skill of
// 0 disables all monsters.
@@ -1231,6 +1246,7 @@
//!
// @arg <n>
+ // @vanilla
//
// Start playing on episode n (1-4)
//
@@ -1249,6 +1265,7 @@
//!
// @arg <n>
// @category net
+ // @vanilla
//
// For multiplayer games: exit each level after n minutes.
//
@@ -1263,6 +1280,7 @@
//!
// @category net
+ // @vanilla
//
// Austin Virtual Gaming: end levels after 20 minutes.
//
@@ -1278,6 +1296,7 @@
//!
// @arg [<x> <y> | <xy>]
+ // @vanilla
//
// Start a game immediately, warping to ExMy (Doom 1) or MAPxy
// (Doom 2)
@@ -1324,6 +1343,7 @@
//!
// @arg <s>
+ // @vanilla
//
// Load the game in slot s.
//
@@ -1425,6 +1445,7 @@
//!
// @arg <x>
// @category demo
+ // @vanilla
//
// Record a demo named x.lmp.
//
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1842,6 +1842,7 @@
//!
// @arg <size>
// @category demo
+ // @vanilla
//
// Specify the demo buffer size (KiB)
//
@@ -1981,6 +1982,8 @@
void G_TimeDemo (char* name)
{
//!
+ // @vanilla
+ //
// Disable rendering the screen entirely.
//
@@ -1987,6 +1990,8 @@
nodrawers = M_CheckParm ("-nodraw");
//!
+ // @vanilla
+ //
// Disable blitting the screen.
//
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -682,6 +682,7 @@
//!
// @arg <file>
+ // @vanilla
//
// Load configuration from the specified file, instead of
// default.cfg.
@@ -764,6 +765,7 @@
#ifdef _WIN32
//!
// @platform windows
+ // @vanilla
//
// Save configuration data and savegames in c:\doomdata,
// allowing play from CD.
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -241,18 +241,43 @@
void S_Init(int sfxVolume, int musicVolume)
{
+ boolean nosound, nosfx, nomusic;
int i;
+ //!
+ // @vanilla
+ //
+ // Disable all sound output.
+ //
+
+ nosound = M_CheckParm("-nosound") > 0;
+
+ //!
+ // @vanilla
+ //
+ // Disable sound effects.
+ //
+
+ nosfx = M_CheckParm("-nosfx") > 0;
+
+ //!
+ // @vanilla
+ //
+ // Disable music.
+ //
+
+ nomusic = M_CheckParm("-nomusic") > 0;
+
// Initialise the sound and music subsystems.
- if (M_CheckParm("-nosound") <= 0 && !screensaver_mode)
+ if (!nosound && !screensaver_mode)
{
- if (M_CheckParm("-nosfx") <= 0)
+ if (!nosfx)
{
InitSfxModule();
}
- if (M_CheckParm("-nomusic") <= 0)
+ if (!nomusic)
{
InitMusicModule();
}