diff options
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | man/Makefile.am | 72 | ||||
-rwxr-xr-x | man/docgen | 59 | ||||
-rw-r--r-- | src/m_config.c | 204 | ||||
-rw-r--r-- | src/strife/d_main.c | 4 | ||||
-rw-r--r-- | src/strife/g_game.c | 2 |
6 files changed, 254 insertions, 91 deletions
diff --git a/Makefile.am b/Makefile.am index 0012b97f..a853c76c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -62,8 +62,10 @@ if HAVE_PYTHON noinst_DATA=CMDLINE +# TODO: CMDLINE only documents the Doom command line, not other games. + CMDLINE : src/ - ./man/docgen -p man/CMDLINE.template src/ > $@ + ./man/docgen -p man/CMDLINE.template src/ src/doom/ > $@ INSTALL : man/INSTALL.template man/simplecpp ./man/simplecpp < man/INSTALL.template > $@ diff --git a/man/Makefile.am b/man/Makefile.am index 618c0bde..1be69258 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -5,22 +5,76 @@ docdir=$(prefix)/share/doc/@PACKAGE@ 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 + + chocolate-doom.6: ../src $(MANPAGE_GEN_FILES) - ./docgen -m manpage.template ../src > $@ + ./docgen -g doom -m manpage.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 > $@ + + + +chocolate-heretic.6: ../src $(MANPAGE_GEN_FILES) + ./docgen -g heretic -m manpage.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 > $@ + + + +chocolate-hexen.6: ../src $(MANPAGE_GEN_FILES) + ./docgen -g hexen -m manpage.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 > $@ + + + +chocolate-strife.6: ../src $(MANPAGE_GEN_FILES) + ./docgen -g strife -m manpage.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 > $@ + -$(PACKAGE).cfg.5: ../src extra.cfg.template - ./docgen -m extra.cfg.template -c $(PACKAGE).cfg ../src > $@ INSTALL: INSTALL.template ./simplecpp -DPRECOMPILED < INSTALL.template > $@ @@ -19,7 +19,7 @@ # # For configuration file values: # -# //! @begin_config_file myconfig.cfg +# //! @begin_config_file myconfig # # //! # // Description of the configuration file value. @@ -160,6 +160,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 +185,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 +215,7 @@ class Parameter: escaped = re.sub('\\\\', '\\\\\\\\', self.text) - result += escaped + "\n" + result += escaped + self._games_only_text() + "\n" return result @@ -221,6 +231,7 @@ class Parameter: if self.platform: result += "'''(%s only)'''" % self.platform + result += self._games_only_text("'''(%s only)'''") return result @@ -243,6 +254,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 +304,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 +377,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,18 +387,18 @@ 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) @@ -416,22 +436,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 +469,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/src/m_config.c b/src/m_config.c index 87079bd5..8f1a2aa4 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -114,15 +114,15 @@ typedef struct #define CONFIG_VARIABLE_STRING(name) \ CONFIG_VARIABLE_GENERIC(name, DEFAULT_STRING) -//! @begin_config_file default.cfg +//! @begin_config_file default static default_t doom_defaults_list[] = { - //! + //! // Mouse sensitivity. This value is used to multiply input mouse // movement to control the effect of moving the mouse. // - // The "normal" maximum value available for this through the + // The "normal" maximum value available for this through the // in-game options menu is 9. A value of 31 or greater will cause // the game to crash when entering the options menu. // @@ -142,19 +142,25 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(music_volume), //! + // @game strife + // // If non-zero, dialogue text is displayed over characters' pictures - // when engaging actors who have voices. (Strife only) + // when engaging actors who have voices. // CONFIG_VARIABLE_INT(show_talk), //! - // Volume of voice sound effects, range 0-15. (Strife only) + // @game strife + // + // Volume of voice sound effects, range 0-15. // CONFIG_VARIABLE_INT(voice_volume), //! + // @game doom + // // If non-zero, messages are displayed on the heads-up display // in the game ("picked up a clip", etc). If zero, these messages // are not displayed. @@ -162,7 +168,7 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(show_messages), - //! + //! // Keyboard key to turn right. // @@ -199,139 +205,185 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_KEY(key_straferight), //! - // Keyboard key to use health. (Strife only) + // @game strife + // + // Keyboard key to use health. // CONFIG_VARIABLE_KEY(key_useHealth), //! + // @game hexen + // // Keyboard key to jump. // CONFIG_VARIABLE_KEY(key_jump), //! + // @game heretic hexen + // // Keyboard key to fly upward. // CONFIG_VARIABLE_KEY(key_flyup), //! + // @game heretic hexen + // // Keyboard key to fly downwards. // CONFIG_VARIABLE_KEY(key_flydown), - + //! + // @game heretic hexen + // // Keyboard key to center flying. // CONFIG_VARIABLE_KEY(key_flycenter), //! + // @game heretic hexen + // // Keyboard key to look up. // CONFIG_VARIABLE_KEY(key_lookup), //! + // @game heretic hexen + // // Keyboard key to look down. // CONFIG_VARIABLE_KEY(key_lookdown), //! + // @game heretic hexen + // // Keyboard key to center the view. // CONFIG_VARIABLE_KEY(key_lookcenter), //! - // Keyboard key to query inventory. (Strife only) + // @game strife + // + // Keyboard key to query inventory. // CONFIG_VARIABLE_KEY(key_invquery), //! - // Keyboard key to display mission objective. (Strife only) + // @game strife + // + // Keyboard key to display mission objective. // CONFIG_VARIABLE_KEY(key_mission), //! - // Keyboard key to display inventory popup. (Strife only) + // @game strife + // + // Keyboard key to display inventory popup. // CONFIG_VARIABLE_KEY(key_invPop), //! - // Keyboard key to display keys popup. (Strife only) + // @game strife + // + // Keyboard key to display keys popup. // CONFIG_VARIABLE_KEY(key_invKey), //! - // Keyboard key to jump to start of inventory. (Strife only) + // @game strife + // + // Keyboard key to jump to start of inventory. // CONFIG_VARIABLE_KEY(key_invHome), //! - // Keyboard key to jump to end of inventory. (Strife only) + // @game strife + // + // Keyboard key to jump to end of inventory. // CONFIG_VARIABLE_KEY(key_invEnd), //! + // @game heretic hexen + // // Keyboard key to scroll left in the inventory. // CONFIG_VARIABLE_KEY(key_invleft), //! + // @game heretic hexen + // // Keyboard key to scroll right in the inventory. // CONFIG_VARIABLE_KEY(key_invright), //! - // Keyboard key to scroll left in the inventory. (Strife) + // @game strife // - + // Keyboard key to scroll left in the inventory. + // + CONFIG_VARIABLE_KEY(key_invLeft), //! - // Keyboard key to scroll right in the inventory. (Strife) + // @game strife + // + // Keyboard key to scroll right in the inventory. // CONFIG_VARIABLE_KEY(key_invRight), //! + // @game heretic hexen + // // Keyboard key to use the current item in the inventory. // CONFIG_VARIABLE_KEY(key_useartifact), //! - // Keyboard key to use inventory item. (Strife) + // @game strife // - + // Keyboard key to use inventory item. + // + CONFIG_VARIABLE_KEY(key_invUse), //! - // Keyboard key to drop an inventory item. (Strife only) + // @game strife + // + // Keyboard key to drop an inventory item. // CONFIG_VARIABLE_KEY(key_invDrop), //! - // Keyboard key to look up. (Strife) + // @game strife + // + // Keyboard key to look up. // CONFIG_VARIABLE_KEY(key_lookUp), //! - // Keyboard key to look down. (Strife) + // @game strife + // + // Keyboard key to look down. // CONFIG_VARIABLE_KEY(key_lookDown), @@ -367,7 +419,7 @@ static default_t doom_defaults_list[] = // disabled. // - CONFIG_VARIABLE_INT(use_mouse), + CONFIG_VARIABLE_INT(use_mouse), //! // Mouse button to fire the currently selected weapon. @@ -389,6 +441,8 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(mouseb_forward), //! + // @game hexen strife + // // Mouse button to jump. // @@ -427,15 +481,19 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(joyb_speed), //! + // @game hexen strife + // // Joystick button to jump. // CONFIG_VARIABLE_INT(joyb_jump), //! + // @game doom heretic hexen + // // Screen size, range 3-11. // - // A value of 11 gives a full-screen view with the status bar not + // A value of 11 gives a full-screen view with the status bar not // displayed. A value of 10 gives a full-screen view with the // status bar displayed. // @@ -443,16 +501,20 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(screenblocks), //! + // @game strife + // // Screen size, range 3-11. // // A value of 11 gives a full-screen view with the status bar not // displayed. A value of 10 gives a full-screen view with the - // status bar displayed. (Strife only) + // status bar displayed. // CONFIG_VARIABLE_INT(screensize), //! + // @game doom + // // Screen detail. Zero gives normal "high detail" mode, while // a non-zero value gives "low detail" mode. // @@ -473,9 +535,9 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(snd_musicdevice), //! - // Sound effects device. A value of zero disables in-game sound - // effects, a value of 1 enables PC speaker sound effects, while - // a value in the range 2-9 enables the "normal" digital sound + // Sound effects device. A value of zero disables in-game sound + // effects, a value of 1 enables PC speaker sound effects, while + // a value in the range 2-9 enables the "normal" digital sound // effects. // @@ -497,7 +559,7 @@ static default_t doom_defaults_list[] = // SoundBlaster DMA channel. Unused. // - CONFIG_VARIABLE_INT(snd_sbdma), + CONFIG_VARIABLE_INT(snd_sbdma), //! // Output port to use for OPL MIDI playback. Unused. @@ -506,7 +568,7 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(snd_mport), //! - // Gamma correction level. A value of zero disables gamma + // Gamma correction level. A value of zero disables gamma // correction, while a value in the range 1-4 gives increasing // levels of gamma correction. // @@ -514,12 +576,16 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(usegamma), //! + // @game hexen + // // Directory in which to store savegames. // CONFIG_VARIABLE_STRING(savedir), //! + // @game hexen + // // Controls whether messages are displayed in the heads-up display. // If this has a non-zero value, messages are displayed. // @@ -527,13 +593,17 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(messageson), //! - // Name of background flat used by view border. (Strife only) + // @game strife + // + // Name of background flat used by view border. // CONFIG_VARIABLE_STRING(back_flat), //! - // Multiplayer nickname (?). (Strife only) + // @game strife + // + // Multiplayer nickname (?). // CONFIG_VARIABLE_STRING(nickname), @@ -566,13 +636,13 @@ static default_t doom_defaults_list[] = // Multiplayer chat macro: message to send when alt+4 is pressed. // - CONFIG_VARIABLE_STRING(chatmacro4), + CONFIG_VARIABLE_STRING(chatmacro4), //! // Multiplayer chat macro: message to send when alt+5 is pressed. // - CONFIG_VARIABLE_STRING(chatmacro5), + CONFIG_VARIABLE_STRING(chatmacro5), //! // Multiplayer chat macro: message to send when alt+6 is pressed. @@ -599,45 +669,47 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_STRING(chatmacro9), //! + // @game strife + // // Serial port number to use for SERSETUP.EXE (unused). - // (Strife only) // CONFIG_VARIABLE_INT(comport), }; -static default_collection_t doom_defaults = +static default_collection_t doom_defaults = { doom_defaults_list, arrlen(doom_defaults_list), NULL, }; -//! @begin_config_file chocolate-doom.cfg +//! @begin_config_file extended -static default_t extra_defaults_list[] = +static default_t extra_defaults_list[] = { //! - // If non-zero, use the graphical startup mode for Heretic and - // Hexen. + // @game heretic hexen strife + // + // If non-zero, display the graphical startup screen. // CONFIG_VARIABLE_INT(graphical_startup), //! - // If non-zero, video settings will be autoadjusted to a valid + // If non-zero, video settings will be autoadjusted to a valid // configuration when the screen_width and screen_height variables // do not match any valid configuration. // - CONFIG_VARIABLE_INT(autoadjust_video_settings), + CONFIG_VARIABLE_INT(autoadjust_video_settings), //! // If non-zero, the game will run in full screen mode. If zero, // the game will run in a window. // - CONFIG_VARIABLE_INT(fullscreen), + CONFIG_VARIABLE_INT(fullscreen), //! // If non-zero, the screen will be stretched vertically to display @@ -648,12 +720,12 @@ static default_t extra_defaults_list[] = //! // Number of milliseconds to wait on startup after the video mode - // has been set, before the game will start. This allows the - // screen to settle on some monitors that do not display an image + // has been set, before the game will start. This allows the + // screen to settle on some monitors that do not display an image // for a brief interval after changing video modes. // - CONFIG_VARIABLE_INT(startup_delay), + CONFIG_VARIABLE_INT(startup_delay), //! // Screen width in pixels. If running in full screen mode, this is @@ -671,7 +743,7 @@ static default_t extra_defaults_list[] = // will run. // - CONFIG_VARIABLE_INT(screen_height), + CONFIG_VARIABLE_INT(screen_height), //! // Color depth of the screen, in bits. @@ -688,7 +760,7 @@ static default_t extra_defaults_list[] = CONFIG_VARIABLE_INT(grabmouse), //! - // If non-zero, all vertical mouse movement is ignored. This + // If non-zero, all vertical mouse movement is ignored. This // emulates the behavior of the "novert" tool available under DOS // that performs the same function. // @@ -701,7 +773,7 @@ static default_t extra_defaults_list[] = // multiplied by this value. // - CONFIG_VARIABLE_FLOAT(mouse_acceleration), + CONFIG_VARIABLE_FLOAT(mouse_acceleration), //! // Mouse acceleration threshold. When the speed of mouse movement @@ -733,14 +805,18 @@ static default_t extra_defaults_list[] = CONFIG_VARIABLE_INT_HEX(opl_io_port), //! - // If non-zero, the ENDOOM screen is displayed when exiting the - // game. If zero, the ENDOOM screen is not displayed. + // @game doom heretic strife + // + // If non-zero, the ENDOOM text screen is displayed when exiting the + // game. If zero, the ENDOOM screen is not displayed. // CONFIG_VARIABLE_INT(show_endoom), //! - // If non-zero, the Vanilla savegame limit is enforced; if the + // @game doom strife + // + // If non-zero, the Vanilla savegame limit is enforced; if the // savegame exceeds 180224 bytes in size, the game will exit with // an error. If this has a value of zero, there is no limit to // the size of savegames. @@ -749,7 +825,9 @@ static default_t extra_defaults_list[] = CONFIG_VARIABLE_INT(vanilla_savegame_limit), //! - // If non-zero, the Vanilla demo size limit is enforced; the game + // @game doom strife + // + // If non-zero, the Vanilla demo size limit is enforced; the game // exits with an error when a demo exceeds the demo size limit // (128KiB by default). If this has a value of zero, there is no // limit to the size of demos. @@ -759,7 +837,7 @@ static default_t extra_defaults_list[] = //! // If non-zero, the game behaves like Vanilla Doom, always assuming - // an American keyboard mapping. If this has a value of zero, the + // an American keyboard mapping. If this has a value of zero, the // native keyboard mapping of the keyboard is used. // @@ -783,7 +861,7 @@ static default_t extra_defaults_list[] = #ifdef FEATURE_MULTIPLAYER //! - // Name to use in network games for identification. This is only + // Name to use in network games for identification. This is only // used on the "waiting" screen while waiting for the game to start. // @@ -820,7 +898,7 @@ static default_t extra_defaults_list[] = // If non-zero, movement on the vertical joystick axis is inverted. // - CONFIG_VARIABLE_INT(joystick_y_invert), + CONFIG_VARIABLE_INT(joystick_y_invert), //! // Joystick button to strafe left. @@ -896,10 +974,10 @@ static default_t extra_defaults_list[] = // sample rate conversions of sound effects. Support for this // must be compiled into the program. // - // If zero, libsamplerate support is disabled. If non-zero, + // If zero, libsamplerate support is disabled. If non-zero, // libsamplerate is enabled. Increasing values roughly correspond - // to higher quality conversion; the higher the quality, the - // slower the conversion process. Linear conversion = 1; + // to higher quality conversion; the higher the quality, the + // slower the conversion process. Linear conversion = 1; // Zero order hold = 2; Fast Sinc filter = 3; Medium quality // Sinc filter = 4; High quality Sinc filter = 5. // @@ -1250,24 +1328,32 @@ static default_t extra_defaults_list[] = CONFIG_VARIABLE_KEY(key_multi_msgplayer4), //! + // @game hexen strife + // // Key to send a message to player 5 during multiplayer games. // CONFIG_VARIABLE_KEY(key_multi_msgplayer5), //! + // @game hexen strife + // // Key to send a message to player 6 during multiplayer games. // CONFIG_VARIABLE_KEY(key_multi_msgplayer6), //! + // @game hexen strife + // // Key to send a message to player 7 during multiplayer games. // CONFIG_VARIABLE_KEY(key_multi_msgplayer7), //! + // @game hexen strife + // // Key to send a message to player 8 during multiplayer games. // diff --git a/src/strife/d_main.c b/src/strife/d_main.c index 5615709b..ad69f1d4 100644 --- a/src/strife/d_main.c +++ b/src/strife/d_main.c @@ -1457,16 +1457,12 @@ void D_DoomMain (void) nomonsters = M_CheckParm ("-nomonsters"); //! - // @category strife - // // Sets Rogue playtesting mode (godmode, noclip toggled by backspace) // workparm = M_CheckParm ("-work"); //! - // @category strife - // // Attemps to flip player gun sprites, but is broken. // diff --git a/src/strife/g_game.c b/src/strife/g_game.c index 84e3c274..e295b858 100644 --- a/src/strife/g_game.c +++ b/src/strife/g_game.c @@ -2213,7 +2213,7 @@ void G_BeginRecording (void) { int i; - //! + // // @category demo // // Record a high resolution "Doom 1.91" demo. |