shithub: choc

Download patch

ref: 993315afc4b1fddaf8952e7e55d1373b5052dd7c
parent: a1b2ce54d02823aa85c7df6aa016c567185451ae
parent: ad11652dcd8e0923432ad272e6535276c51d39eb
author: Simon Howard <fraggle@gmail.com>
date: Sun Oct 28 19:45:08 EDT 2012

Merge from trunk.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2537

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,44 +1,196 @@
+2012-02-04 23:05:42 fraggle
+
+	On Windows, convert the USER and USERNAME environment variables from
+	OEM codepage to UTF-8 encoding.  This should fix the case where the
+	user has a username that includes non-ASCII characters (thanks
+	Alexandre Xavier).
+
+2012-02-03 22:05:49 fraggle
+
+	Fix crash when typing lots of Unicode characters into a number input
+	box.
+
+2012-02-03 21:46:55 fraggle
+
+	Fix chat macros when vanilla_keyboard_mapping is turned off.
+
+2012-02-03 21:38:06 fraggle
+
+	Fix CP437-Unicode mapping of cedilla character.
+
+2012-02-03 21:10:36 fraggle
+
+	Upgrade the input box and label widgets to use UTF-8 strings.
+
+2012-02-03 21:09:57 fraggle
+
+	Support Unicode input by mapping typed Unicode characters >= 128 up
+	into a higher range to avoid conflicts with Doom's key constants.
+
+2012-02-03 20:21:17 fraggle
+
+	Split off UTF-8 code into separate file and add extra functions.
+
+2012-02-02 23:35:16 fraggle
+
+	Beginnings of limited textscreen UTF-8 support.
+
+2012-02-02 21:59:46 fraggle
+
+	Re-resolve the address of the master server every eight hours, to
+	adapt to changes in DNS configuration.
+
+2012-02-02 21:10:20 fraggle
+
+	Fix scroll bar behavior (thanks Alexandre Xavier).
+
+2012-02-02 20:34:09 fraggle
+
+	Only use the SDL mouse lag workaround on Windows - not all systems
+	allow the cursor to be changed.  This fixes Chocolate Doom on AmigaOS
+	(thanks Timo Sievänen).
+
+2012-01-05 02:33:25 fraggle
+
+	Add hack command-line option for on-screen OPL status output - useful
+	for GENMIDI development.
+
+2011-11-26 22:09:42 fraggle
+
+	Fix weapon cycling keys when using IDKFA in Shareware Doom (thanks
+	Alexandre Xavier).
+
+2011-11-03 22:18:36 fraggle
+
+	Remove use of $< in Makefiles, for compatibility with OpenBSD's make.
+
+2011-10-23 23:55:43 fraggle
+
+	Fix chat macro defaults in setup tool.
+
+2011-10-23 20:53:06 fraggle
+
+	Fix numeric keypad when entering values in text boxes (thanks Twelve).
+
+2011-10-23 20:42:43 fraggle
+
+	Fix crash when closing a window.
+
+2011-10-23 20:28:10 fraggle
+
+	Don't save value when destructor is called.
+
+2011-10-23 20:25:55 fraggle
+
+	Rework textscreen focus handling so that input boxes will stop editing
+	when they lose their focus (thanks Twelve).
+
+2011-10-22 19:24:08 fraggle
+
+	Fix teleport behavior when emulating the alternate Final Doom
+	executable.  Change the default Final Doom emulation mode to be the
+	original executable.
+
+2011-10-16 17:59:19 fraggle
+
+	Zero out bottom two bits of palette data, to more accurately emulate
+	the PC hardware that only supports 6 bits per channel (thanks
+	GhostlyDeath).
+
+2011-09-17 16:55:08 fraggle
+
+	Change query loop to sleep for 1ms rather than 50ms intervals, so that
+	precision is not lost in ping times.
+
+2011-09-17 16:43:25 fraggle
+
+	Refactor query code so that it is possible to query by polling, rather
+	than blocking on a query function.
+
+2011-09-17 14:44:58 fraggle
+
+	Fix ping calculation with LAN search.
+
+2011-09-11 18:01:56 fraggle
+
+	Don't show error dialog if running from the console on OS X.
+
+2011-08-29 21:37:26 fraggle
+
+	Fix bug with detection of IWAD type by filename (thanks mether).
+
+2011-08-22 19:40:26 fraggle
+
+	Add clarification note about icon copyright status (thanks to Chris
+	Metcalf for clarification by email).
+
+2011-08-20 19:20:43 fraggle
+
+	Update COPYING to latest version of GPL2 with new address of FSF
+	(thanks Rahul Sundaram).
+
+2011-08-20 19:10:23 fraggle
+
+	Fix gnome-screensaver .desktop file (thanks Rahul Sundaram).
+
+2011-07-24 21:55:27 fraggle
+
+	Fix default mouse buttons in setup tool (Thanks Alexandre Xavier).
+
+2011-07-21 15:21:57 fraggle
+
+	Don't use $^ in Makefiles, as it s a GNU make extension (thanks Jakub
+	Lach).
+
+2011-06-17 00:14:14 fraggle
+
+	Add AM_SILENT_RULES macro for terser build output.
+
+2011-05-17 23:59:44 fraggle
+
+	Update NEWS and ChangeLog, bump version number.
+
 2011-05-17 23:51:37 fraggle
-	
+
 	Add dependency for INSTALL generation.
 
 2011-05-17 23:06:22 fraggle
-	
+
 	Detect chex.deh if it is in the same directory as the IWAD file.
 
 2011-05-14 22:50:46 fraggle
-	
+
 	Fix display of ENDOOM screen.
 
 2011-05-14 22:47:12 fraggle
-	
+
 	Fix install of screensaver desktop file.
 
 2011-05-14 22:07:55 fraggle
-	
+
 	Add freedesktop.org desktop files for chocolate-doom, chocolate-setup
 	(thanks Adrián Chaves Fernández).
 
 2011-05-14 21:11:26 fraggle
-	
+
 	Convert build system to using the PROGRAM_PREFIX system used on
 	raven-branch.
 
 2011-05-08 19:32:02 fraggle
-	
+
 	Update NEWS.
 
 2011-05-08 19:29:46 fraggle
-	
+
 	Allow IWAD files to be double-clicked in the finder to set the IWAD
 	configuration.
 
 2011-05-08 01:31:01 fraggle
-	
+
 	Shut up compiler warnings.
 
 2011-05-08 00:52:26 fraggle
-	
+
 	Rework OS X launcher package.  Include documentation files within the
 	application bundle and add a help menu with links.  Rework .dmg
 	generation to generate a file with a "fancy" background image and
@@ -45,191 +197,191 @@
 	overall nicer appearance.
 
 2011-04-26 06:49:53 quasar_te
-	
+
 	Support for Win32 native OPL output when compiled with Microsoft
 	Visual C++.  Confirmed to work with Aureal Vortex AU8830 in Win98SE by
 	GhostlyDeath.
 
 2011-04-24 23:22:11 fraggle
-	
+
 	Infer -server when -privateserver is specified (thanks Porsche Monty).
 
 2011-04-24 22:39:31 fraggle
-	
+
 	Add test button to joystick menu in setup tool (thanks Alexandre
 	Xavier).
 
 2011-04-18 23:10:16 fraggle
-	
+
 	Add test hack for simulating Porsche Monty's scanline emulation (see
 	comment in file).
 
 2011-04-17 18:33:04 fraggle
-	
+
 	Fix libtextscreen window hotkeys to work when shift is held down /
 	capslock turned on.  Fix a similar problem in-game when typing cheat
 	codes or using menu hotkeys (thanks Alexandre Xavier).
 
 2011-04-17 17:53:47 fraggle
-	
+
 	Make Final Doom IWAD labels shorter, so they don't make the launch
 	windows grow.
 
 2011-04-11 20:49:45 fraggle
-	
+
 	Allow the shift key to be held down when changing key/mouse/joystick
 	bindings to prevent bindings to the same key from being cleared
 	(thanks myk).
 
 2011-04-09 01:27:13 fraggle
-	
+
 	Fix action area minimum width calculation.
 
 2011-04-04 21:30:17 fraggle
-	
+
 	Close dropdown list popup windows when clicking outside the window.
 
 2011-04-04 21:12:59 fraggle
-	
+
 	Fix crash.
 
 2011-04-04 21:09:42 fraggle
-	
+
 	Fix crash.
 
 2011-04-04 21:07:07 fraggle
-	
+
 	Change the background color when hovering over widgets.
 
 2011-04-04 19:40:28 fraggle
-	
+
 	Change setup tool default sampling rate to 44100Hz to match the game
 	(thanks Alexandre Xavier).
 
 2011-03-30 20:16:40 fraggle
-	
+
 	Add a symlink hack to work around the fact that OS X doesn't like
 	paths in MANPATH to contain spaces.
 
 2011-03-30 20:00:51 fraggle
-	
+
 	On OS X, display a dialog box when exiting with I_Error, like on
 	Windows.
 
 2011-03-29 00:48:31 fraggle
-	
+
 	Remove the BUGS file as it doesn't really contain any useful
 	information.
 
 2011-03-29 00:39:48 fraggle
-	
+
 	Add vim modeline for text wrapping to documentation text files.
 
 2011-03-29 00:33:09 fraggle
-	
+
 	Emulate bug with IDMUS cheat when emulating v1.9 (thanks Alexandre
 	Xavier).
 
 2011-03-28 22:36:00 fraggle
-	
+
 	Fix OPL MIDI playback when using an empty .mus / .mid file (thanks
 	Alexandre Xavier).
 
 2011-03-28 22:32:14 fraggle
-	
+
 	Allow .lmp files to be loaded (and demo files to be played back) that
 	have long filenames (thanks blzut3).
 
 2011-03-28 01:24:47 fraggle
-	
+
 	Fix weapon cycling from the shotgun to the chaingun in Doom 1 (thanks
 	Alexandre Xavier).
 
 2011-03-28 00:45:53 fraggle
-	
+
 	Scroll faster in reaction to the scroll wheel.
 
 2011-03-28 00:42:00 fraggle
-	
+
 	Change default sfx/music volume in setup tool to 8, to match the game
 	(thanks Alexandre Xavier).
 
 2011-03-22 21:33:17 fraggle
-	
+
 	Switch separator to show "screen mode" or "window size" depending on
 	whether fullscreen is turned on or not.
 
 2011-03-22 21:08:04 fraggle
-	
+
 	Fix scrollbars so that clicks scroll the pane to a location that
 	matches the clicked location.  Interpret mousewheel events so that
 	scroll panes can be scrolled.
 
 2011-03-22 19:49:31 fraggle
-	
+
 	Reorganise the display settings window.
 
 2011-03-17 22:54:33 fraggle
-	
+
 	Add back -a option to automake, and remove INSTALL if automake
 	installs it.
 
 2011-03-17 22:43:56 fraggle
-	
+
 	Fix up placement of display settings window.
 
 2011-03-15 22:41:22 fraggle
-	
+
 	Fix NEWS entry to list the full name for Alexandre Xavier.
 
 2011-03-10 19:47:14 fraggle
-	
+
 	Include Unix manpages in MacOS package, and set MANPATH to point to
 	them when opening a terminal window.
 
 2011-03-10 19:45:29 fraggle
-	
+
 	Minor tweaks to MacOS instructions.
 
 2011-03-10 19:20:10 fraggle
-	
+
 	Minor tweak to INSTALL instructions.
 
 2011-03-10 19:03:23 fraggle
-	
+
 	Replace the INSTALL file with a template version that is customized to
 	different platforms.
 
 2011-03-09 19:02:15 fraggle
-	
+
 	Add null sector dereference emulation code from Prboom+, to fix desync
 	with CLNJ-506.LMP (thanks entryway).
 
 2011-03-09 01:06:07 fraggle
-	
+
 	Add support for the alternate version of the Final Doom executable
 	that fixes the demo loop crash (thanks Porsche Monty, Enjay).
 
 2011-03-06 20:59:51 fraggle
-	
+
 	Discard very short sound effects and strip lead-in / lead-out samples
 	that apparently aren't played by Vanilla Doom (thanks Quasar).
 
 2011-03-03 21:41:51 fraggle
-	
+
 	Fix Visual Studio build (thanks GhostlyDeath).
 
 2011-02-28 20:48:27 fraggle
-	
+
 	Fix autoadjust of pixel depth in setup tool.
 
 2011-02-05 16:50:28 fraggle
-	
+
 	Fix bug with libtextscreen where it was not possible to type a '+'
 	(thanks Alexandre Xavier).
 
 2011-01-31 01:25:47 fraggle
-	
+
 	When large numbers of screen resolutions are detected, increase the
 	number of columns in the mode list to fit them all on-screen.  Remove
 	superfluous left-side spacing from the checkbox and radio button
@@ -236,41 +388,41 @@
 	widgets so that the modes can be packed closer together.
 
 2011-01-23 21:42:09 fraggle
-	
+
 	Fix default joystick buttons in setup tool to match Vanilla (thanks
 	twipley).
 
 2011-01-13 20:34:55 fraggle
-	
+
 	In configuration files, use the scan code for right shift, not left
 	shift, to match Vanilla (thanks AlexXav).
 
 2011-01-12 23:22:20 fraggle
-	
+
 	Fix menu navigation when using joystick / joypad (thanks AlexXav).
 
 2011-01-02 18:14:59 fraggle
-	
+
 	Update NEWS and ChangeLog, bump version number.
 
 2011-01-02 17:45:24 fraggle
-	
+
 	Remove redundant package version label from top of OS X launcher
 	window.
 
 2011-01-02 02:49:20 fraggle
-	
+
 	Restore window title when changing video driver in setup tool (thanks
 	AlexXav).
 
 2011-01-02 02:31:20 fraggle
-	
+
 	Turn off dynamic window resizing feature on OS X, as it adds an ugly
 	resize handle to the corner of the window that overlaps the view of
 	the game.
 
 2010-12-28 16:43:41 fraggle
-	
+
 	Make demo loop handling of DEMO4 case depend on the executable version
 	being emulated: the Vanilla versions did not have any conditional
 	behavior based on gamemode/gamemission.  This has the side effect of
@@ -278,71 +430,71 @@
 	but this is Vanilla behavior.
 
 2010-12-25 22:42:40 fraggle
-	
+
 	Include NOT-BUGS in rpm packages.
 
 2010-12-25 21:51:24 fraggle
-	
+
 	Pass through all command line arguments specified to the setup tool to
 	the game, to match Vanilla behavior (thanks AlexXav).
 
 2010-12-25 21:04:10 fraggle
-	
+
 	Remove the -wart parameter (thanks Sander van Dijk).
 
 2010-12-25 20:55:30 fraggle
-	
+
 	Remove the 32 character limit on the lengths of filenames specified to
 	-record (thanks AlexXav).
 
 2010-12-19 20:15:09 fraggle
-	
+
 	Change setup tool skill level names to match Doom's "new game" menu
 	exactly (thanks AlexXav).
 
 2010-12-18 23:55:07 fraggle
-	
+
 	Add a M_CheckParmWithArgs function, that behaves like M_CheckParm but
 	also checks that extra options were provided on the command line
 	(thanks Sander van Dijk).
 
 2010-12-14 20:55:30 fraggle
-	
+
 	Check that an address is provided to the -query command line option
 	(thanks Sander van Dijk).
 
 2010-12-12 13:11:11 fraggle
-	
+
 	Add -privateserver and -servername options to chocolate-server
 	manpage.  Add server registration option to setup tool (thanks
 	exp(x)).
 
 2010-12-10 23:56:32 fraggle
-	
+
 	Fix memory leak when dynamically resizing window in true color video
 	modes.
 
 2010-12-10 22:37:29 fraggle
-	
+
 	Fix build problem (thanks Proteh).
 
 2010-12-10 22:21:56 fraggle
-	
+
 	Remove "Error:" from the message displayed by I_Error, to match
 	Vanilla.
 
 2010-12-10 20:53:23 fraggle
-	
+
 	Update NEWS.
 
 2010-12-10 20:43:05 fraggle
-	
+
 	Change alignment of actions in a window's action area so that there is
 	equal space either side of the center widget.  This is more
 	aesthetically pleasing.
 
 2010-12-10 20:31:46 fraggle
-	
+
 	Replace txt_widget_t#selectable with a callback function to query
 	whether the widget is selectable.  This stops the table code from
 	selecting things that aren't really selectable - eg.  empty tables,
@@ -350,122 +502,122 @@
 	the warp menu (thanks Proteh).
 
 2010-12-10 19:15:37 fraggle
-	
+
 	Add "warp" menu to the main menu of the setup tool, like Vanilla
 	setup.exe (thanks Proteh).
 
 2010-12-10 18:15:12 fraggle
-	
+
 	Fix typo (thanks Sander van Dijk).
 
 2010-12-10 17:53:50 fraggle
-	
+
 	Specify master server port explicitly, so that server registration
 	works when using -port.
 
 2010-12-07 23:13:34 rtc_marine
-	
+
 	- Update chocolate-server codeblocks project
 
 2010-12-07 22:35:17 fraggle
-	
+
 	Assign the oldest client to be the controller, not the first found in
 	the clients[] array.
 
 2010-12-06 23:37:27 fraggle
-	
+
 	Fix -solo-net to actually behave the same as other ports.
 
 2010-12-06 22:38:24 fraggle
-	
+
 	Rename -netdemo command line parameter to -solo-net, for consistency
 	with other ports (-netdemo is still recognised).
 
 2010-12-06 00:04:08 fraggle
-	
+
 	Update NEWS.
 
 2010-12-05 14:42:09 fraggle
-	
+
 	Allow textscreen font to be overridden using the TEXTSCREEN_FONT
 	command line variable.
 
 2010-12-04 20:56:04 fraggle
-	
+
 	Rename search command line options: -search to search the Internet,
 	-localsearch to search local LAN.
 
 2010-12-04 20:48:07 fraggle
-	
+
 	Add ping time to query output.
 
 2010-12-04 20:40:10 fraggle
-	
+
 	Fix formatting for -masterquery to match -search.
 
 2010-12-04 20:34:39 fraggle
-	
+
 	Fix bug when running with -server option.
 
 2010-12-02 21:34:51 fraggle
-	
+
 	Make multiple query attempts to servers before giving up.  Display a
 	warning if the master server does not respond.
 
 2010-12-02 20:32:52 fraggle
-	
+
 	Add -servername parameter to allow the owner to change the name
 	returned in response to queries (thanks AlexMax).
 
 2010-12-02 20:11:24 fraggle
-	
+
 	More refactoring of querying code, to not be specific to the purpose
 	of printing out a list.
 
 2010-12-02 19:26:05 fraggle
-	
+
 	Refactor query code and add a -masterquery command line parameter to
 	query the master server.
 
 2010-12-02 18:23:09 fraggle
-	
+
 	Register servers with Internet master server.
 
 2010-11-30 21:52:38 fraggle
-	
+
 	Oops.
 
 2010-11-30 20:44:20 fraggle
-	
+
 	Remove "-debugfile" command line option and associated variable.
 
 2010-11-30 20:26:37 fraggle
-	
+
 	Update NEWS.
 
 2010-11-30 20:09:22 rtc_marine
-	
+
 	- Update codeblocks project
 
 2010-11-30 20:00:06 fraggle
-	
+
 	Add support for HACX v1.2 IWAD file.
 
 2010-11-30 01:08:59 fraggle
-	
+
 	Add NOT-BUGS file with some common Vanilla gotchas.
 
 2010-11-29 20:18:10 fraggle
-	
+
 	Auto-adjust the screen color depth if the configured color depth is
 	not supported by the hardware.
 
 2010-11-27 23:23:12 fraggle
-	
+
 	Add dropdown list to setup tool to select screen BPP.
 
 2010-11-27 19:39:14 fraggle
-	
+
 	When generating the texture name lookup hash table, add new entries to
 	the end of chains.  This way, entries earlier in the texture list
 	trump later entries with the same name.  This fixes a bug with the
@@ -472,191 +624,191 @@
 	wrong sky being shown in Spooky01.wad (thanks Porsche Monty).
 
 2010-11-27 15:36:43 fraggle
-	
+
 	Fix -timer / -avg options to work like Vanilla when playing demos.
 
 2010-11-26 18:56:45 fraggle
-	
+
 	In non-palettized boxed screen modes, don't update the border areas of
 	the screen.  This is more CPU and memory efficient, and also fixes the
 	"flashing border" bug when palette flashes occur.
 
 2010-11-26 18:36:48 fraggle
-	
+
 	Turn double buffering on for non-palettized screen modes, as this may
 	be the cause of screen tearing reports.
 
 2010-11-24 23:34:18 fraggle
-	
+
 	Detect when running on Windows Vista or later, and switch to 32 bpp
 	screen mode.
 
 2010-11-24 22:43:37 fraggle
-	
+
 	Add configuration file parameter and command line option to specify
 	the screen pixel depth.
 
 2010-11-24 08:09:48 fraggle
-	
+
 	Add workaround to stop freezeups with old versions of SDL_mixer.
 
 2010-11-21 15:44:43 fraggle
-	
+
 	Add -8in32 command line parameter to make the game run in 32-bit color
 	mode, scaling up into an intermediate 8-bit buffer first.  This should
 	help with the palette problems experienced by Windows Vista/7 users.
 
 2010-11-09 16:10:52 fraggle
-	
+
 	Update Python scripts to work in Python 3.
 
 2010-09-19 21:09:36 fraggle
-	
+
 	Read response file in binary mode, to fix incomplete response file
 	bug.
 
 2010-08-31 21:00:20 fraggle
-	
+
 	Add weapon cycling buttons to joystick button list.
 
 2010-08-31 20:59:24 fraggle
-	
+
 	Don't double OPL sample values, as it causes horrible things to happen
 	with the Heretic title screen music.
 
 2010-08-28 19:35:08 fraggle
-	
+
 	Update NEWS.
 
 2010-08-28 19:28:05 fraggle
-	
+
 	Include INSTALL file in distribution packages.
 
 2010-08-22 18:59:12 fraggle
-	
+
 	Shut up compiler warning.
 
 2010-08-22 02:21:27 fraggle
-	
+
 	Change span drawing functions to work the same as Vanilla, so that in
 	screenshots, floors and ceilings are pixel-perfect identical to
 	Vanilla Doom (thanks Porsche Monty).
 
 2010-08-21 19:49:20 fraggle
-	
+
 	Change default mouse acceleration in setup tool to match the game's
 	default.
 
 2010-08-21 18:47:24 fraggle
-	
+
 	"Bug fix".
 
 2010-08-20 14:01:29 fraggle
-	
+
 	Remove debug printf().
 
 2010-08-20 13:20:58 fraggle
-	
+
 	Align memory allocated by zone memory system to 8 byte boundaries on
 	64-bit machines.  Possibly fixes problems on sparc64?
 
 2010-08-20 12:30:30 fraggle
-	
+
 	Extend mouse code to support up to 8 buttons (allows mouse wheel to be
 	used).
 
 2010-08-15 16:23:28 fraggle
-	
+
 	Fix volume multiply; DBOPL now generating output.
 
 2010-08-15 15:57:37 fraggle
-	
+
 	Hook DBOPL into OPL library and remove FMOPL.  Does not generate any
 	sound yet.
 
 2010-08-13 19:42:52 fraggle
-	
+
 	Add C-converted version of DOSbox OPL emulator.
 
 2010-08-09 18:53:10 fraggle
-	
+
 	Add weapon cycling bindings for mouse and joystick buttons.  Add
 	weapon cycling bindings to configuration file and setup tool.
 
 2010-08-07 18:23:09 fraggle
-	
+
 	Change back filter frequency.  Add debug code to dump resampled sound
 	effects to WAV files.
 
 2010-08-07 17:07:00 fraggle
-	
+
 	Fix sound resampling low pass filter.
 
 2010-08-04 19:25:04 fraggle
-	
+
 	Initial code for previous/next weapon switching keys.
 
 2010-08-03 21:12:36 fraggle
-	
+
 	When in windowed mode, allow the screen size to be dynamically resized
 	by dragging the window borders.
 
 2010-07-31 20:25:17 fraggle
-	
+
 	Add multiplayer spy key binding.
 
 2010-07-28 21:39:07 fraggle
-	
+
 	Add config file parameter to set OPL I/O port.
 
 2010-07-17 01:33:57 fraggle
-	
+
 	Check for libm, to fix Fedora compile issues.
 
 2010-07-14 21:36:53 fraggle
-	
+
 	Set MACOSX_DEPLOYMENT_TARGET to target 10.4, so that the launcher will
 	work on older versions.
 
 2010-07-10 17:06:15 fraggle
-	
+
 	Update NEWS and ChangeLog, bump version number.
 
 2010-07-10 16:56:18 fraggle
-	
+
 	Add key bindings for multiplayer messaging.
 
 2010-07-10 16:27:52 fraggle
-	
+
 	Add key binding to change demo recording quit key.
 
 2010-05-30 04:03:44 fraggle
-	
+
 	Add INSTALL to all distribution packages, add note in README.
 
 2010-05-30 03:56:58 fraggle
-	
+
 	Clarify/update install instructions.
 
 2010-05-14 19:42:32 fraggle
-	
+
 	Don't grab the mouse when the demo sequence advances.
 
 2010-05-03 17:47:25 fraggle
-	
+
 	Oops.
 
 2010-05-03 16:58:52 fraggle
-	
+
 	Update NEWS.
 
 2010-05-01 22:47:26 fraggle
-	
+
 	Further sanity checking on use of strcpy() with dehacked string
 	replacements.
 
 2010-05-01 22:20:30 fraggle
-	
+
 	Silence printf(DEH_String(...)) warnings, by providing a DEH_printf
 	function that checks the format string is a valid replacement.  Also
 	add DEH_fprintf and DEH_snprintf functions to use throughout the code
@@ -663,42 +815,42 @@
 	to do similar checking.
 
 2010-05-01 20:22:52 fraggle
-	
+
 	Fix compiler warnings with savegame and response file code.
 
 2010-04-30 20:58:30 fraggle
-	
+
 	Merge contents of OPL-TODO into TODO file.
 
 2010-04-30 20:38:24 fraggle
-	
+
 	Add textscreen Doxyfile to dist.  Add .desktop file to svn:ignore.  Add
 	opl ctags file to localvimrc.
 
 2010-04-25 00:53:03 fraggle
-	
+
 	Add -reject_pad_with_ff parameter to allow padding value to be
 	specified.
 
 2010-04-23 21:46:29 fraggle
-	
+
 	Add REJECT buffer overflow emulation, based on code from PrBoom+
 	(thanks entryway).  Fixes YDFEAR25.LMP.
 
 2010-04-22 22:38:51 fraggle
-	
+
 	Disable OPL debugging messages.
 
 2010-03-08 18:52:59 fraggle
-	
+
 	Add OPL-TODO to dist, set svn:ignore properties.
 
 2010-03-08 18:50:29 fraggle
-	
+
 	Use native MIDI music by default.
 
 2010-03-08 01:14:23 fraggle
-	
+
 	Merge opl-branch to trunk.
 	
 	OPL support still isn't perfect, and it certainly isn't complete.
@@ -705,34 +857,34 @@
 	However, for now, it's good enough.
 
 2010-02-10 20:21:21 fraggle
-	
+
 	Bump version number, update ChangeLog and NEWS.
 
 2010-01-31 18:21:50 fraggle
-	
+
 	Change Windows resource file to use PACKAGE_COPYRIGHT and
 	PACKAGE_LICENSE macros.
 
 2010-01-30 16:14:04 fraggle
-	
+
 	Change directory to home directory before launching the game, so that
 	recorded demos go somewhere sensible.
 
 2010-01-30 16:04:24 fraggle
-	
+
 	Set launch button as default button, so that it is possible to launch
 	the game by pressing return.
 
 2010-01-30 00:37:17 fraggle
-	
+
 	Rename mus2mid functions to be consistent with coding standard.
 
 2010-01-29 23:28:35 fraggle
-	
+
 	Remove unused PACKAGE_LONGDESC.
 
 2010-01-29 19:17:56 fraggle
-	
+
 	When doing a MUS to MID conversion, allocate MIDI channels so that the
 	lowest-numbered MIDI channels are used before higher-numbered ones.
 	Fixes ear-piercing whistle sound in the MAP05 music when playing with
@@ -739,82 +891,82 @@
 	timidity and EAWPATS (thanks entryway / HackNeyed).
 
 2010-01-29 03:55:20 fraggle
-	
+
 	Fix indentation/style etc.  in mus2mid.c.
 
 2010-01-27 19:16:26 fraggle
-	
+
 	Add tags files to svn:ignore properties.
 
 2010-01-26 19:21:18 fraggle
-	
+
 	Minor fix of British spelling -> American.
 
 2010-01-26 19:18:18 fraggle
-	
+
 	Fix glass hack windows where a linedef is flagged as two sided but has
 	only one side.  Fixes WADs such as OTTAWAU.WAD (thanks Never_Again).
 
 2010-01-23 23:06:45 fraggle
-	
+
 	Add menu item to launcher to open a terminal window that can be used
 	to start the game.  Add missing 'edit' menu.  Set svn:ignore property
 	for osx directory.
 
 2010-01-18 19:40:50 fraggle
-	
+
 	Fix package source URL.
 
 2010-01-18 19:29:48 fraggle
-	
+
 	Tweak package description slightly.
 
 2010-01-18 19:14:54 fraggle
-	
+
 	Define project short description, copyright, maintainer and URL in
 	configure.in.  Use these for the Info-gnustep.plist file.  Add
 	generated .spec file for building RPM packages.
 
 2010-01-17 16:58:37 fraggle
-	
+
 	Update NEWS.
 
 2010-01-17 16:31:03 fraggle
-	
+
 	Restore the original cursor when shutting down video code, this should
 	hopefully fix the problem with the mouse cursor disappearing when
 	exiting on Win9x (thanks Janizdreg).
 
 2010-01-16 19:20:11 fraggle
-	
+
 	Update TODO file.
 
 2010-01-15 19:29:28 fraggle
-	
+
 	Don't open the configuration window when the launcher is first run;
 	display an error message if the user tries to launch the game without
 	an IWAD selected.
 
 2010-01-15 19:14:02 fraggle
-	
+
 	Fix GNUstep info panel.
 
 2010-01-15 18:51:35 fraggle
-	
+
 	Center the launcher window and config window on startup.
 
 2010-01-15 18:40:37 fraggle
-	
+
 	Add wadfile.png for GNUstep build.
 
 2010-01-15 18:13:05 fraggle
-	
+
 	Extend osx makefile to allow building of a working GNUstep
 	application, for testing purposes.  Add GNUstep version of Info.plist,
 	remove app-skeleton directory and move contents up.
 
 2010-01-14 18:47:03 fraggle
-	
+
 	In Chex Quest, use the radiation suit colormap instead of the red
 	colormaps that are usually used when taking damage (or using the
 	berserk pack).  This matches the Vanilla chex.exe behavior (thanks
@@ -821,60 +973,60 @@
 	Fuzztooth).
 
 2010-01-12 20:16:25 fraggle
-	
+
 	Oops.
 
 2010-01-12 20:15:34 fraggle
-	
+
 	Strip executables when building Windows CE packages.
 
 2010-01-12 20:14:11 fraggle
-	
+
 	Rearrange order of Makefile generation to alphabetical order.
 
 2010-01-12 20:12:56 fraggle
-	
+
 	Move Makefile definitions for CC and STRIP into config.make, use
 	versions from autoconf.
 
 2010-01-12 20:09:54 fraggle
-	
+
 	Set main menu title based on package name, not fixed string.
 
 2010-01-12 20:09:01 fraggle
-	
+
 	Place commercial level name strings consecutively in the same array,
 	so that overflowing the end of one list accesses the start of the
 	next.  This trick is used by pl2.wad for its MAP33 secret level.
 
 2010-01-12 01:32:24 fraggle
-	
+
 	Add missing connection for plutonia.wad set button.
 
 2010-01-12 01:20:48 fraggle
-	
+
 	Add document icon file and use for file associations.
 
 2010-01-11 19:10:42 fraggle
-	
+
 	Insert new files into the command line at the correct location,
 	allowing multiple files to be opened at once.
 
 2010-01-11 01:35:04 fraggle
-	
+
 	When launching a file from the finder, add the new file into the
 	command line at the appropriate position in the command line string.
 
 2010-01-10 20:46:15 fraggle
-	
+
 	Change "@executable_path@" to "@executable_path"
 
 2010-01-10 18:48:21 fraggle
-	
+
 	Install docs with a single cp, rather than using a for loop.
 
 2010-01-10 18:42:35 fraggle
-	
+
 	Recursively copy library dependencies into destination package.
 	Identify libraries to be installed based on the path in which they are
 	located, rather than whether there is "libSDL" in the name.  Use
@@ -883,30 +1035,30 @@
 	machine upon which the program was built.
 
 2010-01-09 21:06:31 fraggle
-	
+
 	Clear existing arguments when adding a file.
 
 2010-01-09 20:42:30 fraggle
-	
+
 	Add file to command line when opened; add link from AppController to
 	LauncherManager.
 
 2010-01-09 18:54:04 fraggle
-	
+
 	Initial code to identify file type by extension and add file to
 	command line.
 
 2010-01-09 18:38:48 fraggle
-	
+
 	Hook in AppController as delegate for application, add file
 	associations to property list file.
 
 2010-01-05 17:20:58 fraggle
-	
+
 	Add "clean" target to package makefiles.
 
 2010-01-05 15:52:12 fraggle
-	
+
 	Move config.make up to pkg/ directory.  Use static makefiles to
 	generate all packages, rather than dynamically generated makefiles.
 	Add pkg/osx to dist.  Make OS X staging directory depend on top level
@@ -914,36 +1066,36 @@
 	is not already present.  Set svn:ignore properties.
 
 2010-01-04 22:53:44 fraggle
-	
+
 	Fix single space error when listing libraries.
 
 2010-01-04 22:45:45 fraggle
-	
+
 	Copy binaries into app dir along with libraries.
 
 2010-01-04 22:24:48 fraggle
-	
+
 	Include documentation files in package.
 
 2010-01-04 22:19:53 fraggle
-	
+
 	Fix GNUstep build.
 
 2010-01-04 22:11:11 fraggle
-	
+
 	Generate Info.plist and config.make in configure and remove temporary
 	versions.  Include config.h from top level.
 
 2010-01-04 22:01:32 fraggle
-	
+
 	Import OS X launcher code to trunk.
 
 2010-01-03 03:49:11 fraggle
-	
+
 	Add quotes around $@ in autogen script (thanks exp[x])
 
 2009-12-28 20:57:20 fraggle
-	
+
 	When recording low resolution (non-longtics) Vanilla demos, carry
 	forward the error from angleturn caused by the reduced resolution, so
 	that consecutive errors can accumulate, possibly making turning
@@ -950,16 +1102,16 @@
 	slightly smoother.
 
 2009-12-27 01:42:13 fraggle
-	
+
 	Oops.
 
 2009-12-27 00:11:18 fraggle
-	
+
 	Allow DOOMWADDIR/DOOMWADPATH to contain the complete path to IWAD
 	files, as well as directories in which to search for IWAD files.
 
 2009-12-18 22:11:06 fraggle
-	
+
 	Fix poor quality application icons seen when the game is running.  Add
 	back 8-bit icon files alongside files including both 8-bit and high
 	quality 32-bit versions.  Use the high quality icon files for resource
@@ -966,166 +1118,166 @@
 	files includes, and the low quality ones for in-game SDL.
 
 2009-12-18 21:11:32 fraggle
-	
+
 	Update generated source files containing icon data.
 
 2009-12-18 21:10:35 fraggle
-	
+
 	Make ExecuteCommand() under Unix return a failure when the executable
 	cannot be executed.
 
 2009-12-14 20:57:04 fraggle
-	
+
 	Use GetModuleFileNameW to get the (Unicode) path to the Doom
 	executable.  This hopefully fixes problems with Unicode directory
 	names.
 
 2009-12-14 18:54:25 fraggle
-	
+
 	Add Chocolate Doom/setup icons with scaled versions for various
 	different icon sizes (thanks MikeRS).
 
 2009-12-12 01:20:49 fraggle
-	
+
 	Fix textscreen black border bug.
 
 2009-12-09 02:40:39 fraggle
-	
+
 	Fix the setup tool on Windows Vista/7 to not prompt for elevated
 	permissions and to disable the "Program Compatibility Assistant"
 	(thanks hobbs and MikeRS).
 
 2009-11-29 22:50:17 fraggle
-	
+
 	Add other missing files to dist.
 
 2009-11-29 22:25:51 fraggle
-	
+
 	Include .lvimrc in dist.
 
 2009-11-21 03:56:59 fraggle
-	
+
 	Add Makefile to build Win32 packages.
 
 2009-11-21 02:05:56 fraggle
-	
+
 	Use execvp() rather than execv(), to look up Doom binary in the PATH
 	if necessary.
 
 2009-11-21 00:40:58 fraggle
-	
+
 	Apply configuration file invalid key setting fix to setup code.
 
 2009-11-21 00:38:16 fraggle
-	
+
 	Don't crash if key settings are set in a configuration file that are
 	out of range (thanks entryway).
 
 2009-11-21 00:24:59 fraggle
-	
+
 	Fix crash with chocolate-setup under Windows (thanks Janizdreg).
 
 2009-11-19 21:49:13 fraggle
-	
+
 	Rework the OS X MIDI disabling code, as SDL_mixer 1.2.11 fixes the
 	crash.  Check and disable MIDI by default if using an older version of
 	SDL on OS X.
 
 2009-11-19 21:07:31 fraggle
-	
+
 	Make chocolate-setup use its own location in the filesystem to find
 	the location of the chocolate-doom executable.  Remove INSTALL_DIR
 	define.
 
 2009-11-05 19:57:55 fraggle
-	
+
 	Perform bounds checking on values passed to TXT_UpdateScreenArea() to
 	avoid crashes.
 
 2009-10-26 19:28:12 fraggle
-	
+
 	Initial hacks for compiling under SDL 1.3.
 
 2009-10-17 21:13:54 fraggle
-	
+
 	Fix error in last change.
 
 2009-10-17 20:39:37 fraggle
-	
+
 	Use M_StrToInt() when processing values passed with -spechit, so that
 	hex values can be specified.
 
 2009-10-17 20:29:46 fraggle
-	
+
 	Import donut overrun emulation code from PrBoom+ (Thanks entryway).
 
 2009-10-16 19:10:30 fraggle
-	
+
 	Fix compilation under MSVC (thanks entryway).
 
 2009-10-10 23:58:25 fraggle
-	
+
 	Rename pkg/wince/Makefile to pkg/wince/GNUmakefile (it uses GNU
 	extensions).
 
 2009-10-10 22:46:14 fraggle
-	
+
 	Add pkg directory to make dist.
 
 2009-10-10 02:02:58 fraggle
-	
+
 	Don't crash when using the donut special type and the joining linedef
 	is one sided (thanks Alexander Waldmann).
 
 2009-10-05 21:25:53 fraggle
-	
+
 	Fix desync in ep1-0500.lmp on 64-bit (thanks exp(x)).
 
 2009-10-05 00:38:14 fraggle
-	
+
 	Provide pointer to STARTUPINFO structure when calling CreateProcessW,
 	to stop crash under normal Windows (not CE) when launching Doom from
 	the setup tools (thanks Janizdreg).
 
 2009-10-01 20:08:21 fraggle
-	
+
 	Oops.
 
 2009-10-01 02:04:00 fraggle
-	
+
 	Oops.
 
 2009-10-01 00:07:03 fraggle
-	
+
 	Change British English spellings to American English, for consistency.
 
 2009-09-20 16:27:40 fraggle
-	
+
 	Use "const char" in libtextscreen where appropriate (thanks entryway).
 
 2009-09-11 22:56:47 fraggle
-	
+
 	Add (lack of) copyright notice for SDL workaround.
 
 2009-09-07 20:43:04 fraggle
-	
+
 	Fix compilation under MacOS X.
 
 2009-09-06 19:15:52 fraggle
-	
+
 	Fixes for MSVC compile (thanks entryway).
 
 2009-08-28 00:27:47 fraggle
-	
+
 	Allow PGUP/PGDN to scroll up and down in scroll panes (thanks
 	LionsPhil).
 
 2009-07-20 23:27:59 fraggle
-	
+
 	Remove redundant variable assignment (thanks Quasar/Yagisan)
 
 2009-07-20 01:37:41 fraggle
-	
+
 	Save and display the loading disk icon as a fixed 16x16 square, from
 	an image drawn at the bottom right corner of the screen.  This seems
 	to be the same as how Vanilla behaves, and fixes chook3.wad, that uses
@@ -1133,877 +1285,877 @@
 	left.
 
 2009-07-13 23:43:06 fraggle
-	
+
 	Add stdio.h include to fix MSVC build (thanks Kaiser)
 
 2009-07-12 17:47:12 fraggle
-	
+
 	Fix compile with libsamplerate.
 
 2009-07-12 15:00:50 fraggle
-	
+
 	On Windows CE, use the Windows API to find the amount of available
 	memory, so that at least two megabytes are always left available to
 	the OS.
 
 2009-07-11 12:15:32 fraggle
-	
+
 	Add missing item to NEWS.
 
 2009-07-07 20:46:55 fraggle
-	
+
 	Update NEWS.
 
 2009-07-07 20:38:00 fraggle
-	
+
 	Fix launching of the game from the setup tool in Windows CE.
 
 2009-06-21 20:33:35 fraggle
-	
+
 	Add Makefile for building CAB files, dependency calculation.
 
 2009-06-21 20:19:43 fraggle
-	
+
 	Use correct filename for SDL_net DLL.
 
 2009-06-21 20:03:38 fraggle
-	
+
 	Remove temporary files after generating CAB file.
 
 2009-06-20 23:13:44 fraggle
-	
+
 	Add script to generate Windows CE install package.
 
 2009-06-16 20:47:13 fraggle
-	
+
 	Automatically allocate a smaller zone size if it was not possible to
 	allocate the default 16 MiB.
 
 2009-06-13 18:10:18 fraggle
-	
+
 	Don't post zero key events.
 
 2009-06-12 20:07:55 fraggle
-	
+
 	On Windows CE systems without a keyboard, patch the default settings
 	to use hardware keys.
 
 2009-06-12 18:58:42 fraggle
-	
+
 	Remove debug messages.
 
 2009-06-12 18:35:39 fraggle
-	
+
 	Set the USER environment variable based on the owner information from
 	the registry.
 
 2009-06-12 18:34:27 fraggle
-	
+
 	Always grab input on Windows CE.
 
 2009-06-11 22:34:36 fraggle
-	
+
 	Include libc_wince.a in chocolate-server build.
 
 2009-06-11 20:41:20 fraggle
-	
+
 	Grab the input in setup when reading a new key binding, so that
 	Windows CE buttons are read properly.  Map buttons to PC function
 	keys.
 
 2009-06-11 19:19:05 fraggle
-	
+
 	Include libc_wince.h on Windows CE.
 
 2009-06-11 19:18:12 fraggle
-	
+
 	Declare getenv/putenv on Windows CE for recent SDL versions that do
 	not declare it.
 
 2009-06-10 20:03:08 fraggle
-	
+
 	Add key bindings for pause, message refresh.
 
 2009-06-08 20:26:29 fraggle
-	
+
 	Remove debugging code.
 
 2009-06-08 19:15:57 fraggle
-	
+
 	Use SDL's getenv/putenv implementation, and populate at startup.
 
 2009-06-08 00:41:10 fraggle
-	
+
 	Use CreateFileW instead of OpenFile (doesn't exist on Windows CE)
 
 2009-06-07 20:08:08 fraggle
-	
+
 	Fix header includes (thanks exp[x])
 
 2009-06-07 19:18:02 fraggle
-	
+
 	Don't add DirectX/Windib selector on Windows CE.
 
 2009-06-07 18:53:25 fraggle
-	
+
 	Use home dir to store configuration and savegames under Windows CE.
 
 2009-06-07 18:33:19 fraggle
-	
+
 	Fix setup tool display configuration dialog when fullscreen is not
 	supported.
 
 2009-06-07 18:10:05 fraggle
-	
+
 	Make auto-adjust code switch to windowed mode if no fullscreen modes
 	are available.
 
 2009-06-07 17:41:46 fraggle
-	
+
 	Catch errors when initialising SDL.  Use the small textscreen font by
 	default on Windows CE if no fullscreen modes are available.
 
 2009-06-07 17:39:08 fraggle
-	
+
 	Add missing SDL_thread include.
 
 2009-06-07 17:35:43 fraggle
-	
+
 	Don't try to use the SDL DirectX driver under Windows CE.
 
 2009-06-07 16:21:41 fraggle
-	
+
 	Fix setup tool compile on Windows CE.
 
 2009-06-07 16:15:40 fraggle
-	
+
 	Remove call to setbuf.
 
 2009-06-07 15:35:27 fraggle
-	
+
 	Add IWAD search dirs for Windows CE.
 
 2009-06-07 15:20:46 fraggle
-	
+
 	Exit with an error on failure to allocate zone memory.
 
 2009-06-07 03:10:21 fraggle
-	
+
 	Use MessageBoxW instead of MessageBox (doesn't exist on Windows CE)
 
 2009-06-07 02:59:49 fraggle
-	
+
 	Add README file for Windows CE library.
 
 2009-06-07 02:56:21 fraggle
-	
+
 	Detect Windows CE target and build/include libc_wince files as
 	necessary.
 
 2009-06-07 02:50:47 rtc_marine
-	
+
 	- Update textscreen codeblocks project to include txt_scrollpane.* and
 	txt_smallfont.h
 
 2009-06-07 02:33:58 fraggle
-	
+
 	Include libc_wince.h when on Windows CE.
 
 2009-06-07 02:32:15 fraggle
-	
+
 	Add CPU affinity function for Windows CE.
 
 2009-06-07 02:27:58 fraggle
-	
+
 	Add libc_wince.h header, and EISDIR error value.
 
 2009-06-07 02:27:30 fraggle
-	
+
 	Use GetUserNameExW, not GetUserName (doesn't exist on WinCE)
 
 2009-06-07 02:26:45 fraggle
-	
+
 	Fix compile with FEATURE_MULTIPLAYER disabled.
 
 2009-06-07 02:24:40 fraggle
-	
+
 	Fix compile with FEATURE_SOUND disabled.
 
 2009-06-07 01:56:23 fraggle
-	
+
 	Add Windows CE implementations of some ANSI C functions that are
 	missing.
 
 2009-06-06 22:13:44 fraggle
-	
+
 	Don't check for Steam/CD installer versions on Windows CE.
 
 2009-06-05 17:58:48 fraggle
-	
+
 	Add key binding variables for automap and weapon keys.
 
 2009-06-04 00:37:02 fraggle
-	
+
 	Increase height of menu bindings dialog.
 
 2009-06-04 00:35:05 fraggle
-	
+
 	Use newer keyboard bindings dialog layout from raven-branch.
 
 2009-06-04 00:20:37 fraggle
-	
+
 	Add unique key groups for menu navigation and shortcuts.
 
 2009-06-04 00:20:06 fraggle
-	
+
 	Use key for confirming menu messages, not typed char.
 
 2009-06-03 21:45:54 fraggle
-	
+
 	Add dialog to setup tool for editing menu shortcuts.
 
 2009-06-03 21:18:04 fraggle
-	
+
 	Add config file variables to increase/decrease screen size.
 
 2009-06-03 20:59:26 fraggle
-	
+
 	Fix shortcut keys for menu items.
 
 2009-06-03 20:55:50 fraggle
-	
+
 	Add configuration file entries for menu key bindings.
 
 2009-06-03 20:37:19 fraggle
-	
+
 	Add key_ variables for the keys used to control the menu.
 
 2009-05-26 23:14:24 fraggle
-	
+
 	Fix tags for functions using TXT_UNCAST_ARG.
 
 2009-05-26 22:13:18 fraggle
-	
+
 	Set appropriate vim 'tags' variable for ctags files.
 
 2009-05-21 20:18:38 fraggle
-	
+
 	Set display settings window position based on screen dimensions,
 	rather than hard coding position.
 
 2009-05-19 18:07:49 fraggle
-	
+
 	Fix manpage documentation for DOOMWADPATH (thanks MikeRS)
 
 2009-05-18 19:30:49 fraggle
-	
+
 	Fix A_BossDeath behavior in v1.9 emulation mode (thanks entryway)
 
 2009-05-17 14:54:19 fraggle
-	
+
 	Always use an SDL buffer size that is a power of two.  Reduce buffer
 	size to 70ms.
 
 2009-05-12 19:03:20 fraggle
-	
+
 	Add option to "join game" dialog in setup tool to autojoin a LAN game.
 
 2009-05-12 19:01:27 fraggle
-	
+
 	Make txt_inputboxes emit a "changed" signal when their value is
 	changed.
 
 2009-05-07 22:59:38 fraggle
-	
+
 	Calculate SDL buffer size automatically based on sample rate.
 
 2009-05-05 01:00:53 fraggle
-	
+
 	Better ASCII chart.
 
 2009-05-05 00:46:27 fraggle
-	
+
 	Minor smallfont fixups.
 
 2009-05-01 22:05:57 fraggle
-	
+
 	Add copyright headers to textscreen examples.
 
 2009-04-26 17:59:08 fraggle
-	
+
 	More smallfont fixups.
 
 2009-04-23 20:58:11 fraggle
-	
+
 	Fix up some extended ASCII characters.
 
 2009-04-23 19:19:52 fraggle
-	
+
 	Oops.
 
 2009-04-23 19:18:43 fraggle
-	
+
 	Add small textscreen font for low resolution displays, based on the
 	Atari-Small font by Tom Fine.
 
 2009-03-15 14:44:23 fraggle
-	
+
 	Fix clipped sounds when using libsamplerate (thanks David Flater)
 
 2009-03-14 15:28:41 fraggle
-	
+
 	Add check to allow sched_setaffinity code to work on older versions of
 	libc.
 
 2009-03-12 18:55:27 fraggle
-	
+
 	Define INVALID_SET_FILE_POINTER if it is not defined, to fix
 	compilation under MSVC6 (thanks Quasar)
 
 2009-03-08 22:51:25 fraggle
-	
+
 	Add "make doc" target to run Doxygen, and add a Doxyfile.  Add @file
 	tags to start of header files so that Doxygen will process them.
 
 2009-03-07 00:35:08 fraggle
-	
+
 	Add documentation for high-level txt_desktop.h functions.
 
 2009-03-07 00:24:45 fraggle
-	
+
 	Add documentation for high-level textscreen functions.
 
 2009-03-06 20:01:32 fraggle
-	
+
 	Fix signed/unsigned conversion warning.
 
 2009-03-03 19:26:20 fraggle
-	
+
 	Look up SetProcessAffinityMask function at runtime, so that the
 	program should work under Win9x again.
 
 2009-01-30 23:53:47 fraggle
-	
+
 	Fix layout of widgets within scroll panes.  Scroll scroll panes in
 	response to keyboard events.
 
 2009-01-29 23:26:03 fraggle
-	
+
 	Shrink text box slightly.
 
 2009-01-29 23:00:14 fraggle
-	
+
 	Allow clicking within scroll bars to set position.
 
 2009-01-29 22:54:13 fraggle
-	
+
 	Add scrollable pane widget to textscreen library.
 
 2009-01-17 14:05:31 fraggle
-	
+
 	Fix '-mmap' command line parameter.
 
 2009-01-07 22:05:13 fraggle
-	
+
 	Create the ~/.chocolate-doom/savegames directory on startup if it does
 	not exist.
 
 2009-01-07 21:51:37 fraggle
-	
+
 	Replace -nommap with -mmap; do not use mmap()ed file access by
 	default.  Fixes Plutonia 2, and several other minor things.
 
 2008-12-10 20:25:05 fraggle
-	
+
 	Bump version to 1.2.1, update NEWS and ChangeLog.
 
 2008-12-10 20:20:10 fraggle
-	
+
 	Fix crash when playing Doom 1 levels.
 
 2008-12-10 01:06:08 fraggle
-	
+
 	Bump version to 1.2.0, update NEWS and ChangeLog.
 
 2008-12-10 01:01:19 fraggle
-	
+
 	Undo previous change.
 
 2008-12-10 00:42:49 fraggle
-	
+
 	Set icon before calling TXT_Init, for setup and ENDOOM screens.
 
 2008-12-10 00:00:55 fraggle
-	
+
 	Fix window icon/title under Windows XP Luna theme.
 
 2008-12-09 23:32:19 fraggle
-	
+
 	Make intermission screen work on MAP33, to be consistent with Vanilla
 	Doom.  Also, make levels after MAP33 trigger a V_DrawPatch error.
 
 2008-12-09 20:35:17 fraggle
-	
+
 	Add check for sched_setaffinity to configure and only use it if it is
 	found.  Display a message if we don't have any way to set processor
 	affinity.
 
 2008-12-09 19:56:43 fraggle
-	
+
 	Add SDL_CFLAGS, SDL_LDFLAGS to default compile flags, and check for
 	SDL in configure before checking for libraries and headers, to fix
 	Windows.
 
 2008-12-03 22:09:22 fraggle
-	
+
 	Use FILE_MAP_COPY instead of FILE_MAP_ALL_ACCESS for mapping files
 	(thanks to Christian Chech).
 
 2008-12-01 21:08:23 fraggle
-	
+
 	Don't try to read SDL events until initialised.
 
 2008-10-01 21:22:09 fraggle
-	
+
 	Add .lvimrc local vim project settings.
 
 2008-09-21 19:20:32 fraggle
-	
+
 	Don't play DEMO4 if gameversion is emulating chex.exe - it only plays
 	demos 1-3.
 
 2008-09-20 19:18:06 fraggle
-	
+
 	Set processor affinity under non-Windows platforms using the POSIX
 	API.
 
 2008-09-16 01:17:20 rtc_marine
-	
+
 	- Force use of dwarf-2 debugging information - Fix an age-old problem
 	of not being able to find -lpcsound, the debug target was looking for
 	it rather than -lpcsound-dbg
 
 2008-09-14 19:14:46 fraggle
-	
+
 	Add -nocheat command line parameter to disable applying cheats from
 	dehacked files.
 
 2008-09-07 18:47:08 fraggle
-	
+
 	Strip out NUL characters from dehacked files; this makes the dehacked
 	patch with portal.wad load properly.
 
 2008-08-29 00:31:53 fraggle
-	
+
 	Update TODO.
 
 2008-08-24 03:06:26 fraggle
-	
+
 	Update INSTALL to include some notes about Chex Quest.
 
 2008-08-24 02:58:57 fraggle
-	
+
 	Update missing chex.deh to reference its location in the idgames
 	repository.
 
 2008-08-20 19:27:56 fraggle
-	
+
 	Use / as a path separator, to allow cross-compiling of resource files
 	(thanks Anonymous bug reporter)
 
 2008-08-19 20:51:41 fraggle
-	
+
 	Fix crash related to A_BFGSpray with NULL target when using dehacked
 	patches - discovered with insaned2.deh (thanks CSonicGo)
 
 2008-08-09 18:09:23 fraggle
-	
+
 	Don't modify level lumps when loading levels.
 
 2008-08-08 23:38:25 fraggle
-	
+
 	Use FILE_MAP_ALL_ACCESS rather than FILE_MAP_READ when mmapping files
 	under Windows (thanks entryway)
 
 2008-08-02 14:29:37 fraggle
-	
+
 	Search for chex.deh in WAD path.
 
 2008-07-31 23:01:38 fraggle
-	
+
 	Update netcode to allow chex quest gameversion.
 
 2008-07-31 22:29:20 fraggle
-	
+
 	Update Chocolate Setup to support chex.wad.
 
 2008-07-31 21:21:58 fraggle
-	
+
 	Fix crash on Chex Quest intermission screen (thanks entryway)
 
 2008-07-31 21:06:42 fraggle
-	
+
 	Automatically load chex.deh on startup if playing in chex mode.
 
 2008-07-31 20:43:45 fraggle
-	
+
 	Fix mistake in exit confirmation string that was breaking dehacked
 	patches that replace it.
 
 2008-07-31 12:55:35 rtc_marine
-	
+
 	Update codeblocks project to locate setup manifest
 
 2008-07-29 19:06:04 fraggle
-	
+
 	Don't do the Final Doom teleport quirk with Chex Quest, as chex.exe
 	doesn't do it.
 
 2008-07-29 19:05:16 fraggle
-	
+
 	Monsters don't drop ammo in Chex Quest.
 
 2008-07-29 01:50:56 fraggle
-	
+
 	Add magic dehacked comment to enable long cheat sequences (also for
 	Chex Quest support)
 
 2008-07-27 00:51:25 fraggle
-	
+
 	In chex mode, always warp to an episode 1 level, and display the level
 	title in the automap for the equivalent episode 1 level.
 
 2008-07-26 16:45:52 fraggle
-	
+
 	Allow magic comments in dehacked files that disable the DOS dehacked
 	text replacement limit, so that we can use a dehacked patch to emulate
 	chex.exe.
 
 2008-07-26 16:29:08 fraggle
-	
+
 	Chex Quest's chex.exe is based on the Final Doom exe, not the Ultimate
 	Doom exe.
 
 2008-07-26 16:23:06 fraggle
-	
+
 	Fix "dimensional shambler waiting at the dos prompt" quit message to
 	match the one in doom2.exe precisely.
 
 2008-07-25 20:56:39 fraggle
-	
+
 	Initial chex.exe emulation.
 
 2008-07-10 00:22:34 fraggle
-	
+
 	Fix dehacked replacements for the "press y to quit to dos" string.
 
 2008-07-07 10:10:26 fraggle
-	
+
 	Fix quit screen confirm message to say "quit to dos" rather than just
 	"quit" (thanks MikeRS)
 
 2008-06-14 18:42:06 fraggle
-	
+
 	Add a helpful message for people trying to play with the wrong IWAD.
 
 2008-06-11 01:14:07 fraggle
-	
+
 	Only apply dehacked green armor class to the green armor shirt, not
 	the armor helmets as well.
 
 2008-06-09 19:11:24 fraggle
-	
+
 	Always set armor class to 2 when picking up a megasphere (thanks
 	entryway).
 
 2008-05-05 04:52:08 GhostlyDeath
-	
+
 	Updated Code::Blocks project for new files
 
 2008-05-05 04:48:45 fraggle
-	
+
 	Add setup-manifest.xml to dist.
 
 2008-05-05 04:44:28 GhostlyDeath
-	
+
 	Updated VC++ Project for added files; Manifest should have version
 	1.1.1.0 not 1.0.0.0; the rc files in the codeblocks folder have been
 	updated
 
 2008-05-05 04:11:29 fraggle
-	
+
 	(Hopefully) fix for Windows Vista asking for security elevation when
 	running chocolate-setup.
 
 2008-05-04 22:43:38 fraggle
-	
+
 	Remove Vanilla Doom reload hack.
 
 2008-05-04 18:09:51 fraggle
-	
+
 	Add command line option to disable mmapped WAD I/O.
 
 2008-05-04 17:45:10 fraggle
-	
+
 	Fix win32 mmap driver and add to build.
 
 2008-05-02 23:52:00 fraggle
-	
+
 	Add Windows memory mapping backend.
 
 2008-05-02 20:19:38 fraggle
-	
+
 	Memory-mapped WAD access.
 
 2008-05-02 20:18:52 fraggle
-	
+
 	Fix up some more code calling Z_Free instead of W_ReleaseLumpNum.
 
 2008-05-02 19:48:43 fraggle
-	
+
 	Add W_CacheLumpNum,Name API to WAD code for releasing a lump back to
 	cache when it is no longer needed.  Switch existing code to use the
 	new API instead of Z_ChangeTag.
 
 2008-05-02 18:32:09 fraggle
-	
+
 	Add WAD I/O abstraction layer - first step for mmapped WAD access.
 
 2008-04-26 17:31:47 fraggle
-	
+
 	"Python Image Library" -> "Python Imaging Library" (thanks exp(x)).
 
 2008-04-26 15:33:14 fraggle
-	
+
 	Add new Chocolate Doom icon.
 
 2008-04-26 00:33:00 fraggle
-	
+
 	Generate transparency mask for the application icon from black parts
 	of the image.
 
 2008-04-23 08:44:17 GhostlyDeath
-	
+
 	VC++ Project now builds
 
 2008-04-20 02:00:11 fraggle
-	
+
 	Bump version to 1.1.1, update ChangeLog and NEWS.
 
 2008-04-19 17:41:58 fraggle
-	
+
 	Fix build problem when libsamplerate support is enabled.
 
 2008-04-19 16:52:37 fraggle
-	
+
 	Bump version to 1.1.0, update ChangeLog and NEWS.
 
 2008-04-19 16:30:42 fraggle
-	
+
 	Fix some more warnings.
 
 2008-04-19 16:27:50 fraggle
-	
+
 	Fix warning.
 
 2008-04-19 14:43:17 fraggle
-	
+
 	Don't successfully save a savegame if a buffer overrun occurs, and
 	don't overwrite the existing savegame.
 
 2008-04-19 14:24:59 fraggle
-	
+
 	Update NEWS.
 
 2008-04-16 21:30:04 fraggle
-	
+
 	Update some of the documentation.
 
 2008-04-16 00:16:16 fraggle
-	
+
 	Make the BSD PC speaker driver work on FreeBSD.
 
 2008-04-15 22:40:33 fraggle
-	
+
 	Make use_libsamplerate be an integer value that controls conversion
 	quality, rather than an on/off setting.
 
 2008-04-15 22:19:35 fraggle
-	
+
 	Fix bug with joystick configuration.
 
 2008-04-02 01:00:11 fraggle
-	
+
 	April Fools!
 
 2008-04-01 01:10:20 fraggle
-	
+
 	Flip all levels on load - the game is more fun this way.
 
 2008-03-30 23:17:13 rtc_marine
-	
+
 	Fix an error message
 
 2008-03-15 23:54:00 rtc_marine
-	
+
 	Fix build of Chocolate Server
 
 2008-03-13 18:41:00 fraggle
-	
+
 	Display a warning message if use_libsamplerate != 0, but libsamplerate
 	support is not compiled in.
 
 2008-03-13 18:33:59 fraggle
-	
+
 	Apply SRC patch from David Flater.
 
 2008-03-12 20:12:51 fraggle
-	
+
 	Add "see also" sections to manpages and GPL note.  Add "files" section
 	to chocolate-doom.6
 
 2008-03-09 03:19:35 rtc_marine
-	
+
 	update codeblocks project to reflect previous commit changes
 
 2008-03-09 03:02:48 fraggle
-	
+
 	Split out configuration file code from m_misc.c into m_config.c.  Move
 	screenshot code into v_video.c Add M_FileLength common function for
 	finding the length of an open file.
 
 2008-02-28 21:22:41 fraggle
-	
+
 	Move vc9/ project files into the msvc/ directory and update the README
 	file for the MSVC files.
 
 2008-02-28 20:07:31 fraggle
-	
+
 	Fix MSVC project file and resource file for new filenames.
 
 2008-02-28 20:04:10 fraggle
-	
+
 	Add fixes for MSVC warnings (thanks entryway).
 
 2008-02-26 22:13:35 fraggle
-	
+
 	Update NEWS.
 
 2008-02-26 22:10:06 fraggle
-	
+
 	Don't sort config file variables alphabetically.  Throw an exception
 	for unknown documentation comments.
 
 2008-02-26 22:05:41 fraggle
-	
+
 	Minor config file documentation fixes.
 
 2008-02-25 23:50:07 fraggle
-	
+
 	Replace manpage header, footer, environment files with a single
 	template file.  Generate documentation for the default.cfg and
 	chocolate-doom.cfg configuration files.
 
 2008-02-24 20:25:51 fraggle
-	
+
 	Switch to using CONFIG_VARIABLE_ macros for the configuration file
 	tables.  Add documentation for each value (for autogenerating
 	documentation).
 
 2008-02-24 00:55:07 fraggle
-	
+
 	Fix leftover "junk" displayed on the screen on the initial melt when
 	using -warp.
 
 2008-02-23 22:51:17 fraggle
-	
+
 	Perform a low-pass filter of converted sounds to filter out
 	high-frequency noise from the upscaling process.
 
 2008-02-21 20:01:30 fraggle
-	
+
 	Shut up compile warning.
 
 2008-02-17 03:12:25 fraggle
-	
+
 	Add command line option for server to allow client version checking to
 	be disabled.
 
 2008-02-13 19:06:11 fraggle
-	
+
 	Don't try to precache sound effects that don't exist.
 
 2008-02-12 22:16:12 fraggle
-	
+
 	Add comment.
 
 2008-02-12 22:07:41 fraggle
-	
+
 	Use SRC_SINC_FASTEST for speed when using libsamplerate for
 	conversions, and precache all sound effects for speed.
 
 2008-02-12 21:29:58 fraggle
-	
+
 	Add use_libsamplerate variable to setup.
 
 2008-02-12 21:26:31 fraggle
-	
+
 	Set the default startup_delay to 1s.
 
 2008-02-11 22:59:51 fraggle
-	
+
 	Add support for sample rate conversion using libsamplerate (thanks to
 	David Flater for this patch).
 
 2008-02-10 18:44:05 fraggle
-	
+
 	Fix compiler warnings.  Refactor the intercepts overrun code so that
 	it should work properly on big endian machines as well as little
 	endian machines.
 
 2008-02-09 22:31:02 fraggle
-	
+
 	Fix up the R_Main startup progress dots.  If stdout is a file, don't
 	display the surrounding box.
 
 2008-02-09 22:21:33 fraggle
-	
+
 	Set the process affinity mask to 1 on Windows, to work around a bug in
 	SDL_mixer (thanks entryway).
 
 2008-02-09 22:04:13 fraggle
-	
+
 	Set the SDL_VIDEODRIVER in setup, so that we get the correct modes
 	list (different video drivers can give different results).  Restart
 	textscreen when the video driver is changed.
 
 2008-02-09 20:30:27 fraggle
-	
+
 	Define WIN32_LEAN_AND_MEAN to fix windows build of i_system.c.
 
 2008-02-09 19:17:19 fraggle
-	
+
 	Remove some unneeded functions from i_system.c.  Make I_Error exit
 	using exit() rather than abort().  Display a message box with the
 	error on Windows.
 
 2008-02-06 23:55:33 fraggle
-	
+
 	Use geometric distance to find the nearest mode when autoadjusting,
 	rather than number of pixels.
 
 2008-02-06 23:42:29 fraggle
-	
+
 	Add -geometry command line parameter to allow the screen size to be
 	specified with one combined option.
 
 2008-02-06 22:18:16 fraggle
-	
+
 	Make 320x240 a "good" mode when aspect ratio correction is turned off.
 	Don't switch to "bad" modes when changing other settings.
 
 2008-02-05 23:32:30 fraggle
-	
+
 	Set screen_{width,height} when finding the nearest mode.  Save the
 	last mode explicitly selected and use this as criteria for which mode
 	is nearest.  Align the display window so that the top always stays
@@ -2010,89 +2162,89 @@
 	still.
 
 2008-02-05 05:34:07 rtc_marine
-	
+
 	fix a few warnings
 
 2008-02-04 22:45:53 fraggle
-	
+
 	Mark 512x400 as a "bad" mode (don't autoadjust to it in fullscreen).
 	Makes 640x480 the default when 320x200 mode is not available.
 
 2008-02-04 22:43:11 fraggle
-	
+
 	Update chocolate-setup to the new screen mode config system.
 
 2008-01-31 22:43:20 rtc_marine
-	
+
 	Use project names as binary names
 
 2008-01-30 19:09:31 fraggle
-	
+
 	Be more accurate in describing windowboxed modes as either
 	"pillarboxed", "letterboxed" or "windowboxed".
 
 2008-01-26 15:38:28 fraggle
-	
+
 	Update make dist for new codeblocks files.
 
 2008-01-25 23:05:53 rtc_marine
-	
+
 	Change filenames to be name independant Update the project files and
 	main workspace
 
 2008-01-25 22:48:23 fraggle
-	
+
 	Update win32 resource files for the new icon filenames.
 
 2008-01-25 17:37:48 fraggle
-	
+
 	Rename some files to be package name independent.
 
 2008-01-24 19:26:12 fraggle
-	
+
 	Update NEWS.
 
 2008-01-24 19:14:44 fraggle
-	
+
 	Add manpages for chocolate-setup, chocolate-server, based on the
 	versions by Jon Dowland for the Chocolate Doom debian package
 	(thanks!)
 
 2008-01-24 19:10:49 fraggle
-	
+
 	Make lookup tables const where possible.
 
 2008-01-24 19:09:47 fraggle
-	
+
 	Fix fast / respawning monsters parameter not exchanged when starting
 	netgames (thanks GhostlyDeath).
 
 2008-01-23 23:56:35 fraggle
-	
+
 	Add URLs for patches.
 
 2008-01-22 20:02:02 fraggle
-	
+
 	Use MEM_SEEK_SET for memio, not SEEK_SET.
 
 2008-01-22 20:00:42 fraggle
-	
+
 	Add SDL_mixer, SDL_net URLs and a section on timidity.
 
 2008-01-22 19:55:50 fraggle
-	
+
 	Include MSVC project files in make dist.
 
 2008-01-22 19:52:38 fraggle
-	
+
 	Add INSTALL file.
 
 2008-01-21 15:07:15 GhostlyDeath
-	
+
 	Removed spaces from VC9 Project
 
 2008-01-20 16:18:16 fraggle
-	
+
 	Fix loading disk icon.  Add back -1, -2, -3 command line options for
 	scale.  Only allow 320x200, 640x400 special case for aspect ratio
 	correct when running fullscreen.  Clean up "nearest mode"
@@ -2099,12 +2251,12 @@
 	autoadjustment.  Fix crash with autoadjust when running windowed.
 
 2008-01-20 04:59:50 fraggle
-	
+
 	Add -width, -height command line parameters for specifying the screen
 	mode.
 
 2008-01-20 04:47:52 fraggle
-	
+
 	Refactor the video mode configuration system.  The previous system was
 	built around the program choosing a screen mode from the user's
 	settings, this is based around choosing settings from the specified
@@ -2114,79 +2266,79 @@
 	complement to the existing vertical stretching).
 
 2008-01-20 01:59:39 fraggle
-	
+
 	Use strcmp(), not strcasecmp() for checking driver name
 
 2008-01-20 00:22:47 fraggle
-	
+
 	Revert doomdef.h include added to pcsound.c.
 
 2008-01-16 14:41:07 rtc_marine
-	
+
 	Fix build Remove unused libraries from certain projects
 
 2008-01-16 14:33:08 GhostlyDeath
-	
+
 	Updated VC9 project, -setup and -server now build correctly
 
 2008-01-16 13:39:24 GhostlyDeath
-	
+
 	Added MSVC9 (2k8 Express) Project File; The client builds but -setup
 	and -server just need to have files excluded/included from the project
 
 2008-01-16 11:13:42 rtc_marine
-	
+
 	Update config.h to 1.0.0 for the codeblocks projects
 
 2008-01-12 12:28:08 fraggle
-	
+
 	Make sure we credit Id in the manpage as well.  Update copyright to
 	2008.
 
 2008-01-10 00:46:53 fraggle
-	
+
 	Use the same spechits magic value that PrBoom-plus uses (thanks
 	Lemonzest).
 
 2007-12-30 04:51:56 fraggle
-	
+
 	Add environment variable section to manpage.
 
 2007-12-18 22:09:51 fraggle
-	
+
 	Don't center the mouse on startup if the mouse is disabled (thanks
 	Siggi) Reset the palette when the window is restored to clear any
 	screen corruption (thanks Catoptromancy)
 
 2007-12-14 22:23:13 fraggle
-	
+
 	Don't grab the mouse if the mouse is disabled by -nomouse or through
 	use_mouse in the configuration file (thanks MikeRS).
 
 2007-12-14 18:31:28 fraggle
-	
+
 	Update NEWS.
 
 2007-12-14 18:29:23 fraggle
-	
+
 	Include doomfeatures.h in deh_misc.h so that FEATURE_DEHACKED is
 	checked properly.  Fixes STRAIN desyncs with BFG Cells/Shot not set
 	properly.
 
 2007-12-13 23:04:58 fraggle
-	
+
 	Add a list of wiki pages to link to and automatically insert links.
 
 2007-12-13 22:32:33 fraggle
-	
+
 	Add missing argument to the extraconfig command line parameter.
 
 2007-12-13 22:27:07 fraggle
-	
+
 	Add mmapped file IO note to TODO.
 
 2007-12-13 22:26:16 fraggle
-	
+
 	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
@@ -2193,287 +2345,287 @@
 	options.
 
 2007-12-10 21:03:28 fraggle
-	
+
 	Bump version to 1.0.0 and update ChangeLog.
 
 2007-12-08 11:07:13 fraggle
-	
+
 	Update NEWS.
 
 2007-11-23 18:26:40 fraggle
-	
+
 	Use _spawnv() to invoke Doom under Windows, rather than system().
 	Fixes bug with DOS window "flashing up" when opening the multiplayer
 	dialogs.
 
 2007-10-19 00:55:11 fraggle
-	
+
 	Reorder actionf_t union members to fix warnings in info.c.
 
 2007-10-19 00:54:11 fraggle
-	
+
 	Shut up signed / unsigned comparison warnings.
 
 2007-10-19 00:44:56 fraggle
-	
+
 	#define snprintf, vsnprintf to _snprintf, _vsnprintf in MSVC.
 
 2007-10-19 00:40:50 fraggle
-	
+
 	#define inline to _inline in MSVC.
 
 2007-10-19 00:38:53 fraggle
-	
+
 	Fix for strcasecmp in MSVC; #define to stricmp.  Outside MSVC, use
 	strings.h.
 
 2007-09-15 18:09:47 fraggle
-	
+
 	Fix desyncs caused by previous change to A_Explode.
 
 2007-09-15 14:13:00 fraggle
-	
+
 	Check for playeringame overflow when spawning a new player (for
 	compatibility with vex6d.wad / bug_wald.lmp)
 
 2007-09-15 13:35:33 fraggle
-	
+
 	Add intercepts overrun emulation from PrBoom-plus.
 
 2007-09-14 23:20:08 fraggle
-	
+
 	Add P_SubstNullMobj, substitute NULL mobjs for a dummy mobj where
 	mo->target is not checked for NULL.
 
 2007-09-11 10:02:24 fraggle
-	
+
 	Remove obsolete autotools scripts from dist, require automake 1.8
 	(please upgrade!)
 
 2007-09-05 00:50:56 fraggle
-	
+
 	Fix build failure when python is not installed.
 
 2007-09-03 02:05:27 fraggle
-	
+
 	Up the default sample rate to 44100.
 
 2007-09-03 02:00:19 fraggle
-	
+
 	Fix crash when playing long sounds (like DSBOSSIT)
 
 2007-09-03 01:43:29 fraggle
-	
+
 	Try to open /dev/speaker in the parent process, so that we can tell if
 	we don't have permission to open it before we fork.
 
 2007-09-03 01:30:51 fraggle
-	
+
 	Add pcsound driver for OpenBSD.
 
 2007-09-02 21:17:19 fraggle
-	
+
 	Disable "saving config in ...  " message for setup (thanks MikeRS)
 
 2007-09-02 21:14:40 fraggle
-	
+
 	Don't make novert affect the joystick as well (thanks Janizdreg)
 
 2007-08-31 09:59:34 fraggle
-	
+
 	Make SHORT and LONG macros return signed values; this is the behaviour
 	of the versions in the original source and some code depends on it.
 
 2007-08-31 09:31:48 fraggle
-	
+
 	Use short for texpatch_t .originx, .originy: fixes problem caused by
 	sign conversion in the endianness code.
 
 2007-08-31 08:27:44 fraggle
-	
+
 	Use gcc packed attribute for all structures read/written to disk.  This
 	fixes architectures where structure fields are aligned differently to
 	optimise reads, causing the game to crash.
 
 2007-08-27 20:31:30 fraggle
-	
+
 	Fix bug where the automap always follows player 1 in multiplayer mode
 	(thanks Janizdreg!)
 
 2007-08-24 01:27:39 fraggle
-	
+
 	Initialise tracksize variable before mus2mid conversion, otherwise it
 	is not reset the next time we convert a mid
 
 2007-08-20 00:54:27 fraggle
-	
+
 	Use __APPLE__ instead of __MACOSX__.
 
 2007-08-09 01:28:34 fraggle
-	
+
 	Remove debugging message.
 
 2007-08-09 01:04:03 fraggle
-	
+
 	Don't crash when all players have quit.
 
 2007-08-09 01:03:41 fraggle
-	
+
 	Disconnect any remaining drones when the last real player quits.
 
 2007-08-08 22:14:48 fraggle
-	
+
 	Remove M_FileExists check for steam directories and add them as
 	possible search paths anyway.
 
 2007-08-08 22:11:29 fraggle
-	
+
 	Add the default DEICE install directories to the IWAD search path on
 	Windows.
 
 2007-08-08 21:06:46 fraggle
-	
+
 	Match steam IWAD directory order to IWAD search order.
 
 2007-08-08 19:04:35 fraggle
-	
+
 	Move SCREENHEIGHT_4_3 to doomdef.h; remove some unused constants.
 
 2007-08-08 19:03:32 fraggle
-	
+
 	Make M_FileExists work on directories.
 
 2007-08-08 03:00:53 fraggle
-	
+
 	Add temporary debugging messages for Steam support.
 
 2007-08-08 02:17:38 fraggle
-	
+
 	Don't assume Steam InstallPath ends in a \
 
 2007-08-07 05:26:16 fraggle
-	
+
 	All of the steam IWADs are in \base subdirectories.
 
 2007-08-07 02:19:49 fraggle
-	
+
 	Autodetect IWADs installed by Steam.
 
 2007-08-06 05:48:55 fraggle
-	
+
 	Remove duplicate FileExists function.
 
 2007-08-03 23:17:15 fraggle
-	
+
 	Fix 'pop' at the end of sound effects caused by an audio conversion
 	bug.
 
 2007-07-30 03:03:23 fraggle
-	
+
 	Set timedemo start time when demo playback begins, not when the level
 	begins.  Using the level start time causes problems when timing
 	multi-level demos.
 
 2007-07-30 01:44:49 fraggle
-	
+
 	Make the z_native "out of memory" error message match the normal
 	z_zone one.
 
 2007-07-30 01:31:33 fraggle
-	
+
 	Fix bug in z_native linked list logic.  Clear out all PU_CACHE blocks
 	when out of memory.
 
 2007-07-30 00:41:12 fraggle
-	
+
 	Allow more than the standard three mouse buttons to be defined through
 	setup (hopefully)
 
 2007-07-22 15:45:53 fraggle
-	
+
 	Add missing new mouse buttons to setup (thanks RazTK).
 
 2007-07-10 14:37:58 fraggle
-	
+
 	Another crazy idea.
 
 2007-07-10 14:37:44 fraggle
-	
+
 	Shut up compiler warning.
 
 2007-07-08 21:53:18 fraggle
-	
+
 	Make the numeric keypad behave like Vanilla does.
 
 2007-07-08 18:52:45 fraggle
-	
+
 	Add -netdemo for playing back netgame demos that only have a single
 	player.
 
 2007-07-08 00:58:24 fraggle
-	
+
 	Make drones quit when disconnected from the server.
 
 2007-07-08 00:45:55 fraggle
-	
+
 	Don't grab the mouse if a drone player (no input, so it isn't needed).
 
 2007-07-05 13:06:10 fraggle
-	
+
 	Clearer prompt when asking whether to save settings on exit of setup.
 
 2007-07-05 12:57:18 fraggle
-	
+
 	Remove "startup delay" from the setup display configuration dialog.
 
 2007-07-04 23:57:07 fraggle
-	
+
 	Add pcsound_internal.h to dist.
 
 2007-06-30 15:34:03 fraggle
-	
+
 	Don't crash if there is a multiplayer demo in the demo loop.
 
 2007-06-28 00:15:56 fraggle
-	
+
 	Interpret skill level setting as a signed integer, to allow -skill 0.
 
 2007-06-22 20:14:49 fraggle
-	
+
 	Don't allow two actions bound to the same button in setup.
 
 2007-06-22 12:55:14 fraggle
-	
+
 	Replace 35 with TICRATE where appropriate.
 
 2007-06-21 23:51:47 fraggle
-	
+
 	Add a joystick dead zone for joysticks that don't have them.
 
 2007-06-21 23:00:38 fraggle
-	
+
 	Revert previous change from bitshifts to divides; this causes demo
 	desyncs.
 
 2007-06-21 12:33:46 fraggle
-	
+
 	Add arrlen() macro as a clearer way of doing sizeof(array) /
 	sizeof(*array)
 
 2007-06-21 12:32:04 fraggle
-	
+
 	Add portability section to HACKING file.
 
 2007-06-20 12:44:46 fraggle
-	
+
 	Update TODO.
 
 2007-06-20 12:21:57 fraggle
-	
+
 	Add x5 screen scale (thanks MikeRS!)
 
 2007-06-20 01:37:40 fraggle
-	
+
 	Add new configuration options for the mouse and joystick for controls
 	that are available through the keyboard.  Justification: this is
 	already possible through advanced mouse drivers and programs like
@@ -2480,60 +2632,60 @@
 	js2x, so there might as well be a proper interface for it.
 
 2007-06-19 00:59:08 rtc_marine
-	
+
 	Update codeblocks projects for new sound stuff Include envvars in
 	projects, which is part of the new format
 
 2007-06-19 00:50:42 fraggle
-	
+
 	Add -iwad when joining a game, as well as when creating one (thanks
 	MikeRS :-)
 
 2007-06-19 00:47:44 fraggle
-	
+
 	Remove deleted headers from Makefile.am.
 
 2007-06-17 20:19:37 fraggle
-	
+
 	Make the music code modular as well, although for the time being there
 	is only one module.  Remove s_dummy.c.
 
 2007-06-17 19:40:02 fraggle
-	
+
 	Split i_sound.c into i_sdlsound.c, i_sdlmusic.c, with generic "sound
 	driver" modules, one for PC speaker and one for digital output.
 
 2007-06-16 17:16:45 fraggle
-	
+
 	Switch back to z_zone, not z_native (oops!)
 
 2007-06-16 17:04:00 fraggle
-	
+
 	Clean up sound code
 
 2007-06-16 17:03:10 fraggle
-	
+
 	Use divides instead of bitshifts, for clarity
 
 2007-06-16 17:02:58 fraggle
-	
+
 	Shut up strict aliasing warnings
 
 2007-06-16 17:02:46 fraggle
-	
+
 	Switch to djb2 hash function and shut up compiler warnings
 
 2007-06-15 00:20:30 rtc_marine
-	
+
 	Update codeblocks project
 
 2007-06-14 22:45:50 fraggle
-	
+
 	Add configuration file variable to change the sound sample rate
 	(snd_samplerate)
 
 2007-06-14 22:15:52 fraggle
-	
+
 	Support up to 20 joystick buttons.  Justification: most modern
 	joysticks and joypads have many more than four buttons.  Keeping the
 	limit at four buttons restricts the player into using the first four
@@ -2541,57 +2693,57 @@
 	buttons.
 
 2007-06-14 22:03:22 fraggle
-	
+
 	Don't send joystick updates when the joystick is disabled.  Shut up
 	warning caused by missing header.
 
 2007-06-13 20:12:13 fraggle
-	
+
 	Working joystick code.
 
 2007-06-12 19:49:29 fraggle
-	
+
 	Emulate overflows in P_FindNextHighestFloor.  Thanks to entryway for
 	this fix.
 
 2007-06-09 23:28:55 fraggle
-	
+
 	Joystick calibration (untested)
 
 2007-06-09 19:01:00 fraggle
-	
+
 	Add stamp-h1 to svn:ignore.
 
 2007-06-09 19:00:19 fraggle
-	
+
 	Add *.exe to svn:ignore.
 
 2007-06-09 18:51:16 fraggle
-	
+
 	Initial joystick calibration code.
 
 2007-06-09 18:49:05 fraggle
-	
+
 	Open the joystick when prompting for a new button.
 
 2007-06-09 18:45:14 fraggle
-	
+
 	Set svn:ignore on pcsound directory.
 
 2007-06-04 19:35:51 fraggle
-	
+
 	Remove unneeded SDL.h include.
 
 2007-06-04 19:34:51 fraggle
-	
+
 	Oops!
 
 2007-06-04 19:34:24 fraggle
-	
+
 	Completed joystick button selection widget (untested)
 
 2007-06-04 19:32:50 fraggle
-	
+
 	Rename txt_main.c to txt_sdl.c; add txt_sdl.h for SDL-specific API
 	functions, while keeping txt_main.h for the common API.  Add
 	TXT_SDL_SetEventCallback to allow programs to intercept SDL events in
@@ -2598,78 +2750,78 @@
 	the textscreen main loop.
 
 2007-06-02 08:04:28 rtc_marine
-	
+
 	Update codeblocks projects for joystick stuff
 
 2007-06-01 19:08:42 fraggle
-	
+
 	Display a meaningful message when trying to start with an invalid
 	Joystick ID.
 
 2007-06-01 19:08:09 fraggle
-	
+
 	Up the threshold for the always run hack to 20; it's conceivable that
 	there are control pads with more than 10 buttons.
 
 2007-06-01 19:06:15 fraggle
-	
+
 	Hide the joystick speed control when the always run hack is being
 	used.
 
 2007-06-01 00:16:23 fraggle
-	
+
 	Initial joystick support.
 
 2007-05-24 15:31:54 fraggle
-	
+
 	Fix ByteSwapBlock macro.
 
 2007-05-24 15:29:08 fraggle
-	
+
 	Add TXT_SetWindowTitle function to wrap SDL_WM_SetCaption, so that
 	txt_desktop.c doesn't need to call SDL functions directly.
 
 2007-05-24 15:26:08 fraggle
-	
+
 	Use I_Sleep in i_system.c instead of SDL_Delay directly.
 
 2007-05-20 16:06:46 fraggle
-	
+
 	Fix crash when converting audio down to a lower sample rate.
 
 2007-05-20 03:20:54 fraggle
-	
+
 	Stop music on sound shutdown so music isn't left playing at the ENDOOM
 	screen.
 
 2007-05-20 03:20:22 fraggle
-	
+
 	Initialise sound before network setup to fix bug with sound effects
 	not playing when playing netgames on Windows (text mode waiting screen
 	shutdown causes sound not to start up?)
 
 2007-05-19 23:53:10 fraggle
-	
+
 	Update NEWS.
 
 2007-05-19 23:48:39 fraggle
-	
+
 	Don't allow idclev in netgames.
 
 2007-05-19 17:42:56 fraggle
-	
+
 	Fix tempo problems in pcsound linux driver.
 
 2007-05-16 15:28:22 fraggle
-	
+
 	Add FEATURE_SOUND.
 
 2007-05-16 14:52:09 fraggle
-	
+
 	Oops!
 
 2007-05-16 14:49:04 fraggle
-	
+
 	Rejig net_cl_new_sync and drone to be in d_net.c instead of
 	net_client.c.  Fix FEATURE_MULTIPLAYER conditional compile.  Move some
 	function definitions in d_net.c into headers.  Reorganise the Makefile
@@ -2676,84 +2828,84 @@
 	to split out files into sections based on features.
 
 2007-05-09 19:48:32 fraggle
-	
+
 	Fix ticdup.
 
 2007-05-02 03:03:44 fraggle
-	
+
 	Check in autoconf if python is installed; if not, don't run python
 	scripts.
 
 2007-05-02 02:51:15 fraggle
-	
+
 	Add missing files to dist.
 
 2007-04-29 15:53:37 fraggle
-	
+
 	Add missing codeblocks workspace files to dist.
 
 2007-04-16 12:34:26 fraggle
-	
+
 	Fix crash: don't check for client resends after they have
 	disconnected.
 
 2007-04-03 10:31:12 rtc_marine
-	
+
 	Fix building with gcc 4.x
 
 2007-03-27 12:57:28 fraggle
-	
+
 	Update NEWS.
 
 2007-03-27 12:44:53 fraggle
-	
+
 	Update ChangeLog.
 
 2007-03-27 12:40:04 fraggle
-	
+
 	<SDL.h> -> "SDL.h"
 
 2007-03-27 00:20:10 fraggle
-	
+
 	Fix docgen makefile dependencies.
 
 2007-03-27 00:19:22 fraggle
-	
+
 	Fix manpage copyright footer to include id as well as me.
 
 2007-03-26 13:09:53 fraggle
-	
+
 	Search WAD search dirs when loading dehacked patches.
 
 2007-03-19 16:44:49 fraggle
-	
+
 	Update TODO; PC speaker is supported now.
 
 2007-03-16 22:26:06 fraggle
-	
+
 	Add back shiftxform table so that the shift key works in multiplayer
 	chat when vanilla_keyboard_mapping is enabled.
 
 2007-03-16 21:43:28 fraggle
-	
+
 	Add config file option to enable/disable native keyboard bindings.
 
 2007-03-16 05:07:35 rtc_marine
-	
+
 	Update codeblocks project
 
 2007-03-15 18:43:22 fraggle
-	
+
 	Change MD5 code to use the standard types used elsewhere in the
 	program.
 
 2007-03-15 18:38:55 fraggle
-	
+
 	Use SDL for endianness byte swapping.  m_swap.c removed; m_swap.h
 	renamed to i_swap.h.
 
 2007-03-14 13:05:03 fraggle
-	
+
 	Use SDL's built-in audio conversion routines to convert sound effects
 	to the output mixer device's sample rate.  Simplistic (naive)
 	resampling in cases where SDL's routines can't do a conversion.  This
@@ -2761,12 +2913,12 @@
 	48khz output rate.
 
 2007-03-12 12:38:54 fraggle
-	
+
 	Change "sound effects enabled" checkbox to a dropdown, allowing PC
 	speaker to be selected as well.
 
 2007-03-10 07:48:21 rtc_marine
-	
+
 	Minor changes:
 	* No more shared libraries on windows, because they suck anyway and
 	  complicate things
@@ -2773,12 +2925,12 @@
 	* Fix build virtual targets
 
 2007-03-10 05:40:12 fraggle
-	
+
 	Ignore the HOME environment variable on Windows - just behave like
 	Vanilla Doom.
 
 2007-03-10 02:11:18 rtc_marine
-	
+
 	Lots of changes/additions:
 	* Add libpcsound codeblocks project
 	* Use libraries that are built and project dependencies inside main
@@ -2787,20 +2939,20 @@
 	* Fix some warnings
 
 2007-03-09 23:30:46 fraggle
-	
+
 	Add pcsound Linux driver.
 
 2007-03-09 23:03:24 fraggle
-	
+
 	Don't build console mode apps; use the default -mwindows until the
 	stdout.txt/stderr.txt thing can be fixed.
 
 2007-03-09 22:50:48 fraggle
-	
+
 	Move the pcsound library to the top level, alongside textscreen.
 
 2007-03-09 22:20:28 fraggle
-	
+
 	Partially revert the last change.  I'm going with a mixed approach for
 	handling key mappings.  Chocolate Doom will use the original (broken)
 	Doom behavior, in that keys will be unmapped.  A German user will have
@@ -2811,7 +2963,7 @@
 	wrong mappings when typing in text.
 
 2007-03-09 12:56:45 fraggle
-	
+
 	Pay closer attention to keyboard mappings.  In the menu code,
 	distinguish between keys pressed and characters typed, so that, for
 	example, when the menu prompts "press 'y' to continue", it responds to
@@ -2819,92 +2971,92 @@
 	keyboard being pressed.  Do the same when reading cheats.
 
 2007-03-09 12:35:18 fraggle
-	
+
 	Fix discrepancy between Doom and setup program when prompting for
 	keys.  Add the ability to enable/disable key mappings so that the raw
 	key can be read in setup, exactly the same way that it is in Doom.
 
 2007-03-07 23:52:33 rtc_marine
-	
+
 	Update project Fix a warning
 
 2007-03-07 19:08:27 fraggle
-	
+
 	Use native endianness for sound output, rather than always LSB.  Add
 	PC speaker code!
 
 2007-02-24 02:30:17 fraggle
-	
+
 	Fix up setup tool to display the video driver setting tabulated with
 	all the other settings.
 
 2007-02-24 02:26:02 fraggle
-	
+
 	Fix video_driver setting.
 
 2007-02-24 02:19:45 fraggle
-	
+
 	Fix library ordering for libtextscreen.a; fixes windows compile.
 
 2007-02-23 23:42:56 fraggle
-	
+
 	Fix compile errors.
 
 2007-02-23 23:41:58 fraggle
-	
+
 	Add an extra option to chocolate-setup on Windows to allow the video
 	driver to be selected from directx and windib.
 
 2007-02-23 23:26:26 fraggle
-	
+
 	Add a configuration file value to allow the SDL video driver to be
 	explicitly specified.
 
 2007-02-15 21:51:53 fraggle
-	
+
 	Really fix the menu corruption bug.
 
 2007-02-14 19:11:30 fraggle
-	
+
 	Make I_Error call abort() instead of exit(), so that we can get a
 	backtrace in the debugger.
 
 2007-02-14 19:11:03 fraggle
-	
+
 	Expand buffer length to fix bug on Windows with cycling character on
 	the quicksave screen.
 
 2007-02-14 19:10:30 fraggle
-	
+
 	Read sound length as a 32 bit field, not 16 bit.  Fixes death sound in
 	marina.wad.
 
 2007-02-10 03:19:30 fraggle
-	
+
 	Don't prepend a superfluous './' to the path when searching the
 	current directory for an IWAD.
 
 2007-02-07 13:04:46 fraggle
-	
+
 	Revert previous change: throwing away the key state seems to be the
 	Doom 1.9 behavior.
 
 2007-02-07 12:58:53 fraggle
-	
+
 	Don't throw away keypress state when passing between levels - allows
 	shift to be held down for run when moving between levels.  Thanks to
 	Zack Friedrich <zack18@comcast.net> for pointing this out.
 
 2007-02-01 12:21:14 fraggle
-	
+
 	Search IWAD search directories when loading PWAD files.
 
 2007-01-14 05:20:28 fraggle
-	
+
 	Fix savegamedir directory generation.
 
 2007-01-14 05:04:37 fraggle
-	
+
 	Change interpretation of DOOMWADDIR to the classic behavior: a single
 	directory path where an IWAD can be found.  Add DOOMWADPATH as a
 	PATH-style list of directories to search for IWADs.  This is to
@@ -2912,374 +3064,374 @@
 	DOOMWADDIR name makes sense.
 
 2007-01-08 22:46:05 fraggle
-	
+
 	More helpful SDL_mixer error messages.
 
 2007-01-08 22:45:18 fraggle
-	
+
 	Bomb out with an error in configure if SDL_mixer or SDL_net are not
 	found.
 
 2007-01-07 01:58:16 fraggle
-	
+
 	Display a message on the console with details when WAD/DEH checksums
 	do not match.
 
 2007-01-06 22:26:23 fraggle
-	
+
 	Set svn:ignore properties on directories.
 
 2007-01-06 03:26:00 fraggle
-	
+
 	Hide the mouse cursor using SDL_SetCursor to a blank cursor, not
 	SDL_ShowCursor.  This fixes mouse lag on Windows.  Thanks to entryway.
 
 2007-01-06 02:15:44 rtc_marine
-	
+
 	temp -> tempdir update codeblocks projects (which is a new format,
 	latest cb svn build is needed)
 
 2007-01-06 00:34:50 fraggle
-	
+
 	Choose the locations for temporary files more intelligently.
 
 2007-01-05 23:42:38 fraggle
-	
+
 	Fix Batman Doom example in README.
 
 2007-01-05 23:41:17 fraggle
-	
+
 	Make the WADs input box wider.  Rename labels in the start multiplayer
 	game dialog.
 
 2007-01-05 23:39:39 fraggle
-	
+
 	Add quit prompt message missing in the Doom source release.
 
 2007-01-05 23:38:19 fraggle
-	
+
 	Move response file code to m_argv.c
 
 2007-01-05 23:36:35 fraggle
-	
+
 	Clear the current value when entering a new value in number input
 	boxes.
 
 2007-01-05 23:35:30 fraggle
-	
+
 	Fix typing '_' and '+' in textscreen code.
 
 2007-01-02 06:59:58 rtc_marine
-	
+
 	Replace WINDOWS define with _WIN32 Update Codeblocks project
 
 2007-01-02 04:41:29 rtc_marine
-	
+
 	sys/wait.h does not exist on windows (thank mingw for sucking), add
 	WIFEXITED and WEXITSTATUS macros so it can compile under windows.
 
 2006-12-26 18:01:25 fraggle
-	
+
 	Remove command line options from README; move to autogenerated CMDLINE
 	file.
 
 2006-12-26 15:43:16 fraggle
-	
+
 	On OSX, make MIDI music disabled by default.  There are problems with
 	the native MIDI code in SDL_mixer.
 
 2006-12-25 12:28:27 fraggle
-	
+
 	Fix default network port in chocolate-setup.
 
 2006-12-25 02:40:14 fraggle
-	
+
 	Fix up some text escaping errors.  Add wikitext output for docgen.
 
 2006-12-24 23:55:08 fraggle
-	
+
 	Fix setup tool crash when no IWADs found.
 
 2006-12-24 23:54:41 fraggle
-	
+
 	Update TODO.
 
 2006-12-24 23:53:15 fraggle
-	
+
 	Javadoc-style self-documenting system for command line options.
 
 2006-12-24 16:32:47 fraggle
-	
+
 	Include "SDL.h", not <SDL.h>, as per http://www.libsdl.org/faq.php
 
 2006-12-24 11:11:21 fraggle
-	
+
 	Add new item for TODO.
 
 2006-12-23 21:24:56 fraggle
-	
+
 	Add '-findiwads' command line hack so that the setup program can find
 	out what games are installed.  Provide a drop-down list in setup to
 	allow the game type to be selected.
 
 2006-12-23 01:36:18 rtc_marine
-	
+
 	update cb project files
 
 2006-12-23 01:32:22 fraggle
-	
+
 	Fix my email address.
 
 2006-12-23 01:30:20 fraggle
-	
+
 	Add config.h for codeblocks build :-)
 
 2006-12-22 15:22:40 fraggle
-	
+
 	Add definitions for PATH and directory separators.  Allow multiple
 	directories to be specified in DOOMWADDIR, in the same way as PATH.
 	Make -iwad search through all search paths for the specified IWAD.
 
 2006-12-22 15:18:12 fraggle
-	
+
 	Update NEWS.
 
 2006-12-22 01:44:32 fraggle
-	
+
 	Add MSVC inttypes.h and stdint.h implementations: might be useful in
 	the future.
 
 2006-12-22 01:43:41 fraggle
-	
+
 	Switch from stdint.h to inttypes.h (which includes stdint.h).  Old
 	pre-C99 versions of Solaris only have inttypes.h.
 
 2006-12-22 01:42:21 fraggle
-	
+
 	Update TODO - registry stuff is now done.
 
 2006-12-22 01:42:10 rtc_marine
-	
+
 	update cb project for d_iwad.*
 
 2006-12-22 01:39:03 fraggle
-	
+
 	Shut up compiler warnings.
 
 2006-12-21 22:03:00 fraggle
-	
+
 	Add registry key for Doom 95 shareware version.
 
 2006-12-21 21:43:47 fraggle
-	
+
 	Split off IWAD-related code into separate d_iwad.c.  On Windows,
 	search the registry to automatically find the locations of installed
 	IWADs.
 
 2006-12-19 23:04:04 fraggle
-	
+
 	Update to latest version of chocolate-setup icon.
 
 2006-12-19 23:03:28 fraggle
-	
+
 	Update email address.  Remove list of chocolate-doom.cfg options; it's
 	easier to just use the setup tool.  The list of command line options
 	is also in dire need of updating ...
 
 2006-12-18 23:40:40 rtc_marine
-	
+
 	make icons a little smoother around the edges
 
 2006-12-18 19:21:21 fraggle
-	
+
 	Add missing copyright statement, comments.
 
 2006-12-18 18:15:47 fraggle
-	
+
 	x3, x4 aspect ratio corrected scale functions.
 
 2006-12-17 20:57:36 fraggle
-	
+
 	Make numbers in the chat macros configuration screen match the
 	keyboard keys used to activate them.
 
 2006-12-17 19:02:25 fraggle
-	
+
 	Update TODO
 
 2006-12-16 23:12:40 fraggle
-	
+
 	Allow -warp 1 to warp to E1M1, -warp 2 -> E2M1, etc.  when playing
 	Doom 1.  Thanks for RazTK for pointing this out.
 
 2006-12-16 22:57:58 fraggle
-	
+
 	Fix value in autoadjust message.
 
 2006-12-16 02:29:59 rtc_marine
-	
+
 	Add icon to chocolate-setup binary when built
 
 2006-12-16 01:56:59 fraggle
-	
+
 	Add aspect ratio correction to setup tool.  Redesign the display
 	settings dialog.
 
 2006-12-16 01:53:54 fraggle
-	
+
 	Add function to set radio button labels.
 
 2006-12-16 01:53:17 fraggle
-	
+
 	Make dropdown lists emit a signal when set.
 
 2006-12-16 00:58:12 fraggle
-	
+
 	Add icon for setup tool.
 
 2006-12-16 00:54:18 fraggle
-	
+
 	Shut up datarootdir warnings.
 
 2006-12-16 00:53:17 fraggle
-	
+
 	"\0" -> NULL
 
 2006-12-15 23:15:05 rtc_marine
-	
+
 	Fix build Add new fields for code completion (stupid I know, but
 	otherwise cb will probably have a fit)
 
 2006-12-15 21:51:35 rtc_marine
-	
+
 	update project file to accomodate scaling code.
 
 2006-12-15 21:10:00 fraggle
-	
+
 	Fix episode 3 bunny end screen (oops!!!!)
 
 2006-12-15 19:35:46 fraggle
-	
+
 	Split off scaling code into i_scale.c.  Add aspect ratio correction
 	stretching (fullscreen 320x240, 640x480, etc)!
 
 2006-12-08 16:37:41 fraggle
-	
+
 	Make trig tables const.
 
 2006-12-06 09:14:25 fraggle
-	
+
 	Add notes about packages to TODO.
 
 2006-12-05 21:45:32 fraggle
-	
+
 	More TODO items.  That's all I can think of for now.
 
 2006-12-05 21:10:22 fraggle
-	
+
 	Update TODO list: remove some things which are now complete and add
 	some new ideas.
 
 2006-12-05 21:05:46 fraggle
-	
+
 	Update BUGS list.
 
 2006-12-05 21:05:26 fraggle
-	
+
 	Add missing #include.
 
 2006-12-01 09:04:34 fraggle
-	
+
 	Add SPARC note to NEWS.
 
 2006-12-01 08:57:15 fraggle
-	
+
 	Fixups to make compiles work under the Solaris/SPARC compiler.  Thanks
 	to Mike Spooner <spooferman@excite.com> for his work on porting this.
 
 2006-11-29 00:53:37 fraggle
-	
+
 	Remove use of m4; use "Chocolate Doom" when referring to the program
 	by its proper name.
 
 2006-11-29 00:49:33 fraggle
-	
+
 	Use my gmail.com email address.
 
 2006-11-27 21:45:50 rtc_marine
-	
+
 	* removal of FEATURE_* defines from codeblocks project
 	* silence some warnings
 
 2006-11-25 20:14:27 fraggle
-	
+
 	Use C99 types.
 
 2006-11-25 19:45:02 fraggle
-	
+
 	Remove FixedDiv2; use actual fixed point version of FixedDiv (wtf?)
 
 2006-11-25 18:31:54 fraggle
-	
+
 	Remove version from msvc/config.h.  This is not generated
 	automatically, so it is better to use a nonsensical version that will
 	encourage anyone that uses it to set it properly.
 
 2006-11-19 04:53:36 rtc_marine
-	
+
 	Silence warnings in debug build
 
 2006-11-16 00:12:34 fraggle
-	
+
 	Display lowres turning warning message client-side, not through
 	server-side broadcast messages.  This avoids the possibility of
 	malicious servers that might not send the message.
 
 2006-11-16 00:05:44 fraggle
-	
+
 	Increase buffer size to fixes crashes due to buffer overruns.
 
 2006-11-15 00:25:22 fraggle
-	
+
 	Use booleans in place of ints where possible.
 
 2006-11-15 00:16:34 fraggle
-	
+
 	Fix endianness problem in mus2mid code (thanks denis)
 
 2006-11-14 20:31:37 fraggle
-	
+
 	Use getenv/putenv, not SDL_getenv/SDL_putenv.
 
 2006-11-14 20:09:26 fraggle
-	
+
 	Support running as a screensaver under X!
 
 2006-11-10 17:32:54 fraggle
-	
+
 	Fix for playing demos on PPC (actually, fix for loading single lump
 	files on non-little-endian machines).
 
 2006-11-10 07:50:26 fraggle
-	
+
 	Add -gdi command line parameter as a shortcut for
 	SDL_VIDEODRIVER=windib on Windows.
 
 2006-11-06 18:04:26 fraggle
-	
+
 	Use DirectX by default on Windows.
 
 2006-11-06 17:59:39 fraggle
-	
+
 	Center the mouse on startup to prevent abrupt turns when launching a
 	game from the command line.
 
 2006-11-02 19:01:30 fraggle
-	
+
 	Update NEWS file.
 
 2006-10-31 01:01:48 fraggle
-	
+
 	Simulate overflowing the Doom frame table in dehacked patches (DOS
 	dehacked's behavior).  Overwrite the weaponinfo table instead when
 	changes are made to the last element in states[].  Thanks to grazza
@@ -3286,147 +3438,147 @@
 	for pointing out that Chococlate Doom did not emulate this bug.
 
 2006-10-28 20:30:59 fraggle
-	
+
 	Explicitly support dehacked patches that overflow the ammo[] array
 	with an invalid ammo type, allowing weapons that decrease the max ammo
 	of other weapons.
 
 2006-10-28 01:23:11 fraggle
-	
+
 	Display a warning when setting dehacked fields that would overflow
 	buffers in Vanilla dehacked.  This should help pick up bugs like the
 	one in Batman Doom.
 
 2006-10-28 00:15:23 fraggle
-	
+
 	Allow multiple dehacked patches to be specified with the -deh command
 	line paramter, as with -file.
 
 2006-10-26 00:44:23 fraggle
-	
+
 	Allow F10 to exit in testcontrols mode.
 
 2006-10-25 21:04:58 fraggle
-	
+
 	"Always run" trick should only be when joyb_speed >= 10.  Use 29 as
 	the ideal value in setup as this works in Original, Ultimate and Final
 	Doom, Heretic, Hexen and Strife.  Thanks to Janizdreg for this.
 
 2006-10-25 19:12:08 fraggle
-	
+
 	Make the "test controls" option work - write the current config to
 	temporary config files and make Doom use these when executing it.
 
 2006-10-25 19:07:57 fraggle
-	
+
 	Don't print arguments read from response files - Vanilla Doom doesn't
 	do it.
 
 2006-10-24 23:30:19 rtc_marine
-	
+
 	update chocolate-setup codeblocks project
 
 2006-10-24 23:26:20 fraggle
-	
+
 	Don't rely on INSTALL_DIR for the Win32 build.
 
 2006-10-24 23:25:55 fraggle
-	
+
 	Add missing header for Win32 build.
 
 2006-10-24 21:07:32 fraggle
-	
+
 	Tweak capitalisation on the main menu to be more like setup.exe.
 
 2006-10-24 21:00:38 fraggle
-	
+
 	Escape WAD filenames passed to Doom with " quotes, to allow WAD
 	filenames with spaces.
 
 2006-10-24 20:58:39 fraggle
-	
+
 	Pass through config variables into response file when launching Doom.
 
 2006-10-24 20:50:00 fraggle
-	
+
 	Fix player name option in setup tool.
 
 2006-10-24 20:44:04 fraggle
-	
+
 	Make "hurt me plenty" the default skill.
 
 2006-10-24 20:32:26 fraggle
-	
+
 	Shut up compiler warnings.
 
 2006-10-24 20:23:16 fraggle
-	
+
 	Detect failures to initialise textscreen library and bomb out with an
 	error mess age.
 
 2006-10-24 00:15:24 fraggle
-	
+
 	Build command line parameters for starting multiplayer games and
 	joining multiplayer games.
 
 2006-10-24 00:14:43 fraggle
-	
+
 	Write newlines in response files to separate parameters.
 
 2006-10-23 23:27:10 fraggle
-	
+
 	Rename testconfig.[ch] to execute.[ch], add generalised framework for
 	launching Doom.  Make the "Save parameters and launch Doom" option on
 	the main menu work.
 
 2006-10-23 23:00:52 fraggle
-	
+
 	Add missing header.
 
 2006-10-23 19:32:26 fraggle
-	
+
 	Detect when keyboard variables are changed and convert back so that
 	the new values are saved to the config file.
 
 2006-10-23 19:16:02 fraggle
-	
+
 	Load configuration on startup and save on quit.  Functional setup
 	program!
 
 2006-10-23 19:00:30 fraggle
-	
+
 	Add m_argv.[ch] from Doom, fix up configfile.c so that it compiles
 	properly.  Add to build.
 
 2006-10-23 18:59:51 fraggle
-	
+
 	Shut up compiler warnings.
 
 2006-10-23 18:58:50 fraggle
-	
+
 	Change config variable names to be the same as used in Doom.
 
 2006-10-23 18:57:56 fraggle
-	
+
 	Change config variable names to be the same as used in Doom.
 
 2006-10-23 18:48:38 fraggle
-	
+
 	Move MakeDirectory function into m_misc.c.  Move configdir related
 	code into m_misc.c.
 
 2006-10-23 08:15:26 fraggle
-	
+
 	Add initial setup config file code (derived from the Doom config file
 	code).  Not currently in build.
 
 2006-10-23 08:13:16 fraggle
-	
+
 	Stackable clip areas (useful for a future implementation of scrollable
 	panes).
 
 2006-10-22 23:10:08 fraggle
-	
+
 	Standardise setup config variable names on the same variable names
 	used in Doom.  Add header files for source files where they are
 	needed.  Make variables static where appropriate.  General cleanups
@@ -3433,214 +3585,214 @@
 	etc.
 
 2006-10-22 18:17:15 fraggle
-	
+
 	Fix problem caused by use of 'long' type instead of 'int' type in
 	state_t structure: caused problems when using multiplayer on 64-bit
 	(thanks exp[x]).
 
 2006-10-22 18:13:12 fraggle
-	
+
 	Remove d_french.h from autotools build.
 
 2006-10-22 18:12:39 fraggle
-	
+
 	Catch failure to initialise video when calling SDL_Init.
 
 2006-10-18 02:07:28 fraggle
-	
+
 	Shut up warnings in w_wad.c.
 
 2006-10-18 01:55:49 fraggle
-	
+
 	Timer functionssss, precious!
 
 2006-10-18 01:51:11 fraggle
-	
+
 	Strip out CVS logs, RCS Id tags.
 
 2006-10-16 14:52:12 fraggle
-	
+
 	Reformat coding style file.  Add stuff about hungarian notation, jwz
 	tab characters link and an introduction giving a brief explanation for
 	the choices.
 
 2006-10-15 02:06:27 rtc_marine
-	
+
 	update code::blocks project
 
 2006-10-14 15:05:51 fraggle
-	
+
 	Refactor I_InitGraphics.
 
 2006-10-14 14:59:28 fraggle
-	
+
 	Disable the "loading from disk" icon on MacOS.
 
 2006-10-14 14:26:17 fraggle
-	
+
 	Display drone indicator on the netgame waiting screen if drones are
 	connected.
 
 2006-10-14 13:55:02 fraggle
-	
+
 	Display a different message from the normal WAD directory warning if
 	players are mixing Freedoom/Original IWADs.
 
 2006-10-14 12:53:08 fraggle
-	
+
 	Change wording on netgame warning message.
 
 2006-10-12 18:34:32 fraggle
-	
+
 	Shut up compiler warnings for setup.
 
 2006-10-12 00:03:19 fraggle
-	
+
 	Shut up compiler warnings
 
 2006-10-11 23:55:06 fraggle
-	
+
 	Shut up compiler warnings.
 
 2006-10-10 03:00:52 fraggle
-	
+
 	Remove d_french.h, other i18n-related stuff.  If people want i18n, it
 	should be done with dehacked and/or wad replacements - see my british
 	english translation in the idgames archive.
 
 2006-10-07 01:59:03 fraggle
-	
+
 	Add float spin control and use it for the acceleration controller in
 	setup.
 
 2006-10-06 23:22:10 rtc_marine
-	
+
 	update Code::Blocks project for new md5 code.
 
 2006-10-06 18:10:16 fraggle
-	
+
 	Alternate textscreen palette that fits the Tango desktop guidelines:
 	see http://uwstopia.nl/blog/2006/07/tango-terminal
 
 2006-10-06 18:06:05 fraggle
-	
+
 	Send deh/wad md5sums to players at the waiting screen.  Display a
 	warning on the waiting screen if the checksums differ from the other
 	players.
 
 2006-10-06 08:02:42 fraggle
-	
+
 	Send deh/wad checksums to the server when connecting.
 
 2006-10-05 23:12:22 fraggle
-	
+
 	Dehacked information checksum generation
 
 2006-10-05 19:55:07 fraggle
-	
+
 	WAD directory checksum generation code
 
 2006-10-05 18:19:43 fraggle
-	
+
 	Prevent against deadlock where client and server are both stuck
 	waiting for each other to send data.
 
 2006-10-05 18:18:14 fraggle
-	
+
 	Packet loss simulation code for test.
 
 2006-09-30 11:52:25 fraggle
-	
+
 	Only allow drone mode when connecting.
 
 2006-09-30 11:22:48 fraggle
-	
+
 	Make the server stop sending if one of the clients stops
 	acknowledging.  Fix check on number of players on connect.
 
 2006-09-29 22:38:21 fraggle
-	
+
 	Working -left and -right options!
 
 2006-09-29 22:25:13 fraggle
-	
+
 	Working drone clients!
 
 2006-09-29 12:49:30 fraggle
-	
+
 	Use TXT_AddWidgets in setup for greatly enhanced readability.
 
 2006-09-28 18:27:22 fraggle
-	
+
 	Add missing ellipsis to "Add WADs..."
 
 2006-09-27 00:52:50 fraggle
-	
+
 	Switch over a bunch of code to TXT_NewButton2 - improves readability.
 
 2006-09-27 00:50:39 fraggle
-	
+
 	When invoking chocolate doom, run it from the install dir on Unix.
 
 2006-09-27 00:50:06 fraggle
-	
+
 	Add "join game" dialog.
 
 2006-09-27 00:49:22 fraggle
-	
+
 	Move the "always run" checkbox to the movement section.
 
 2006-09-27 00:48:23 fraggle
-	
+
 	Add TXT_NewButton2 for creating a button with a callback (for
 	convenience).
 
 2006-09-27 00:47:27 fraggle
-	
+
 	Add TXT_AddWidgets for adding multiple widgets to a table.
 
 2006-09-26 00:22:56 fraggle
-	
+
 	Reduce the minimum width of the key/mouse input widgets and align the
 	mouse config dialog a bit nicer.
 
 2006-09-26 00:16:49 fraggle
-	
+
 	Add "Always run" checkbox to keyboard options.
 
 2006-09-26 00:09:32 fraggle
-	
+
 	Make examples call TXT_Shutdown before quit.
 
 2006-09-25 23:13:56 rtc_marine
-	
+
 	Update Code::Blocks setup project with added files
 
 2006-09-25 22:45:30 fraggle
-	
+
 	Fix colors.
 
 2006-09-25 21:47:11 fraggle
-	
+
 	Don't disable screen melt entirely in testcontrols mode; just on
 	startup.
 
 2006-09-25 21:42:37 fraggle
-	
+
 	Don't allow function keys to be used in testcontrols mode.
 
 2006-09-25 21:41:59 fraggle
-	
+
 	Remove low-pass filter on mouse for testcontrols mode - seems to work
 	ok with real mice.
 
 2006-09-25 21:31:42 fraggle
-	
+
 	Add "test" window actions to the keyboard/mouse dialogs to invoke
 	Chocolate Doom with the -testcontrols option.
 
 2006-09-25 19:04:29 fraggle
-	
+
 	Add "test controls" mode - for setup.exe in the future.  Start
 	straight into the game with no melt effect and display a box showing
 	mouse speed to allow the threshold to be set easily.  When escape is
@@ -3647,102 +3799,102 @@
 	pressed, quit straight away.
 
 2006-09-24 14:27:55 fraggle
-	
+
 	Add "extra parameters" dialog for specifying exra command-line
 	parameters.  Move this and "UDP port" setting to a separate "Advanced"
 	section.
 
 2006-09-24 14:08:18 fraggle
-	
+
 	Add "time limit" control in multiplayer settings dialog.
 
 2006-09-24 14:07:30 fraggle
-	
+
 	Convenience function for creating a horizontal box.
 
 2006-09-24 14:06:32 fraggle
-	
+
 	Debug code for drawing an ASCII chart.
 
 2006-09-24 14:05:44 fraggle
-	
+
 	Use proper arrow characters on spin controls and change their color.
 
 2006-09-24 14:04:40 fraggle
-	
+
 	Fix declaration of TXT_NewWindowSelectAction
 
 2006-09-22 23:43:28 fraggle
-	
+
 	Call the SpechitOverrun _after_ incrementing numspechit.  Thanks to
 	Quasar for pointing out this mistake.
 
 2006-09-22 23:12:50 fraggle
-	
+
 	Continue to build things if we fail to update chocolate_doom_icon.c -
 	display a warning about missing Python Image library.
 
 2006-09-22 21:32:00 fraggle
-	
+
 	Add DEH_String() conversions on more strings that are not being
 	converted.
 
 2006-09-22 21:30:48 fraggle
-	
+
 	Fix warning.
 
 2006-09-22 19:24:53 fraggle
-	
+
 	Add the ability to type in values for spin controls, like with normal
 	input boxes.
 
 2006-09-22 13:16:00 fraggle
-	
+
 	Fix warning about initialiser.
 
 2006-09-21 22:49:26 fraggle
-	
+
 	Set default sound devices to SNDDEVICE_SB, so that sfx and music are
 	on by default.
 
 2006-09-21 19:25:55 fraggle
-	
+
 	Rename Accept to Select.
 
 2006-09-21 19:21:16 fraggle
-	
+
 	Add compatibility options dialog.
 
 2006-09-21 19:20:45 fraggle
-	
+
 	Add ENDOOM and startup delay to display settings dialog.
 
 2006-09-21 17:25:10 fraggle
-	
+
 	Fix some warnings in textscreen code.
 
 2006-09-21 12:49:13 fraggle
-	
+
 	Use NULL for initialising pointers rather than 0.
 
 2006-09-21 12:48:38 fraggle
-	
+
 	Use DEFAULT_INT enum value rather than 0.
 
 2006-09-21 12:47:56 fraggle
-	
+
 	"\0" != NULL
 
 2006-09-21 12:13:28 rtc_marine
-	
+
 	Fix a lot of warnings (for fussy compilers) and one always-true check
 
 2006-09-21 10:11:58 fraggle
-	
+
 	Add new codeblocks build files to dist.
 
 2006-09-21 05:25:49 rtc_marine
-	
+
 	Code::Blocks project and workspace.
 	* Rename workspace appropriately in editor.
 	* Update project files for new spin control and fix compilation of
@@ -3752,98 +3904,98 @@
 	  anything.
 
 2006-09-20 20:04:02 fraggle
-	
+
 	Make sure modified copyright banners always end in a newline.  If they
 	don't, add one.  This fixes av.wad (thanks to myk for reporting).
 
 2006-09-20 19:15:32 fraggle
-	
+
 	Fill in some default values for the player name and the chat macros
 	(using the traditional defaults)
 
 2006-09-20 19:06:34 fraggle
-	
+
 	Add sound config dialog.  Convert some of the mouse settings to use
 	spin controls.
 
 2006-09-20 19:05:10 fraggle
-	
+
 	Add spin control widget.
 
 2006-09-20 14:15:55 fraggle
-	
+
 	Change the default optimisation level to -O2 and add
 	--enable-penis-extension to configure.in.
 
 2006-09-20 12:47:24 fraggle
-	
+
 	Add multiplayer configuration dialog.
 
 2006-09-20 11:49:19 fraggle
-	
+
 	Remove tab characters :-)
 
 2006-09-20 11:47:13 fraggle
-	
+
 	Add HACKING file with guidelines for Chocolate Doom hackers.
 
 2006-09-20 11:27:22 fraggle
-	
+
 	Fix code style :-)
 
 2006-09-20 07:08:37 rtc_marine
-	
+
 	add extra defines when building don't crash if numlumps = 0 (which is
 	caused when an iwad has an invalid path)
 
 2006-09-20 01:06:21 fraggle
-	
+
 	Add "Enable mouse" checkbox to mouse config dialog.  Reorder options.
 
 2006-09-20 00:51:54 fraggle
-	
+
 	Fix chocolate-setup warnings.
 
 2006-09-20 00:49:20 fraggle
-	
+
 	Fix textscreen warnings.
 
 2006-09-20 00:24:29 fraggle
-	
+
 	Turn on -Wall as well.
 
 2006-09-20 00:20:14 fraggle
-	
+
 	'widgets' variable was used uninitialised.  For some reason this
 	didn't always crash!
 
 2006-09-19 23:14:55 fraggle
-	
+
 	Build with debugging symbols by default.
 
 2006-09-19 22:26:52 fraggle
-	
+
 	Move the grab mouse setting to the mouse config dialog.
 
 2006-09-19 22:21:30 fraggle
-	
+
 	New display settings dialog!
 
 2006-09-19 22:13:56 fraggle
-	
+
 	Check column is valid when finding a selectable column.  Fixes weird
 	scrolling behavior.
 
 2006-09-19 21:12:27 fraggle
-	
+
 	Set mouse button defaults.
 
 2006-09-19 04:38:15 rtc_marine
-	
+
 	make the icon work in the client binary
 
 2006-09-19 00:34:17 rtc_marine
-	
+
 	Code::Blocks projects:
 	* fixed directory locations
 	* minor enhancements to project building and locations of object files
@@ -3851,93 +4003,93 @@
 	* update workspace to accomodate chocolate-server project
 
 2006-09-18 23:20:23 fraggle
-	
+
 	Level select dialog.
 
 2006-09-18 23:19:30 fraggle
-	
+
 	Fix TXT_SelectWidgets with NULL spacers.
 
 2006-09-18 23:19:00 fraggle
-	
+
 	Add function to set button label.
 
 2006-09-18 13:13:40 fraggle
-	
+
 	Repeat key presses when the key is held down - thanks to Mad_Mac for
 	this one :-)
 
 2006-09-17 21:37:26 fraggle
-	
+
 	Split off query data into a net_querydata_t structure in
 	net_structrw.c
 
 2006-09-17 19:01:16 fraggle
-	
+
 	Fix local LAN queries.
 
 2006-09-17 18:01:33 fraggle
-	
+
 	Always wait for a keypress before closing the ENDOOM window; do not
 	close it automatically.
 
 2006-09-17 15:33:49 fraggle
-	
+
 	Update TODO list :-)
 
 2006-09-16 01:20:09 fraggle
-	
+
 	Undo previous commit: 'comport' and 'showmessages' are only generated
 	by setup.exe.
 
 2006-09-16 01:04:59 fraggle
-	
+
 	Preserve 'comport' variable in configuration files even though it is
 	unused.  Add 'showmessages' which is a duplicate of 'show_messages'
 	but is how Vanilla Doom behaves!
 
 2006-09-16 00:47:12 fraggle
-	
+
 	Interpret the snd_sfxdevice and snd_musicdevice values in the
 	configuration file and act the same as Vanilla Doom.
 
 2006-09-12 11:03:57 fraggle
-	
+
 	Fix Z_FreeTags in z_native.c (chains were not set to NULL when freed).
 
 2006-09-11 09:48:57 fraggle
-	
+
 	Add codeblocks project files; thanks to Russell Rice.
 
 2006-09-09 22:44:51 fraggle
-	
+
 	Fix the -nomusic parameter.
 
 2006-09-09 20:11:05 fraggle
-	
+
 	Add command line arguments to main() in textscreen examples.
 
 2006-09-09 20:05:27 fraggle
-	
+
 	Add config.h for a possible MSVC build in the future.  Add
 	mkinstalldirs to the list of files included in distribution.
 
 2006-09-09 17:52:01 fraggle
-	
+
 	Include SDL.h in the textscreen headers; the SDL headers need to be
 	included where main() is defined.
 
 2006-09-09 17:48:09 fraggle
-	
+
 	Add reference counts on callback tables so that if a callback destroys
 	the widget that owns the callback the program doesnt crash.
 
 2006-09-09 16:49:39 fraggle
-	
+
 	Remove hack accidentally committed that always updates the palette
 
 2006-09-02 20:10:07 fraggle
-	
+
 	Add -nwtmerge option, which behaves the same as NWT's -merge option.
 	What this does is load a PWAD, then search through the IWAD sprites
 	list, removing lumps where there are lumps of the same name in the
@@ -3948,20 +4100,20 @@
 	handle.
 
 2006-09-02 20:02:11 fraggle
-	
+
 	Allow loading dehacked 2.3 patches.
 
 2006-09-02 20:01:35 fraggle
-	
+
 	Don't allow \0 in dehacked strings read with DEH_ReadLine.
 
 2006-09-01 21:45:45 fraggle
-	
+
 	Sync the -loadgame parameter across all clients connected to a server.
 	Loading/saving multiplayer games should all work now.
 
 2006-09-01 21:07:25 fraggle
-	
+
 	Better spechits emulation.  Remove support for emulating the
 	higher-memory spechits overruns, as they will overwrite pointers with
 	garbage and crash the game.  Change the spechits base address to one
@@ -3970,7 +4122,7 @@
 	explicitly specified if necessary.
 
 2006-08-31 23:11:08 fraggle
-	
+
 	Call R_ExecuteSetViewSize immediately after calling I_InitGraphics.
 	I_InitGraphics can change where screens[0] points to, so the player
 	can end up with a blank screen sometimes.  Thanks to Kurn for
@@ -3977,42 +4129,42 @@
 	reporting this.
 
 2006-08-31 21:40:48 fraggle
-	
+
 	Add missing copyright notices to textscreen and setup files.
 
 2006-08-31 19:31:10 fraggle
-	
+
 	Add new chocolate-setup source files into build.
 
 2006-08-31 19:15:36 fraggle
-	
+
 	Build man/ and setup/ directories from main makefile.
 
 2006-08-31 19:15:16 fraggle
-	
+
 	Add manual pages to build
 
 2006-08-31 19:14:45 fraggle
-	
+
 	Fix problem with 'c:\' in doom-options.in
 
 2006-08-31 19:14:22 fraggle
-	
+
 	Change the 'abort' button to a quit button on the main menu.  Change
 	the confirmation dialog to use 'abort'.  Working 'start network game'
 	button.
 
 2006-08-31 19:14:03 fraggle
-	
+
 	Add display.c with missing ConfigDisplay and multiplayer.c with
 	multiplayer game start window.
 
 2006-08-31 19:13:40 fraggle
-	
+
 	Add key and mouse input widgets for selecting keys and mouse buttons.
 
 2006-08-31 19:13:23 fraggle
-	
+
 	Check for 'ff_end' not 'ff_start' when displaying warning message
 	about merging flats.  Some old Vanilla WADs used ff_start..f_end to
 	add extra flats and this message should not be displayed for them.  Use
@@ -4019,106 +4171,106 @@
 	American spelling of 'behavior'.
 
 2006-08-31 19:13:04 fraggle
-	
+
 	Allow the demo size limit to be disabled through the config file.
 
 2006-08-31 19:12:43 fraggle
-	
+
 	Bomb out with an error when a dehacked string is set that is longer
 	than is possible in Vanilla Doom with normal dehacked.  Chocolate Doom
 	is unforgiving!
 
 2006-08-31 19:12:25 fraggle
-	
+
 	Use the new TXT_Sleep function in Doom.
 
 2006-08-31 19:12:05 fraggle
-	
+
 	Add dropdown listbox widget
 
 2006-08-31 19:11:47 fraggle
-	
+
 	Exit the main loop automatically after all windows are closed
 
 2006-08-31 19:11:26 fraggle
-	
+
 	Add window listener functions to allow spying on keys and mouse
 	buttons received by windows.  Emit a 'closed' signal when a window is
 	closed.  Allow windows to have no action buttons.
 
 2006-08-31 19:11:07 fraggle
-	
+
 	Change name of escape window actions to 'Close' and add a separate
 	'Abort' button creator.
 
 2006-08-31 19:10:49 fraggle
-	
+
 	Center the calculator in the window.
 
 2006-08-31 19:09:34 fraggle
-	
+
 	Add TXT_SelectWidget function to select a widget in a table,
 	TXT_SetColumnWidths to set table column widths.  Don't send key
 	presses to unselectable widgets.
 
 2006-08-31 19:09:25 fraggle
-	
+
 	Allow multiple callbacks for the same signal on widgets
 
 2006-08-31 19:09:17 fraggle
-	
+
 	Initialise string input boxes to not editing
 
 2006-08-31 19:08:43 fraggle
-	
+
 	More efficient TXT_Sleep function that puts the textscreen code to
 	sleep until an event is received or the screen needs to blink.
 
 2006-08-06 23:51:29 fraggle
-	
+
 	Bomb out with an error when trying to draw patches that go off the
 	screen, as Vanilla Doom does.
 
 2006-07-28 20:13:13 fraggle
-	
+
 	Try to convert MUS even if the MUS header is not present.  The new
 	code plays the deca.wad titlescreen music properly!
 
 2006-07-24 22:32:39 fraggle
-	
+
 	Oops :-)
 
 2006-07-22 17:43:12 fraggle
-	
+
 	New mus -> mid conversion code thanks to Ben Ryves
 	<benryves@benryves.com> This plays back a lot of music closer to
 	Vanilla Doom - eg.  tnt.wad map02
 
 2006-06-29 19:07:32 fraggle
-	
+
 	Add inverted checkboxes (tick in box when value is false)
 
 2006-06-29 19:05:32 fraggle
-	
+
 	Initial mouse configuration window.
 
 2006-06-29 10:05:54 fraggle
-	
+
 	Hugely refactor the response file loading code.  Allow arguments to be
 	enclosed in quotes; this allows long filenames with spaces in to be
 	specified with -file in response files.
 
 2006-06-21 20:08:20 fraggle
-	
+
 	Let the SDL parachute catch crashes and shut down properly.  Don't
 	crash after playing demos.
 
 2006-06-20 19:49:36 fraggle
-	
+
 	Add a fake nonfunctional key bindings configuration menu.
 
 2006-06-20 19:48:21 fraggle
-	
+
 	Always add a bit of padding inside windows (removes the need to add
 	padding explicitly in labels).  Set the window title from the desktop
 	title.  Only draw widget selection highlight in the window with focus
@@ -4125,61 +4277,61 @@
 	(top window).
 
 2006-06-18 23:54:48 fraggle
-	
+
 	Add deh_section_sound to dehacked sections list (thanks to rpeter on
 	the dw forums).
 
 2006-06-16 18:06:05 fraggle
-	
+
 	Add hash table for fast texture lookup; refactor P_GroupLines to use
 	an O(n) rather than O(n^2) algorithm: faster loading maps like sid.wad
 	map03
 
 2006-06-03 19:23:09 fraggle
-	
+
 	Stop sending data to the server when a connection drops.  Print a
 	message to the console as well.
 
 2006-06-03 17:12:08 fraggle
-	
+
 	Detect recursive calls to I_Error to prevent an infinite loop.
 
 2006-06-03 13:38:24 fraggle
-	
+
 	Bomb out with an error message if game options are specified to a
 	dedicated server.
 
 2006-06-02 21:50:51 fraggle
-	
+
 	Make clicking on "accept" action buttons send enter keypresses to the
 	window.
 
 2006-06-02 21:14:39 fraggle
-	
+
 	Make mouse button presses on widgets actually do useful things
 
 2006-06-02 20:52:01 fraggle
-	
+
 	Rearrange the buttons in the setup exit confirmation box.
 
 2006-06-02 20:45:41 fraggle
-	
+
 	Add utility functions to create "Abort" and "Accept" window actions
 
 2006-06-02 20:36:37 fraggle
-	
+
 	Draw the bottom separator in windows at the full window width.
 
 2006-06-02 20:32:48 fraggle
-	
+
 	Add initial code for a setup utility.
 
 2006-06-02 20:30:08 fraggle
-	
+
 	Update BUGS list.
 
 2006-06-02 20:29:24 fraggle
-	
+
 	textscreen: Rejig how the entire drawing process works.  Add a
 	recursive layout method that assigns the position and size of widgets
 	for the whole window before drawing.  Add another method that responds
@@ -4187,139 +4339,139 @@
 	specifying NULL as the title.
 
 2006-05-29 22:39:12 fraggle
-	
+
 	Add ability to make widgets right aligned or centered within tables.
 
 2006-05-29 22:02:38 fraggle
-	
+
 	Convert calculator example to struts
 
 2006-05-29 21:55:20 fraggle
-	
+
 	Add -autojoin command line parameter to automatically search a local
 	LAN for a server and join it.
 
 2006-05-29 21:04:08 fraggle
-	
+
 	Fix broadcast transmits (-search works!)
 
 2006-05-29 21:00:41 fraggle
-	
+
 	Add textscreen.h top level header to avoid having to include all txt_*
 	headers individually.
 
 2006-05-29 20:54:11 fraggle
-	
+
 	Allow struts to force height as well as width.  Hide "start game"
 	button for players which are not the game controller.
 
 2006-05-29 20:31:45 fraggle
-	
+
 	Shut up compiler warnings.
 
 2006-05-29 20:22:51 fraggle
-	
+
 	Add strut class to allow table column width to be forced.
 
 2006-05-29 14:25:38 fraggle
-	
+
 	Warp mouse to screen center (possibly fix joe's mouse problem).
 
 2006-05-29 12:19:53 fraggle
-	
+
 	Fix E1-3 intermission screen animations.
 
 2006-05-29 11:38:27 fraggle
-	
+
 	Add missing newline to message.
 
 2006-05-29 01:17:24 fraggle
-	
+
 	Change the mouse acceleration behavior to accelerate by multiplying by
 	a linear amount when a threshold is exceeded.
 
 2006-05-26 20:15:33 fraggle
-	
+
 	Switch netgame waiting screen to use the new text mode GUI system.
 
 2006-05-26 20:15:05 fraggle
-	
+
 	Add key description for spacebar.
 
 2006-05-26 16:37:09 fraggle
-	
+
 	Add an option to disable autoadjusting the video mode.
 
 2006-05-25 23:39:57 fraggle
-	
+
 	Put savegames in separate directories depending on the IWAD.
 
 2006-05-25 22:27:34 fraggle
-	
+
 	Allow NULL to be added to tables to specify a spacer (empty cell).
 
 2006-05-25 22:26:13 fraggle
-	
+
 	Allow the fg/bg colors to be set on labels.
 
 2006-05-25 22:07:14 fraggle
-	
+
 	Allow the fg/bg colors to be set on labels.
 
 2006-05-25 21:40:57 fraggle
-	
+
 	Build textscreen/ before textscreen/examples/
 
 2006-05-25 21:18:19 fraggle
-	
+
 	Add screenmultiply x4 mode.
 
 2006-05-24 23:51:36 fraggle
-	
+
 	Remove debug hack used for testing startup delay.
 
 2006-05-24 22:35:45 fraggle
-	
+
 	Move textscreen GUI demos into an examples/ subdir.
 
 2006-05-24 21:27:40 fraggle
-	
+
 	Add small calculator GUI demo.
 
 2006-05-24 20:08:58 fraggle
-	
+
 	Only allow digits to be typed in number input boxes.
 
 2006-05-23 23:56:28 fraggle
-	
+
 	Prevent crashes when loading savegames where mancubi were in the
 	middle of firing.
 
 2006-05-23 23:52:01 fraggle
-	
+
 	Add input box widget, and include in guitest.
 
 2006-05-23 23:51:09 fraggle
-	
+
 	Make TXT_GetChar return the unicode value of the key pressed.  For
 	text boxes.
 
 2006-05-23 20:33:35 fraggle
-	
+
 	Add a default action to close windows when escape is pressed.  Do not
 	make escape quit the program unless there are no open windows.  Add
 	TXT_ExitMainLoop().
 
 2006-05-23 12:46:09 fraggle
-	
+
 	Fix compiler warnings caused by missing includes.
 
 2006-05-23 01:25:36 fraggle
-	
+
 	Add actions demonstration to guitest.
 
 2006-05-23 01:07:02 fraggle
-	
+
 	Add window action class for action area labels at the bottom of
 	windows.  Adjust txt_table_t to expand tables to their maximum width
 	when they only have one column (ensures separators reach the window
@@ -4326,165 +4478,165 @@
 	edges).
 
 2006-05-23 01:05:05 fraggle
-	
+
 	Eat keypresses when pressing buttons.
 
 2006-05-23 01:04:27 fraggle
-	
+
 	Add TXT_GetKeyDescription() to provide descriptions of key codes.
 
 2006-05-22 20:25:19 fraggle
-	
+
 	Updated GUI test which demonstrates signals used to update a label.
 
 2006-05-22 20:23:28 fraggle
-	
+
 	Add TXT_SetLabel() function to set the label value.
 
 2006-05-22 19:51:21 fraggle
-	
+
 	Allow specifying the full path and filename when playing back demos.
 
 2006-05-22 12:59:11 fraggle
-	
+
 	CAST -> TXT_CAST_ARG, UNCAST -> TXT_UNCAST_ARG.
 
 2006-05-22 01:56:12 fraggle
-	
+
 	Add casting macros to allow for easy casts between types.
 
 2006-05-22 01:26:34 fraggle
-	
+
 	More signals to detect when checkboxes/radiobuttons are changed.
 
 2006-05-22 01:20:48 fraggle
-	
+
 	Add a signals architecture to allow callbacks on GUI events.  Make all
 	widget classes initialise widgets by calling TXT_InitWidget.
 
 2006-05-21 22:01:46 fraggle
-	
+
 	Reformat source files in Makefile.am.
 
 2006-05-21 21:58:24 fraggle
-	
+
 	Add radio button class.
 
 2006-05-21 21:56:28 fraggle
-	
+
 	Initialise the table selection on table creation.
 
 2006-05-21 01:07:11 fraggle
-	
+
 	Always select a valid widget in a table before drawing the table.
 
 2006-05-20 22:37:34 fraggle
-	
+
 	Add missing free() call.
 
 2006-05-20 22:37:07 fraggle
-	
+
 	Updated guitest.
 
 2006-05-20 22:36:28 fraggle
-	
+
 	Add label class.
 
 2006-05-20 22:01:04 fraggle
-	
+
 	Make all windows be tables with one column.
 
 2006-05-20 21:49:50 fraggle
-	
+
 	Add table class.  Allow widgets with heights of more than one line.
 
 2006-05-20 18:37:57 fraggle
-	
+
 	Checkbox class
 
 2006-05-20 17:34:34 fraggle
-	
+
 	Add main loop function and forward key presses to widgets.
 
 2006-05-20 17:24:58 fraggle
-	
+
 	Make Translatekey static.
 
 2006-05-20 17:16:35 fraggle
-	
+
 	Split off keyboard key definitions to a separate file.
 
 2006-05-20 16:45:36 fraggle
-	
+
 	Clip windows against the workspace boundaries.
 
 2006-05-20 16:15:17 fraggle
-	
+
 	Add selectable and visible properties to widgets.  Allow the position
 	of windows to be set based on position of
 	top/bottom/center,left/right,center coordinates.
 
 2006-05-19 21:03:49 fraggle
-	
+
 	Initialise tracers to NULL on savegame load - fixes a problem with
 	revenant tracers in savegames.
 
 2006-05-19 21:01:59 fraggle
-	
+
 	Add a config file setting to allow a delay to be specified on startup.
 
 2006-05-19 20:57:59 fraggle
-	
+
 	Split off text mode gui desktop code into a separate file.  Rename
 	some of the functions in txt_gui.c.
 
 2006-05-18 20:48:03 fraggle
-	
+
 	Add TXT_SetDesktopTitle()
 
 2006-05-18 19:55:24 fraggle
-	
+
 	Make TXT_AddWidget take a NULL pointer so different widget types can
 	be passed to it.
 
 2006-05-18 19:48:24 fraggle
-	
+
 	Initial working text-mode GUI framework.
 
 2006-05-11 13:03:02 fraggle
-	
+
 	Allow port to be specified for client to connect to through -port or
 	-connect hostname:port.
 
 2006-05-08 22:54:32 fraggle
-	
+
 	Allow -3 scale.
 
 2006-05-06 20:22:31 fraggle
-	
+
 	Respect the use_mouse value in configuration files.
 
 2006-05-06 20:14:08 fraggle
-	
+
 	Add back -nomouse command line parameter.
 
 2006-05-05 20:49:34 fraggle
-	
+
 	Syncronise the -timer/-avg parameters across all clients to avoid
 	desyncs.
 
 2006-05-03 20:23:54 fraggle
-	
+
 	Handle divide by zero in R_PointToDist: fixes crash in udm1.wad
 
 2006-05-03 19:54:08 fraggle
-	
+
 	Allow .mid files in PWADs (via including a MID inside a music lump).
 	This actually seems to work in Vanilla, as long as the MID is less
 	than ~96k.  This isn't perfect.
 
 2006-04-28 18:31:21 fraggle
-	
+
 	Fix sky behavior to be like Vanilla Doom, ie.  Doom II skies never
 	change unless the player restores from a saved game.  Thanks to
 	sofaking for bringing this to my attention.  There is more information
@@ -4491,354 +4643,354 @@
 	here: http://doom.wikia.com/wiki/Sky_never_changes_in_Doom_II
 
 2006-04-28 18:20:05 fraggle
-	
+
 	Fix spacing of the devparm mode dots!
 
 2006-04-14 16:25:42 fraggle
-	
+
 	Add ability to play using the Vanilla player sync code
 
 2006-04-14 16:24:32 fraggle
-	
+
 	Fix netgame respawn bug on MAP02 (may be 64-bit related)
 
 2006-04-09 03:54:21 fraggle
-	
+
 	Add change missed from last commit
 
 2006-04-09 03:50:34 fraggle
-	
+
 	Broadcast searches (currently broken)
 
 2006-04-08 14:30:33 fraggle
-	
+
 	Forgot to add net_query.c to Makefile.am
 
 2006-04-06 21:49:16 fraggle
-	
+
 	Debug code for tracking bandwidth usage
 
 2006-04-06 21:48:35 fraggle
-	
+
 	Add the ability to query the current state of servers, and '-query'
 	command line option to do so.
 
 2006-04-06 20:44:06 fraggle
-	
+
 	Save demos when quitting normally - it is no longer neccessary to
 	press 'q' to end a demo! Thanks to the 10,000 people who reported this
 	bug.
 
 2006-04-06 20:31:45 fraggle
-	
+
 	Use BACKUPTICS everywhere.  Remove NET_TICCMD_QUEUE_SIZE
 
 2006-04-06 18:53:43 fraggle
-	
+
 	Sanity check data received by the server.  Send version string earlier
 	in SYN packets to allow the fields that follow to be changed later on
 	if necessary.
 
 2006-04-01 21:16:43 fraggle
-	
+
 	Don't add modules to the server context until after they have been
 	initialised - avoids crash when bombing out in the init function
 
 2006-03-31 17:15:54 fraggle
-	
+
 	Remove reference to nonexistent i_main.h
 
 2006-03-30 20:25:12 fraggle
-	
+
 	Increase the default heap size to 16MB, and add a -mb parameter to
 	allow the heap size to be controlled from the command line.  Who
 	doesn't have 16MB of memory these days?
 
 2006-03-30 20:16:06 fraggle
-	
+
 	When all players leave a server, start accepting new connections
 	again.  This lets people run proper dedicated servers.
 
 2006-03-30 20:13:20 fraggle
-	
+
 	Add missing #include
 
 2006-03-30 20:08:37 fraggle
-	
+
 	Split off timer code into separate i_timer.c file.  Add d_dedicated.c
 	and build chocolate-server, a standalone dedicated server.
 
 2006-03-30 19:17:58 fraggle
-	
+
 	Dedicated server mode.
 
 2006-03-30 01:23:20 fraggle
-	
+
 	Remove hard-coded use of network modules from server code.
 
 2006-03-29 19:22:37 fraggle
-	
+
 	Removing dummy file.
 	
 	Goodbye, #chocolate-doom :-(
 
 2006-03-29 19:21:51 fraggle
-	
+
 	Dummy commit to test the new IRC monitoring bot
 	
 	Hello #chocolate-doom!
 
 2006-03-29 16:59:39 fraggle
-	
+
 	Removing dummy.txt
 
 2006-03-29 16:58:54 fraggle
-	
+
 	This is a message.
 	
 	A multiline commit message.
 
 2006-03-29 16:58:09 fraggle
-	
+
 	Dummy change
 
 2006-03-29 16:56:36 fraggle
-	
+
 	Dummy commit
 
 2006-03-28 00:24:03 fraggle
-	
+
 	Update NEWS file, incorporating changes from v0.1.4 as well.
 
 2006-03-27 23:56:14 fraggle
-	
+
 	Fix divide by zero in 1427uv01.lmp caused by the use of int instead of
 	angle_t in R_ScaleFromGlobalAngle()
 
 2006-03-25 21:50:32 fraggle
-	
+
 	New feature to allow compiling without multiplayer support
 
 2006-03-25 21:47:13 fraggle
-	
+
 	Improve Z_CheckHeap()
 
 2006-03-25 20:08:58 fraggle
-	
+
 	Fix builds with FEATURE_DEHACKED disabled
 
 2006-03-25 18:28:48 fraggle
-	
+
 	Run the menu at the correct speed
 
 2006-03-24 21:43:43 fraggle
-	
+
 	Adjust anti-CPU-hogging sleep times.
 
 2006-03-24 21:20:36 fraggle
-	
+
 	Add "native allocator" message to distinguish from z_zone.c
 
 2006-03-24 20:40:08 fraggle
-	
+
 	Call W_GenerateHashTable to generate the lumpname hashtable.  Do not
 	constantly look up MAP01 to see if this is a store demo.
 
 2006-03-24 20:39:28 fraggle
-	
+
 	Ooops!
 
 2006-03-24 20:39:08 fraggle
-	
+
 	Generate a hash table for fast lump name lookups.
 
 2006-03-24 19:59:03 fraggle
-	
+
 	Add a second implementation of the zone memory system which just uses
 	malloc() and free() as a backend.  This will be useful for running
 	dedicated servers (no need to allocate an entire heap).
 
 2006-03-24 19:55:04 fraggle
-	
+
 	Make memblock_t internal to z_zone.c.  Adjust Z_ChangeTag #define to
 	cope with this.
 
 2006-03-24 17:35:17 fraggle
-	
+
 	Update TODO.  Remove finished things (64-bit, netcode) and stuff which
 	will never be done (z_zone short-circuit).  Add some new TODOs.
 
 2006-03-24 16:51:28 fraggle
-	
+
 	Use "sizeof(line_t *)" not "4".  Fixes 64-bit builds.
 
 2006-03-23 18:29:28 fraggle
-	
+
 	Remove "default sfx volume" message: this is confusing now, and isn't
 	in Vanilla anyway.
 
 2006-03-23 18:25:56 fraggle
-	
+
 	Fix sound range
 
 2006-03-23 17:43:15 fraggle
-	
+
 	Separate variables for config file volume levels and sound API
 	internal volume levels (this is how the Vanilla code behaves).  Fixes
 	sound behavior on level 8!
 
 2006-03-19 00:12:00 fraggle
-	
+
 	Smarter fullscreen setting adjustment
 
 2006-03-18 23:42:03 fraggle
-	
+
 	Auto adjust settings when running fullscreen so that we run in a valid
 	video mode.
 
 2006-03-18 23:24:04 fraggle
-	
+
 	Fix music startup/shutdown
 
 2006-03-18 23:19:14 fraggle
-	
+
 	Catch failures to initialise SDL_mixer properly, and fail gracefully
 	rather than crashing the game.
 
 2006-03-18 21:22:09 fraggle
-	
+
 	Add missing SDL.h include for i_main.c - fixes play under MacOS X!
 
 2006-03-17 18:36:50 fraggle
-	
+
 	Fix windres detection
 
 2006-03-16 22:17:45 fraggle
-	
+
 	Better fix for the intermission screen crash.  Don't call WI_End until
 	after we change to gamestate != GS_INTERMISSION
 
 2006-03-16 21:46:59 fraggle
-	
+
 	Fix crasher when starting new levels, because the intermissions code
 	tries to draw patches which have been unloaded (WI_Drawer runs after
 	WI_End, because it is waiting for the game loop to load the new level)
 
 2006-03-15 18:53:06 fraggle
-	
+
 	fix DEH_UNSUPPORTED_MAPPING, add frame::codepointer as an unsupported
 	mapping
 
 2006-03-15 18:52:31 fraggle
-	
+
 	Check for IWADs in the same order as Vanilla Doom
 
 2006-03-14 19:17:14 fraggle
-	
+
 	Detect the presence of 'windres' properly
 
 2006-03-11 21:34:19 fraggle
-	
+
 	Shut up compiler warnings
 
 2006-03-11 21:28:21 fraggle
-	
+
 	Fix bug with corruption of long player names.  Remove tab characters.
 
 2006-03-10 01:49:25 fraggle
-	
+
 	Add fullscreen "letterbox" mode for people without a functioning
 	320x200 video mode.
 
 2006-03-07 19:02:08 fraggle
-	
+
 	If running with -timedemo, do not generate new ticcmds through
 	NetUpdate.
 
 2006-03-07 18:25:32 fraggle
-	
+
 	Indicate when a message has been received from the server.
 
 2006-03-07 18:24:12 fraggle
-	
+
 	Store the reason when a connection is disconnected, and display a
 	message indicating when clients time out from the server.
 
 2006-03-07 12:57:52 fraggle
-	
+
 	Convert NET_CL_SafePuts to NET_SafePuts, and print rejection messages
 	from the server.
 
 2006-03-07 12:46:52 fraggle
-	
+
 	Generic console message mechanism.  Inform all players when recording
 	a low-res demo.
 
 2006-03-06 20:48:07 fraggle
-	
+
 	Give a server-side warning when recording low resolution demos.
 
 2006-03-06 20:44:43 fraggle
-	
+
 	Do not run TryRunTics until after we have started demo recording.  Fix
 	crash when recording demos.
 
 2006-03-03 19:18:48 fraggle
-	
+
 	Fix loss of precision when turning with mouse.
 
 2006-03-02 01:01:05 fraggle
-	
+
 	Add unsigned qualifiers on swapping functions, to stop problems on
 	MacOS X.
 
 2006-03-02 00:57:25 fraggle
-	
+
 	Remove redundant code, shut up warnings
 
 2006-03-02 00:10:23 fraggle
-	
+
 	_Really_ fix -nomonsters.
 
 2006-03-02 00:03:48 fraggle
-	
+
 	Rearrange client connect code; fix name resolving under windows
 
 2006-03-01 23:36:44 fraggle
-	
+
 	Detect turbo mode more accurately
 
 2006-03-01 20:02:53 fraggle
-	
+
 	Send the nomonsters flag on netgame start.
 
 2006-03-01 17:07:39 fraggle
-	
+
 	Don't melt the screen on startup
 
 2006-02-27 21:46:35 fraggle
-	
+
 	Fix consistency checks
 
 2006-02-27 20:11:14 fraggle
-	
+
 	Fix problem starting games with four players
 
 2006-02-27 19:39:26 fraggle
-	
+
 	Quit with an error when unable to resolve an address
 
 2006-02-27 17:57:55 fraggle
-	
+
 	Fix chat mode
 
 2006-02-27 17:57:39 fraggle
-	
+
 	Reduce the maximum latency to stop the game pausing and shooting
 	ahead.
 
 2006-02-27 16:31:08 fraggle
-	
+
 	Working client sync: adjust the clock to try to match the latency of
 	other players.  Allow the menu ticker to run even if the main game
 	ticker doesn't run.  Remove time request/response code (now using game
@@ -4845,58 +4997,58 @@
 	latency).
 
 2006-02-26 02:29:47 fraggle
-	
+
 	Change data files to binary files
 
 2006-02-24 19:14:59 fraggle
-	
+
 	Fix -extratics
 
 2006-02-24 19:14:22 fraggle
-	
+
 	Remove redundant stuff relating to the old network code
 
 2006-02-24 08:19:45 fraggle
-	
+
 	Only advance the receive window if we have received ticcmds from all
 	connected players.
 
 2006-02-23 23:42:00 fraggle
-	
+
 	Replace -client with -connect which takes a hostname/ip to connect to.
 
 2006-02-23 23:41:13 fraggle
-	
+
 	Track memory used by packet data to help detect memory leaks
 
 2006-02-23 23:40:30 fraggle
-	
+
 	Free back packets sent to the server after parsing them
 
 2006-02-23 20:53:03 fraggle
-	
+
 	Detect when clients are disconnected from the server, recover cleanly
 	and display a message.
 
 2006-02-23 20:31:09 fraggle
-	
+
 	Set ticdup from the command line with the -dup parameter.
 
 2006-02-23 20:22:57 fraggle
-	
+
 	Do not allow tics to buffer up in single player (stops the gun
 	instantly appearing on level start)
 
 2006-02-23 19:15:18 fraggle
-	
+
 	Fix crash when NOT recording lowres
 
 2006-02-23 19:12:43 fraggle
-	
+
 	Set maketic-gametic lag back to 1 second.
 
 2006-02-23 19:12:02 fraggle
-	
+
 	Add lowres_turn to indicate whether we generate angleturns which are
 	8-bit as opposed to 16-bit.  This is used when recording demos without
 	-longtics enabled.  Sync this option between clients in a netgame, so
@@ -4904,19 +5056,19 @@
 	lowres.
 
 2006-02-23 18:20:29 fraggle
-	
+
 	Fix bugs in resend code for server->client data
 
 2006-02-23 18:19:05 fraggle
-	
+
 	Add lowres_turn parameter to net_full_ticcmd_t structure r/w functions
 
 2006-02-22 18:35:55 fraggle
-	
+
 	Packet resends for server->client gamedata
 
 2006-02-19 13:42:27 fraggle
-	
+
 	Move tic number expansion code to common code.  Parse game data
 	packets received from the server.  Strip down d_net.[ch] to work
 	through the new networking code.  Remove game sync code.  Remove
@@ -4923,23 +5075,23 @@
 	i_net.[ch] as it is no longer needed.  Working networking!
 
 2006-02-19 13:38:59 fraggle
-	
+
 	Increase the size of BACKUPTICS to deal with heavy lag
 
 2006-02-17 21:42:13 fraggle
-	
+
 	Remove debug code
 
 2006-02-17 21:40:52 fraggle
-	
+
 	Full working resends for client->server comms
 
 2006-02-17 20:15:16 fraggle
-	
+
 	Request resends for missed packets
 
 2006-02-16 01:12:28 fraggle
-	
+
 	Define a new type net_full_ticcmd_t, a structure containing all
 	ticcmds for a given tic.  Store received game data in a receive
 	window.  Add send queues for clients and add data from the receive
@@ -4946,153 +5098,153 @@
 	window to generate complete sets of ticcmds.
 
 2006-02-15 12:57:58 fraggle
-	
+
 	Remove the savegame buffer entirely.  Keep the old savegame size limit
 	bug add a "vanilla_savegame_limit" config file option which allows the
 	limit to be disabled if necessary.
 
 2006-02-03 18:41:26 fraggle
-	
+
 	Support NWT-style WAD merging (-af and -as command line parameters).
 	Restructure WAD loading so that merged WADs are always loaded before
 	normal PWADs.  Remove W_InitMultipleFiles().
 
 2006-01-30 08:12:49 fraggle
-	
+
 	Add manpage
 
 2006-01-30 08:06:29 fraggle
-	
+
 	Install into the games directory, not bin (Thanks to Jon Dowland)
 
 2006-01-29 15:07:12 fraggle
-	
+
 	Shut up compiler warnings
 
 2006-01-29 15:05:05 fraggle
-	
+
 	Allow map things of type <= 0 - these are ignored by Vanilla Doom.
 	Provides compatibility with plutonia.wad map12.
 
 2006-01-28 20:03:09 fraggle
-	
+
 	Avoid conflict with stdc time function
 
 2006-01-27 18:23:08 fraggle
-	
+
 	Exit with an error when playing a demo with the wrong version, like
 	Vanilla Doom
 
 2006-01-27 18:21:35 fraggle
-	
+
 	Fix compiler warning due to missing include
 
 2006-01-27 18:18:41 fraggle
-	
+
 	dehacked replacements for switch texture names
 
 2006-01-25 17:38:40 fraggle
-	
+
 	Allow overriding the animation texture/flat names via dehacked
 
 2006-01-24 01:46:08 fraggle
-	
+
 	More endianness fixes
 
 2006-01-23 21:56:18 fraggle
-	
+
 	Include the config header so that endianness is dealt with correctly
 
 2006-01-23 01:40:24 fraggle
-	
+
 	Fix bug when expanding large sound effects with odd sample rates
 
 2006-01-23 00:47:16 fraggle
-	
+
 	Rearrange the order of startup code to allow replacing the IWAD
 	filename via dehacked
 
 2006-01-23 00:37:14 fraggle
-	
+
 	Make the network waiting screen not thrash the CPU so much.
 
 2006-01-23 00:17:43 fraggle
-	
+
 	Allow changing the names of level lump names via dehacked.
 
 2006-01-23 00:12:25 fraggle
-	
+
 	Fix dehacked sky replacement
 
 2006-01-23 00:07:56 fraggle
-	
+
 	More dehacked text substitutions for finale text names
 
 2006-01-22 23:48:00 fraggle
-	
+
 	Allow changing of all menu graphic lumps via dehacked
 
 2006-01-22 23:38:05 fraggle
-	
+
 	Allow changing the status bar graphic lumps via dehacked
 
 2006-01-22 23:33:32 fraggle
-	
+
 	Allow changing the sky texture names via dehacked patches
 
 2006-01-22 22:29:42 fraggle
-	
+
 	Periodically request the time from clients to estimate their offset to
 	the server time.
 
 2006-01-22 21:22:35 fraggle
-	
+
 	Dehacked string replacements for menu graphic lump names
 
 2006-01-22 21:21:02 fraggle
-	
+
 	Dehacked string replacements for intermission screen graphic lumps
 
 2006-01-22 21:20:20 fraggle
-	
+
 	Dehacked string replacements for sound and music lump names
 
 2006-01-22 21:19:14 fraggle
-	
+
 	Dehacked string replacements for startup messages, IWAD names, demo
 	names and backgrounds
 
 2006-01-22 21:17:56 fraggle
-	
+
 	Catch calls to DEH_String before DEH_Init is called
 
 2006-01-21 14:16:49 fraggle
-	
+
 	Add first game data sending code.  Check the client version when
 	connecting.
 
 2006-01-21 14:15:29 fraggle
-	
+
 	Remove SAVESTRINGSIZE (now defined in p_saveg.h)
 
 2006-01-20 21:05:16 fraggle
-	
+
 	Bump version to 0.2.0
 
 2006-01-20 21:04:59 fraggle
-	
+
 	Import differences from stable branch.
 
 2006-01-19 18:46:24 fraggle
-	
+
 	Move savegame header read/write code into p_saveg.c
 
 2006-01-19 00:17:01 fraggle
-	
+
 	Remove now-redundant note about structure packing.
 
 2006-01-19 00:09:20 fraggle
-	
+
 	Add functions to r/w structures to the savegame buffer, rather than
 	copying the raw structures.  This way, we read and write to the DOS
 	savegame format always, regardless of the compiler and processor
@@ -5099,182 +5251,182 @@
 	architecture, to ensure Vanilla compatibility.
 
 2006-01-16 23:35:55 fraggle
-	
+
 	Write icon data as hex numbers, rather than decimal
 
 2006-01-16 21:40:38 fraggle
-	
+
 	Vanilla savegame load/save
 
 2006-01-14 02:06:48 fraggle
-	
+
 	Include the game version in the settings structure.
 
 2006-01-14 00:27:16 fraggle
-	
+
 	Set the window caption and title
 
 2006-01-14 00:13:04 fraggle
-	
+
 	Detect if disconnected from the server while waiting for the game
 	start.
 
 2006-01-14 00:10:54 fraggle
-	
+
 	Change the format of color commands.  Reorganise the waiting dialog.
 
 2006-01-13 23:56:00 fraggle
-	
+
 	Add text-mode I/O functions.  Use text-mode screen for the waiting
 	screen.
 
 2006-01-13 23:52:12 fraggle
-	
+
 	Fix game start packet parsing logic.
 
 2006-01-13 18:23:28 fraggle
-	
+
 	Textscreen getchar() function; remove SDL code from I_Endoom.
 
 2006-01-13 02:22:47 fraggle
-	
+
 	Update prototypes to match header.  Make sure we include the header in
 	the source file.
 
 2006-01-13 02:20:12 fraggle
-	
+
 	Signed integer read functions.  Use these when reading ticcmd diffs.
 
 2006-01-13 02:19:18 fraggle
-	
+
 	Only accept sane player values when starting a new game.
 
 2006-01-12 02:18:59 fraggle
-	
+
 	Only start new games when in the waiting-for-start state.
 
 2006-01-12 02:11:52 fraggle
-	
+
 	Game start packets
 
 2006-01-12 01:34:48 fraggle
-	
+
 	Combine mouse motion for tics into single events.
 
 2006-01-12 00:21:29 fraggle
-	
+
 	Interpret the dehacked "max health" setting properly.
 
 2006-01-11 01:37:53 fraggle
-	
+
 	ticcmd diffs: allow compare and patching ticcmds, and reading/writing
 	ticdiffs to packets.
 
 2006-01-10 22:14:13 fraggle
-	
+
 	Shut up compiler warnings
 
 2006-01-10 19:59:26 fraggle
-	
+
 	Reliable packet transport mechanism
 
 2006-01-09 02:03:39 fraggle
-	
+
 	Send clients their player number, and indicate on the waiting screen
 	which client we are.
 
 2006-01-09 01:50:51 fraggle
-	
+
 	Deduce a sane player name by examining environment variables.  Add a
 	"player_name" setting to chocolate-doom.cfg.  Transmit the name to the
 	server and use the names players send in the waiting data list.
 
 2006-01-08 18:22:39 fraggle
-	
+
 	Strip carriage returns from the end of lines when reading
 	configuration files.
 
 2006-01-08 18:14:19 fraggle
-	
+
 	Update NEWS
 
 2006-01-08 18:13:33 fraggle
-	
+
 	show_endoom config file option to disable the endoom screen
 
 2006-01-08 17:52:45 fraggle
-	
+
 	Play some random music for the players while waiting for the game to
 	start.
 
 2006-01-08 17:52:16 fraggle
-	
+
 	Seed the M_Random random number generator from the system time to give
 	it some more randomness.
 
 2006-01-08 17:51:53 fraggle
-	
+
 	Add S_MusicPlaying function to query if music is still playing.
 
 2006-01-08 05:06:06 fraggle
-	
+
 	Reject new connections if the server is not in the waiting state.
 
 2006-01-08 05:04:50 fraggle
-	
+
 	Don't grab the mouse on the net waiting screen
 
 2006-01-08 04:52:26 fraggle
-	
+
 	Allow the server to reject clients
 
 2006-01-08 03:36:40 fraggle
-	
+
 	Fix double free of addresses
 
 2006-01-08 03:36:17 fraggle
-	
+
 	Fix packet send
 
 2006-01-08 02:53:31 fraggle
-	
+
 	Detect when client connection is disconnected.
 
 2006-01-08 02:53:05 fraggle
-	
+
 	Send keepalives if the connection is not doing anything else.  Send
 	all packets using a new NET_Conn_SendPacket to support this.
 
 2006-01-08 00:10:48 fraggle
-	
+
 	Move common connection code into net_common.c, shared by server and
 	client code.
 
 2006-01-07 20:08:11 fraggle
-	
+
 	Send player name and address in the waiting data packets.  Display
 	these on the waiting screen, and improve the waiting screen
 	appearance.
 
 2006-01-07 19:16:39 fraggle
-	
+
 	Only display a warning when unable to emulate a spechit overrun
 
 2006-01-07 19:11:54 fraggle
-	
+
 	Import the spechit overrun code from prboom-plus.  Thanks to Andrey
 	Budko for his investigation into this behavior.
 
 2006-01-07 17:00:33 fraggle
-	
+
 	Mention the Chocolate Doom wiki, fix a spelling error.
 
 2006-01-07 16:59:52 fraggle
-	
+
 	Update NEWS
 
 2006-01-07 16:26:50 fraggle
-	
+
 	Fix the behavior when expanding sound effects (again).  Doom actually
 	does play sounds of any sample rate, but the sound effects in
 	Scientist 2 are corrupted.  Add some tests to check that the sound
@@ -5281,163 +5433,163 @@
 	effect header is correct, and generic sound rate conversion code.
 
 2006-01-06 19:26:02 fraggle
-	
+
 	Fix the "-skill 0" hack commonly used under DOS
 
 2006-01-05 02:48:03 fraggle
-	
+
 	Fixes for big endian machines (thanks locust)
 
 2006-01-05 02:42:58 fraggle
-	
+
 	Specify signed char explicitly for ticcmd_t fields.
 
 2006-01-02 21:52:06 fraggle
-	
+
 	Move I_InitGraphics call to be invoked earlier in D_DoomMain.  Call
 	the NET_WaitForStart function to wait for a start signal in network
 	games.
 
 2006-01-02 21:50:26 fraggle
-	
+
 	Restructure the waiting screen code.  Establish our own separate event
 	loop while waiting for the game to start, to avoid affecting the
 	original code too much.  Move some _gui variables to net_client.c.
 
 2006-01-02 21:48:37 fraggle
-	
+
 	fix client connected function
 
 2006-01-02 21:04:10 fraggle
-	
+
 	Create NET_SV_Shutdown function to shut down the server.  Call it when
 	quitting the game.  Print the IP of the server correctly when
 	connecting.
 
 2006-01-02 21:02:16 fraggle
-	
+
 	Change AddrToString function to use an internal static buffer, for
 	ease of use.
 
 2006-01-02 20:27:45 fraggle
-	
+
 	Clear the screen AFTER initialising the loading disk buffer, so that
 	bits of loading disk are not visible on the initial screen melt.
 
 2006-01-02 20:14:29 fraggle
-	
+
 	Add a "-client" option to test connecting to a local server.
 
 2006-01-02 20:14:07 fraggle
-	
+
 	Fix connect timeout and shutdown client properly if we fail to
 	connect.
 
 2006-01-02 20:13:06 fraggle
-	
+
 	Refer to connected clients by their AddrToString() output rather than
 	just the pointer to their struct.  Listen for IP connections as well
 	as loopback connections.
 
 2006-01-02 20:11:49 fraggle
-	
+
 	Rename i_net_module -> net_sdl_module.  Fix the AddrToString method.
 
 2006-01-02 17:24:40 fraggle
-	
+
 	Remove test code
 
 2006-01-02 00:54:17 fraggle
-	
+
 	Fix packet not freed back after being sent.  Code to disconnect
 	clients from the server side.
 
 2006-01-02 00:17:42 fraggle
-	
+
 	Encapsulate the event queue code properly.  Add a D_PopEvent function
 	to read a new event from the event queue.
 
 2006-01-02 00:06:30 fraggle
-	
+
 	Make functions static.  Remove unused variable.
 
 2006-01-02 00:00:08 fraggle
-	
+
 	Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
 
 2006-01-01 23:54:31 fraggle
-	
+
 	Client disconnect code
 
 2006-01-01 23:53:15 fraggle
-	
+
 	Remove GS_WAITINGSTART gamestate.  This will be independent of the
 	main loop to avoid interfering with the main game code too much.
 
 2006-01-01 23:51:41 fraggle
-	
+
 	String read/write functions
 
 2005-12-30 18:58:22 fraggle
-	
+
 	Fix client code to correctly send reply to server on connection.  Add
 	"waiting screen" while waiting for the game to start.  Hook in the new
 	networking code into the main game code.
 
 2005-12-30 18:50:53 fraggle
-	
+
 	Millisecond clock function
 
 2005-12-29 21:29:55 fraggle
-	
+
 	Working client connect code
 
 2005-12-29 17:48:25 fraggle
-	
+
 	Add initial client/server connect code.  Reorganise sources list in
 	Makefile.am.
 
 2005-12-29 17:47:47 fraggle
-	
+
 	Automatically initialise the address table
 
 2005-11-17 09:41:24 fraggle
-	
+
 	Catch SDL_QUIT event on ENDOOM display
 
 2005-10-30 19:56:15 fraggle
-	
+
 	Add foundation code for the new networking system
 
 2005-10-29 22:50:08 fraggle
-	
+
 	Update ChangeLog
 
 2005-10-29 22:48:55 fraggle
-	
+
 	0.1.2
 
 2005-10-29 22:38:55 fraggle
-	
+
 	Fix help screen orderings and skull positions to make Chocolate Doom
 	behave exactly like the original executables.
 
 2005-10-26 01:56:40 fraggle
-	
+
 	Final Doom teleport logic was backwards
 
 2005-10-24 19:50:39 fraggle
-	
+
 	Allow the game version to emulate to be specified from the command
 	line and set compatibility options accordingly.
 
 2005-10-23 21:22:35 fraggle
-	
+
 	Drastically refactor the WAD merging code.  Allow multiple
 	replacements of the same sprite in a PWAD (fixes Scientist 2)
 
 2005-10-23 19:39:45 fraggle
-	
+
 	Reproduce the behavior when playing a sound at a sample rate which is
 	not 11025 or 22050Hz.  This is to "fix" a bug in Scientist 2: however,
 	it does not fix the playing of sounds, only silence them.  I tested
@@ -5446,893 +5598,893 @@
 	WAD, which has sound effects that have the wrong sample rate.
 
 2005-10-18 20:06:31 fraggle
-	
+
 	Update ChangeLog
 
 2005-10-18 20:05:18 fraggle
-	
+
 	0.1.1
 
 2005-10-18 13:32:55 fraggle
-	
+
 	Update ChangeLog
 
 2005-10-18 10:13:07 fraggle
-	
+
 	Update NEWS
 
 2005-10-18 00:48:05 fraggle
-	
+
 	DEH_CheckCommandLine -> DEH_Init, for consistency with other Init
 	functions
 
 2005-10-18 00:16:09 fraggle
-	
+
 	Add a "loading" message for each dehacked patch we load, to be
 	orthogonal to the WAD loading code
 
 2005-10-17 23:07:26 fraggle
-	
+
 	Fix "Monsters Infight"
 
 2005-10-17 22:20:27 fraggle
-	
+
 	Add note that the "Monsters Infight" setting is not supported.
 
 2005-10-17 22:14:31 fraggle
-	
+
 	Ignore comments in dehacked files.
 
 2005-10-17 22:09:01 fraggle
-	
+
 	Dehacked Misc support: Controls for the armor and armor class set when
 	using the ammo cheats.
 
 2005-10-17 22:02:57 fraggle
-	
+
 	Dehacked Misc support: Max soulsphere, Soulsphere+Megasphere health
 	bonus values, God mode health value
 
 2005-10-17 21:49:42 fraggle
-	
+
 	Add dehacked "Misc" implementations for max armor+health, blue+green
 	armor classes
 
 2005-10-17 21:27:05 fraggle
-	
+
 	Start of Dehacked 'Misc' section support.  Initial Health+Bullets, and
 	bfg cells/shot are supported.
 
 2005-10-17 20:46:22 fraggle
-	
+
 	Guard against multiple video shutdowns better.  Fix crash due to
 	improper screen clear at startup.
 
 2005-10-16 21:55:50 fraggle
-	
+
 	Fix the '-cdrom' command-line option.
 
 2005-10-16 17:16:03 fraggle
-	
+
 	Set the default number of channels to a more sensible 8
 
 2005-10-16 02:18:10 fraggle
-	
+
 	Global "configdir" variable with directory to store config files in.
 	Create a function to find the filename for a savegame slot.  Store
 	savegames in the config dir.
 
 2005-10-15 23:50:57 fraggle
-	
+
 	Fix pink icon on startup
 
 2005-10-15 18:57:47 fraggle
-	
+
 	Add warning message for WADs with FF_START or SS_START in, suggesting
 	the -merge option.
 
 2005-10-15 18:42:07 fraggle
-	
+
 	Mention dehacked banners
 
 2005-10-15 18:38:49 fraggle
-	
+
 	Print startup banners which have been modified by dehacked.
 
 2005-10-15 18:09:11 fraggle
-	
+
 	Add blackbug note
 
 2005-10-15 17:58:31 fraggle
-	
+
 	Fix MIDI music not pausing when using SDL_mixer's native MIDI
 	playback.  The SDL_mixer native MIDI code does not pause music
 	properly - use a workaround of setting the volume to 0.
 
 2005-10-15 16:59:14 fraggle
-	
+
 	Map mouse buttons correctly.
 
 2005-10-15 16:47:50 fraggle
-	
+
 	Update NEWS with info about bugs fixed.
 
 2005-10-15 16:45:03 fraggle
-	
+
 	Check the return code from SDL_LockSurface to ensure a surface has
 	been properly locked.  Fixes crash when switching applications while
 	running fullscreen.
 
 2005-10-14 00:12:30 fraggle
-	
+
 	Fix Doom 1 skies
 
 2005-10-13 23:23:55 fraggle
-	
+
 	Fix logic for lost soul bounce
 
 2005-10-12 22:52:01 fraggle
-	
+
 	doomfeatures.h to allow certain features to be disabled in the build
 
 2005-10-10 18:02:24 fraggle
-	
+
 	Update to do list
 
 2005-10-10 00:52:28 fraggle
-	
+
 	Fix DEH_Warning call
 
 2005-10-09 22:22:41 fraggle
-	
+
 	Update ChangeLog
 
 2005-10-09 22:20:14 fraggle
-	
+
 	v0.1.0
 
 2005-10-09 22:19:41 fraggle
-	
+
 	Include libtextscreen include in the right place, include deh_main.h
 	in the dist.
 
 2005-10-09 21:19:21 fraggle
-	
+
 	Handle blinking text in ENDOOM lumps properly.
 
 2005-10-09 21:06:50 fraggle
-	
+
 	Check the header of dehacked files and make sure we only load valid
 	dehacked files.
 
 2005-10-09 17:42:46 fraggle
-	
+
 	Cannot do arithmetic on void pointers in standard C
 
 2005-10-09 15:34:19 fraggle
-	
+
 	Fix banner string for ultimate doom
 
 2005-10-09 01:25:49 fraggle
-	
+
 	Improved sprite merging
 
 2005-10-09 01:20:24 fraggle
-	
+
 	Detect registered DOOM banner in dehacked patches
 
 2005-10-08 22:02:55 fraggle
-	
+
 	Allow dehacked substitutions on sprite names
 
 2005-10-08 22:01:55 fraggle
-	
+
 	Change dehacked startup message
 
 2005-10-08 21:54:16 fraggle
-	
+
 	Proper dehacked error/warning framework.  Catch a load more errors.
 
 2005-10-08 21:14:38 fraggle
-	
+
 	Dehacked "Sound" section support
 
 2005-10-08 21:14:24 fraggle
-	
+
 	Add the ability to specify unsupported fields
 
 2005-10-08 21:10:51 fraggle
-	
+
 	Shut up compiler warning
 
 2005-10-08 20:52:03 fraggle
-	
+
 	Update NEWS, ChangeLog
 
 2005-10-08 20:33:48 fraggle
-	
+
 	Allow dehacked patches to override the name of the game via the
 	startup banner.
 
 2005-10-08 19:34:12 fraggle
-	
+
 	Print startup message to stdout, not stderr
 
 2005-10-08 19:23:18 fraggle
-	
+
 	WAD merging code
 
 2005-10-08 19:22:46 fraggle
-	
+
 	Store the cache as part of the lumpinfo_t struct.  Add W_AddFile
 	prototype to header.
 
 2005-10-06 20:36:41 fraggle
-	
+
 	Must use the right no clipping cheat for the right game.
 
 2005-10-06 20:32:38 fraggle
-	
+
 	Allow changing the background flats in finale text screens via
 	dehacked
 
 2005-10-04 23:10:32 fraggle
-	
+
 	Dehacked "Misc" section parser (currently a dummy)
 
 2005-10-04 23:04:06 fraggle
-	
+
 	Parse dehacked "Ammo" sections properly
 
 2005-10-04 22:41:42 fraggle
-	
+
 	Rewrite cheats code.  Add dehacked cheat replacement.
 
 2005-10-04 01:41:49 fraggle
-	
+
 	Move call to dehacked entrypoint to stop crashes
 
 2005-10-03 22:39:39 fraggle
-	
+
 	Dehacked text substitutions
 
 2005-10-03 14:44:12 fraggle
-	
+
 	Update ChangeLog
 
 2005-10-03 14:21:11 fraggle
-	
+
 	Weapons mapping code
 
 2005-10-03 12:08:16 fraggle
-	
+
 	Replace end of section functions with NULLs as they arent currently
 	being used for anything.
 
 2005-10-03 12:02:08 fraggle
-	
+
 	Add a weaponinfo_t mapping
 
 2005-10-03 11:25:37 fraggle
-	
+
 	Add mapping code to map out structures and switch thing/frame code to
 	use this.
 
 2005-10-03 01:42:45 fraggle
-	
+
 	Frame numbers are indexed from 0
 
 2005-10-03 00:49:01 fraggle
-	
+
 	The beginnings of dehacked support
 
 2005-10-02 21:23:04 fraggle
-	
+
 	Guard against music lumps containing non-MUS data, document in bugs
 	list
 
 2005-10-02 05:23:42 fraggle
-	
+
 	Update NEWS
 
 2005-10-02 05:22:06 fraggle
-	
+
 	Fix Final Doom automap level name display
 
 2005-10-02 05:16:47 fraggle
-	
+
 	Fixes for Final Doom
 
 2005-10-02 04:23:54 fraggle
-	
+
 	Fix the length of time that ENDOOM is displayed for
 
 2005-10-02 04:16:29 fraggle
-	
+
 	ENDOOM support using text mode emulation
 
 2005-10-02 04:16:03 fraggle
-	
+
 	Text mode emulation code
 
 2005-10-02 04:03:40 fraggle
-	
+
 	Make sure loading disk is only shown if the display is initialised
 
 2005-10-01 16:50:13 fraggle
-	
+
 	Update ChangeLog
 
 2005-10-01 16:49:32 fraggle
-	
+
 	automake doesn't recognise .rc files unless there is a rule like this
 	in here.  Store the rule in both forms.
 
 2005-09-28 01:08:45 fraggle
-	
+
 	Update ChangeLog
 
 2005-09-27 23:33:42 fraggle
-	
+
 	Always use SDL_Flip to update the screen.  Fixes problems in Windows
 	when running fullscreen, introduced by fixes to the disk icon code.
 
 2005-09-27 23:25:10 fraggle
-	
+
 	Fix .rc -> .o rule
 
 2005-09-27 23:24:24 fraggle
-	
+
 	Add chocolate_doom_icon.c to CVS.  This is kind of bad but saves
 	having to have Python installed
 
 2005-09-27 23:23:32 fraggle
-	
+
 	Don't write converted output file unless everything went through okay.
 
 2005-09-27 22:46:53 fraggle
-	
+
 	0.0.4
 
 2005-09-27 22:46:43 fraggle
-	
+
 	Update ChangeLog
 
 2005-09-26 22:44:30 fraggle
-	
+
 	Fix melting crap on startup - oops
 
 2005-09-25 01:31:32 fraggle
-	
+
 	Fix disk icon appearing before palette is set (pink disk!) Cleanup and
 	commenting
 
 2005-09-25 00:46:48 fraggle
-	
+
 	Update ChangeLog
 
 2005-09-25 00:45:18 fraggle
-	
+
 	Remove leftover debug code
 
 2005-09-25 00:44:49 fraggle
-	
+
 	Enforce sane screenmultiply values
 
 2005-09-25 00:41:07 fraggle
-	
+
 	Fix "loading" icon for all video modes
 
 2005-09-25 00:16:43 fraggle
-	
+
 	Remove icon border
 
 2005-09-24 23:58:01 fraggle
-	
+
 	Commit uac_dead fix
 
 2005-09-24 23:04:03 fraggle
-	
+
 	Add application icon to running program
 
 2005-09-22 22:42:24 fraggle
-	
+
 	64-bit fixes
 
 2005-09-22 14:57:32 fraggle
-	
+
 	Add some more useful information to the README
 
 2005-09-22 14:23:58 fraggle
-	
+
 	Update ChangeLog
 
 2005-09-22 14:22:49 fraggle
-	
+
 	Update NEWS
 
 2005-09-22 14:20:49 fraggle
-	
+
 	Update bugs/todo lists
 
 2005-09-22 14:13:47 fraggle
-	
+
 	Remove external statistics driver support (-statcopy): nonfunctional
 	on modern systems and never used.  Fix for systems where sizeof(int)
 	!= sizeof(void *)
 
 2005-09-22 13:58:46 fraggle
-	
+
 	Use a new PU_FREE tag to mark free blocks, rather than the 'user'
 	field (avoids using magic numbers to mark allocated blocks with no
 	user)
 
 2005-09-20 22:20:16 fraggle
-	
+
 	Generate chocolate-doom-res.rc with version and product info
 
 2005-09-20 21:55:32 fraggle
-	
+
 	Conditionally build the resource file, dependent on whether windres
 	exists
 
 2005-09-20 21:13:55 fraggle
-	
+
 	Update to do list
 
 2005-09-20 21:13:15 fraggle
-	
+
 	Include icon in exe, rather than the default icon.  Thanks to Joe
 	Kennedy for drawing this icon.
 
 2005-09-17 22:37:04 fraggle
-	
+
 	Update changelog
 
 2005-09-17 22:17:45 fraggle
-	
+
 	0.0.3
 
 2005-09-17 21:50:46 fraggle
-	
+
 	Mouse acceleration code to emulate old DOS drivers
 
 2005-09-17 21:25:56 fraggle
-	
+
 	Set the default values for variables in their initialisers.  Remove
 	the "defaultvalue" parameter and associated code from the
 	configuration file parsing code.
 
 2005-09-17 21:06:45 fraggle
-	
+
 	Rewrite configuration loading code; assign a type to each
 	configuration parameter.  Allow float parameters, align all values in
 	the configuration files
 
 2005-09-17 19:40:32 fraggle
-	
+
 	Autogenerated changelog
 
 2005-09-14 23:13:45 fraggle
-	
+
 	Remove mkinstalldirs (redundant now); include BUGS and TODO in
 	distribution
 
 2005-09-14 23:08:29 fraggle
-	
+
 	Fix startup messages displayed (build a console binary; remove CON
 	redirection code)
 
 2005-09-14 22:55:47 fraggle
-	
+
 	Lock surfaces properly when we have to (fixes crash under Windows 98)
 
 2005-09-13 21:18:51 fraggle
-	
+
 	0.0.2
 
 2005-09-12 00:57:08 fraggle
-	
+
 	Remove temporary MIDI files generated by sound code.
 
 2005-09-11 21:53:17 fraggle
-	
+
 	Fix sounds playing at the wrong volume (too quiet)
 
 2005-09-11 21:42:26 fraggle
-	
+
 	Update NEWS with information about alt-tab bug
 
 2005-09-11 21:35:18 fraggle
-	
+
 	chocolate-doom.cfg
 
 2005-09-11 21:25:56 fraggle
-	
+
 	Second configuration file to allow chocolate doom-specific settings.
 	Adjust some existing command line logic (for graphics settings and
 	novert) to adjust for this.
 
 2005-09-11 17:39:29 fraggle
-	
+
 	Fix declaration of I_Sleep (not I_Delay) and move to right header
 
 2005-09-11 17:35:04 fraggle
-	
+
 	Missing declarations
 
 2005-09-08 23:10:40 fraggle
-	
+
 	Delay calls so we don't use the entire CPU
 
 2005-09-08 23:05:17 fraggle
-	
+
 	Allow alt-tab away while running fullscreen
 
 2005-09-08 10:58:00 fraggle
-	
+
 	MAXINTERCEPTS got converted to INT_MAXERCEPTS accidentally when
 	switching to the ANSI standard limit constants
 
 2005-09-08 01:02:12 fraggle
-	
+
 	Fix description
 
 2005-09-08 01:01:51 fraggle
-	
+
 	Fix switches not changing in Episode 4
 
 2005-09-07 23:58:34 fraggle
-	
+
 	No SIGHUP on Windows
 
 2005-09-07 23:55:28 fraggle
-	
+
 	v0.0.1
 
 2005-09-07 23:24:26 fraggle
-	
+
 	Modify the sound effect caching behaviour: sounds which are not
 	playing are now marked as PU_CACHE; it is otherwise possible to run
 	out of memory.
 
 2005-09-07 22:40:28 fraggle
-	
+
 	Catch signals and exit cleanly
 
 2005-09-07 22:40:11 fraggle
-	
+
 	Remove non-ANSI C headers and functions
 
 2005-09-07 22:30:42 fraggle
-	
+
 	Remove non-ANSI C headers.  Use standard C file I/O functions.
 
 2005-09-07 21:44:23 fraggle
-	
+
 	Fix up names of functions Make the quit button work (pops up the "quit
 	doom?" prompt).  Fix focus detection to release the mouse and ignore
 	mouse events when window is not focused.
 
 2005-09-07 13:34:47 fraggle
-	
+
 	Maintain dos-specific options in config file
 
 2005-09-06 23:50:09 fraggle
-	
+
 	Bugs list; update TODO
 
 2005-09-06 23:39:43 fraggle
-	
+
 	Restore -nosound, -nosfx, -nomusic
 
 2005-09-06 22:40:28 fraggle
-	
+
 	Setting music volume
 
 2005-09-06 22:15:08 fraggle
-	
+
 	Silly me - i misread cph's patch and got the logic backwards
 
 2005-09-06 22:11:23 fraggle
-	
+
 	Working music!
 
 2005-09-06 22:06:45 fraggle
-	
+
 	Newer versions of mmus2mid.c,h from prboom
 
 2005-09-05 23:50:56 fraggle
-	
+
 	Add mmus2mid code from prboom.  Use 'void *' for music handles.  Pass
 	length of data when registering music.
 
 2005-09-05 22:03:43 fraggle
-	
+
 	16-bit sound
 
 2005-09-05 21:32:18 fraggle
-	
+
 	Use the system-nonspecific sound code to assign the channel number
 	used by SDL.  Remove handle tagging stuff.
 
 2005-09-05 00:18:30 fraggle
-	
+
 	Remove dead code.  Cope with the screen not having width == pitch.
 	Lock the SDL screen surface properly.  Rewrite 2x scaling code.
 
 2005-09-04 19:44:23 fraggle
-	
+
 	shut up compiler warnings
 
 2005-09-04 18:33:43 fraggle
-	
+
 	Support demos recorded with cph's modified "v1.91" doom exe - which
 	contain higher resolution angleturn
 
 2005-09-04 16:59:45 fraggle
-	
+
 	'novert' command line option to disable vertical mouse movement
 
 2005-09-04 16:23:29 fraggle
-	
+
 	Support the old "joyb_speed 31" hack to allow autorun
 
 2005-09-04 15:55:53 fraggle
-	
+
 	Doom v1.9 doesnt allow cheats in nightmare mode!
 
 2005-09-04 15:51:19 fraggle
-	
+
 	Display the correct quit messages according to which game is being
 	played.  Remove "language" variable (do this through gettext, if ever)
 
 2005-09-04 15:34:20 fraggle
-	
+
 	These things have been done
 
 2005-09-01 01:01:36 fraggle
-	
+
 	-nograbmouse option
 
 2005-09-01 00:58:28 fraggle
-	
+
 	smarter mouse grabbing for windowed mode
 
 2005-08-31 22:50:57 fraggle
-	
+
 	Nicer banner showing the game type (once we know).  Remove dead code.
 	Find the config file properly.
 
 2005-08-31 22:35:42 fraggle
-	
+
 	Display the game name in the title bar.  Move game start code to later
 	in initialisation because of the IWAD detection changes.
 
 2005-08-31 22:24:24 fraggle
-	
+
 	Remove the last traces of NORMALUNIX
 
 2005-08-31 22:21:18 fraggle
-	
+
 	Better IWAD detection and identification.  Support '-iwad' to specify
 	the IWAD to use.
 
 2005-08-30 23:15:11 fraggle
-	
+
 	More Windows fixes
 
 2005-08-30 23:11:10 fraggle
-	
+
 	Windows fixes
 
 2005-08-29 23:00:04 fraggle
-	
+
 	Add missing header to fix build
 
 2005-08-29 22:57:40 fraggle
-	
+
 	Include autotools directory in dist
 
 2005-08-23 10:54:23 fraggle
-	
+
 	Demo sync problem with teleports and final doom
 
 2005-08-19 22:55:51 fraggle
-	
+
 	Make sounds louder.  Use the correct maximum of 15 when doing sound
 	calculations.
 
 2005-08-12 17:54:15 fraggle
-	
+
 	Port network code to use SDL_net
 
 2005-08-10 09:45:35 fraggle
-	
+
 	Remove "if (french)" stuff, FRENCH define, detect french wad
 	automatically
 
 2005-08-08 16:19:47 fraggle
-	
+
 	More TODOs/update
 
 2005-08-07 21:01:00 fraggle
-	
+
 	Clear the screen on startup
 
 2005-08-07 20:21:01 fraggle
-	
+
 	Cycle round sound channels to stop reuse and conflicts of channel
 	numbers.  Add debug to detect when incorrect sound handles are used.
 
 2005-08-07 04:09:33 fraggle
-	
+
 	Fix gamma correction
 
 2005-08-07 03:59:23 fraggle
-	
+
 	Clear disk image when loading at startup
 
 2005-08-06 19:37:47 fraggle
-	
+
 	Fix low resolution mode
 
 2005-08-06 18:30:30 fraggle
-	
+
 	Only change palette on screen updates
 
 2005-08-06 18:05:51 fraggle
-	
+
 	Remove debug messages, send error messages to stderr Fix overflow when
 	playing large sound files
 
 2005-08-05 18:53:07 fraggle
-	
+
 	More sensible defaults
 
 2005-08-04 23:55:08 fraggle
-	
+
 	Use DOOM_VERSION to define the Doom version (don't conflict with
 	automake's config.h).  Display GPL message instead of anti-piracy
 	messages.
 
 2005-08-04 23:23:07 fraggle
-	
+
 	Use zone memory function.  Add command line options
 
 2005-08-04 22:48:32 fraggle
-	
+
 	Turn on compiler optimisation and warning options Add SDL_mixer sound
 	code
 
 2005-08-04 20:54:56 fraggle
-	
+
 	Use keysym value rather than unicode value (fixes problems with shift
 	key)
 
 2005-08-04 19:42:15 fraggle
-	
+
 	Silence compiler warnings
 
 2005-08-04 19:40:22 fraggle
-	
+
 	Use zone memory functions instead of alloca/malloc/free
 
 2005-08-04 02:15:10 fraggle
-	
+
 	Fix clev cheat
 
 2005-08-04 02:14:37 fraggle
-	
+
 	Begin/EndRead now in i_video.c
 
 2005-08-04 02:13:46 fraggle
-	
+
 	Loading disk
 
 2005-08-03 23:20:09 fraggle
-	
+
 	Display FPS on quit
 
 2005-08-03 23:19:52 fraggle
-	
+
 	Set some flags to fix palette and improve performance
 
 2005-08-03 22:58:02 fraggle
-	
+
 	Working scale*2
 
 2005-07-25 21:50:55 fraggle
-	
+
 	mouse
 
 2005-07-25 21:41:59 fraggle
-	
+
 	Port timer code to SDL
 
 2005-07-24 04:07:24 fraggle
-	
+
 	Update to do list
 
 2005-07-24 03:14:04 fraggle
-	
+
 	Move to SDL for graphics.  Translate key scancodes to correct internal
 	format when reading settings from config file - backwards compatible
 	with config files for original exes
 
 2005-07-24 00:07:04 fraggle
-	
+
 	Add back previously removed printfs as '.'s for startup progress bar
 
 2005-07-23 22:42:52 fraggle
-	
+
 	Add missing null to end of sprite names list
 
 2005-07-23 22:32:47 fraggle
-	
+
 	Add missing errno.h, fix crash on startup when no IWAD present
 
 2005-07-23 20:42:56 fraggle
-	
+
 	Startup messages as in the DOS exes
 
 2005-07-23 20:31:49 fraggle
-	
+
 	Update TODO list
 
 2005-07-23 20:29:45 fraggle
-	
+
 	Put version number back to 1.9
 
 2005-07-23 20:17:11 fraggle
-	
+
 	Use ANSI-standard limit constants.  Remove LINUX define.
 
 2005-07-23 19:56:07 fraggle
-	
+
 	Remove unneccessary pragmas
 
 2005-07-23 19:54:30 fraggle
-	
+
 	Fix quit prompt not displayed properly
 
 2005-07-23 19:54:06 fraggle
-	
+
 	Use standard C functions for WAD code
 
 2005-07-23 19:50:34 fraggle
-	
+
 	Use standard C file functions for WAD code
 
 2005-07-23 18:46:19 fraggle
-	
+
 	Import bouncing lost soul fix from prboom
 
 2005-07-23 18:27:04 fraggle
-	
+
 	Stop crash on shutdown
 
 2005-07-23 18:21:35 fraggle
-	
+
 	Remove step table (unused, adds dependency on pow function)
 
 2005-07-23 18:20:33 fraggle
-	
+
 	Autotools build system
 
 2005-07-23 17:54:24 fraggle
-	
+
 	Standard distribution files
 
 2005-07-23 17:46:05 fraggle
-	
+
 	To do list
 
 2005-07-23 17:44:57 fraggle
-	
+
 	Update copyright to GNU GPL
 
 2005-07-23 17:19:41 fraggle
-	
+
 	Initial revision
 
--- a/NEWS
+++ b/NEWS
@@ -1,14 +1,46 @@
 
+1.7.0 (2012-06-09):
+
      * Fixed gnome-screensaver desktop file (thanks Rahul Sundaram).
      * Updated COPYING to current version of GPL2 (thanks Rahul
        Sundaram).
-     * Fix bug with detection of IWAD type by filename (thanks mether).
-     * Reduce palette accuracy to 6 bits per channel, to more accurately
-       emulate the PC VGA hardware (thanks GhostlyDeath).
-     * Fix teleport behavior when emulating the alternate Final Doom
+     * Running servers now re-resolve the address of the master server
+       occasionally, to adapt to DNS address changes.
+     * Error dialog is no longer shown on OS X when running from the
+       console.
+     * The Makefiles no longer use GNU make extensions, so the package
+       builds on OpenBSD.
+     * There is now an OPL MIDI debug option (-opldev), useful for
+       when developing GENMIDI lumps.
+     * A workaround for SDL mouse lag is now only used on Windows
+       (where it is needed), and not on other systems. This fixes
+       Chocolate Doom on AmigaOS (thanks Timo Sievänen).
+     * UTF-8 usernames are supported, and Windows usernames with
+       non-ASCII characters are now supported (thanks Alexandre
+       Xavier).
+
+    Compatibility:
+     * Palette accuracy is reduced to 6 bits per channel, to more
+       accurately emulate the PC VGA hardware (thanks GhostlyDeath).
+     * Fixed teleport behavior when emulating the alternate Final Doom
        executable (-gameversion final2) (thanks xttl).
 
+    Bugs fixed:
+     * Fixed weapon cycling keys when playing in Shareware Doom and using
+       the IDKFA cheat (thanks Alexandre Xavier).
+     * Fixed the default mouse buttons in the setup tool (thanks
+       Alexandre Xavier).
+     * Chat macros now work when vanilla_keyboard_mapping is turned
+       off.
+     * Default chat macros were fixed in the setup tool.
+     * Ping time calculation was fixed for LAN search, and made more
+       accurate for all searches.
+     * Fixed bug with detection of IWAD type by filename (thanks mether).
+
     libtextscreen:
+     * There is now limited UTF-8 text support in the textscreen
+       library, used in the label and input box widgets.
+     * Scroll bar behavior was fixed (thanks Alexandre Xavier).
      * Input boxes stop editing and save when they lose their focus,
        correcting a previous counterintuitive behavior (thanks
        Twelve).
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
 AC_INIT(Chocolate Doom, 1.99.0, fraggle@gmail.com, chocolate-doom)
 
 PACKAGE_SHORTDESC="Conservative Doom source port"
-PACKAGE_COPYRIGHT="Copyright (C) 1993-2011"
+PACKAGE_COPYRIGHT="Copyright (C) 1993-2012"
 PACKAGE_LICENSE="GNU General Public License, version 2"
 PACKAGE_MAINTAINER="Simon Howard"
 PACKAGE_URL="http://www.chocolate-doom.org/"
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -14,8 +14,8 @@
              @PROGRAM_PREFIX@setup.png
 
 @PROGRAM_PREFIX@doom.png : doom.png
-	cp $< $@
+	cp doom.png $@
 
 @PROGRAM_PREFIX@setup.png : setup.png
-	cp $< $@
+	cp setup.png $@
 
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -69,7 +69,7 @@
 m_config.c           m_config.h            \
 m_controls.c         m_controls.h          \
 m_fixed.c            m_fixed.h             \
-md5.c                md5.h                 \
+sha1.c               sha1.h                \
 memio.c              memio.h               \
 tables.c             tables.h              \
 v_video.c            v_video.h             \
@@ -95,6 +95,7 @@
 # source files needed for FEATURE_MULTIPLAYER
 
 FEATURE_MULTIPLAYER_SOURCE_FILES=          \
+aes_prng.c           aes_prng.h            \
 net_client.c         net_client.h          \
 net_common.c         net_common.h          \
 net_dedicated.c      net_dedicated.h       \
@@ -210,13 +211,13 @@
 app_DATA = @PROGRAM_PREFIX@doom.desktop
 
 @PROGRAM_PREFIX@doom.desktop : doom.desktop
-	cp $< $@
+	cp doom.desktop $@
 
 screensaverdir = $(prefix)/share/applications/screensavers
 screensaver_DATA = @PROGRAM_PREFIX@doom-screensaver.desktop
 
 @PROGRAM_PREFIX@doom-screensaver.desktop: doom-screensaver.desktop
-	cp $< $@
+	cp doom-screensaver.desktop $@
 
 .rc.o:
 	$(WINDRES) $< -o $@
--- /dev/null
+++ b/src/aes_prng.c
@@ -1,0 +1,1048 @@
+// Emacs style mode select   -*- C++ -*-
+//-----------------------------------------------------------------------------
+//
+// Copyright(C) 2012 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+//-----------------------------------------------------------------------------
+//
+// This implements a cryptographically secure pseudorandom number
+// generator for implementing secure demos. The approach taken is to
+// use the AES (Rijndael) stream cipher in "counter" mode, encrypting
+// an incrementing counter. The cipher key acts as the random seed.
+// Cryptanalysis of AES used in this way has shown it to be an
+// effective PRNG (see: Empirical Evidence concerning AES, Hellekalek
+// & Wegenkittl, 2003).
+//
+// The AES implementation is from GnuPG. Original copyright notice is
+// below.
+//
+//-----------------------------------------------------------------------------
+
+/* Rijndael (AES) for GnuPG
+ *	Copyright (C) 2000, 2001, 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *******************************************************************
+ * The code here is based on the optimized implementation taken from
+ * http://www.esat.kuleuven.ac.be/~rijmen/rijndael/ on Oct 2, 2000,
+ * which carries this notice:
+ *------------------------------------------
+ * rijndael-alg-fst.c   v2.3   April '2000
+ *
+ * Optimised ANSI C code
+ *
+ * authors: v1.0: Antoon Bosselaers
+ *          v2.0: Vincent Rijmen
+ *          v2.3: Paulo Barreto
+ *
+ * This code is placed in the public domain.
+ *------------------------------------------
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h> /* for memcmp() */
+
+#include "aes_prng.h"
+#include "doomtype.h"
+#include "i_system.h"
+
+#define MAXKC			(256/32)
+#define MAXROUNDS		14
+
+
+typedef struct
+{
+    int  ROUNDS;                   /* key-length-dependent number of rounds */
+    uint32_t keySched[MAXROUNDS+1][4];	/* key schedule		*/
+} RIJNDAEL_context;
+
+static const byte S[256] =
+{
+    99, 124, 119, 123, 242, 107, 111, 197,
+    48,   1, 103,  43, 254, 215, 171, 118,
+    202, 130, 201, 125, 250,  89,  71, 240,
+    173, 212, 162, 175, 156, 164, 114, 192,
+    183, 253, 147,  38,  54,  63, 247, 204,
+    52, 165, 229, 241, 113, 216,  49,  21,
+    4, 199,  35, 195,  24, 150,   5, 154,
+    7,  18, 128, 226, 235,  39, 178, 117,
+    9, 131,  44,  26,  27, 110,  90, 160,
+    82,  59, 214, 179,  41, 227,  47, 132,
+    83, 209,   0, 237,  32, 252, 177,  91,
+    106, 203, 190,  57,  74,  76,  88, 207,
+    208, 239, 170, 251,  67,  77,  51, 133,
+    69, 249,   2, 127,  80,  60, 159, 168,
+    81, 163,  64, 143, 146, 157,  56, 245,
+    188, 182, 218,  33,  16, 255, 243, 210,
+    205,  12,  19, 236,  95, 151,  68,  23,
+    196, 167, 126,  61, 100,  93,  25, 115,
+    96, 129,  79, 220,  34,  42, 144, 136,
+    70, 238, 184,  20, 222,  94,  11, 219,
+    224,  50,  58,  10,  73,   6,  36,  92,
+    194, 211, 172,  98, 145, 149, 228, 121,
+    231, 200,  55, 109, 141, 213,  78, 169,
+    108,  86, 244, 234, 101, 122, 174,   8,
+    186, 120,  37,  46,  28, 166, 180, 198,
+    232, 221, 116,  31,  75, 189, 139, 138,
+    112,  62, 181, 102,  72,   3, 246,  14,
+    97,  53,  87, 185, 134, 193,  29, 158,
+    225, 248, 152,  17, 105, 217, 142, 148,
+    155,  30, 135, 233, 206,  85,  40, 223,
+    140, 161, 137,  13, 191, 230,  66, 104,
+    65, 153,  45,  15, 176,  84, 187,  22
+};
+
+
+static const byte T1[256][4] =
+{
+    { 0xc6,0x63,0x63,0xa5 }, { 0xf8,0x7c,0x7c,0x84 },
+    { 0xee,0x77,0x77,0x99 }, { 0xf6,0x7b,0x7b,0x8d },
+    { 0xff,0xf2,0xf2,0x0d }, { 0xd6,0x6b,0x6b,0xbd },
+    { 0xde,0x6f,0x6f,0xb1 }, { 0x91,0xc5,0xc5,0x54 },
+    { 0x60,0x30,0x30,0x50 }, { 0x02,0x01,0x01,0x03 },
+    { 0xce,0x67,0x67,0xa9 }, { 0x56,0x2b,0x2b,0x7d },
+    { 0xe7,0xfe,0xfe,0x19 }, { 0xb5,0xd7,0xd7,0x62 },
+    { 0x4d,0xab,0xab,0xe6 }, { 0xec,0x76,0x76,0x9a },
+    { 0x8f,0xca,0xca,0x45 }, { 0x1f,0x82,0x82,0x9d },
+    { 0x89,0xc9,0xc9,0x40 }, { 0xfa,0x7d,0x7d,0x87 },
+    { 0xef,0xfa,0xfa,0x15 }, { 0xb2,0x59,0x59,0xeb },
+    { 0x8e,0x47,0x47,0xc9 }, { 0xfb,0xf0,0xf0,0x0b },
+    { 0x41,0xad,0xad,0xec }, { 0xb3,0xd4,0xd4,0x67 },
+    { 0x5f,0xa2,0xa2,0xfd }, { 0x45,0xaf,0xaf,0xea },
+    { 0x23,0x9c,0x9c,0xbf }, { 0x53,0xa4,0xa4,0xf7 },
+    { 0xe4,0x72,0x72,0x96 }, { 0x9b,0xc0,0xc0,0x5b },
+    { 0x75,0xb7,0xb7,0xc2 }, { 0xe1,0xfd,0xfd,0x1c },
+    { 0x3d,0x93,0x93,0xae }, { 0x4c,0x26,0x26,0x6a },
+    { 0x6c,0x36,0x36,0x5a }, { 0x7e,0x3f,0x3f,0x41 },
+    { 0xf5,0xf7,0xf7,0x02 }, { 0x83,0xcc,0xcc,0x4f },
+    { 0x68,0x34,0x34,0x5c }, { 0x51,0xa5,0xa5,0xf4 },
+    { 0xd1,0xe5,0xe5,0x34 }, { 0xf9,0xf1,0xf1,0x08 },
+    { 0xe2,0x71,0x71,0x93 }, { 0xab,0xd8,0xd8,0x73 },
+    { 0x62,0x31,0x31,0x53 }, { 0x2a,0x15,0x15,0x3f },
+    { 0x08,0x04,0x04,0x0c }, { 0x95,0xc7,0xc7,0x52 },
+    { 0x46,0x23,0x23,0x65 }, { 0x9d,0xc3,0xc3,0x5e },
+    { 0x30,0x18,0x18,0x28 }, { 0x37,0x96,0x96,0xa1 },
+    { 0x0a,0x05,0x05,0x0f }, { 0x2f,0x9a,0x9a,0xb5 },
+    { 0x0e,0x07,0x07,0x09 }, { 0x24,0x12,0x12,0x36 },
+    { 0x1b,0x80,0x80,0x9b }, { 0xdf,0xe2,0xe2,0x3d },
+    { 0xcd,0xeb,0xeb,0x26 }, { 0x4e,0x27,0x27,0x69 },
+    { 0x7f,0xb2,0xb2,0xcd }, { 0xea,0x75,0x75,0x9f },
+    { 0x12,0x09,0x09,0x1b }, { 0x1d,0x83,0x83,0x9e },
+    { 0x58,0x2c,0x2c,0x74 }, { 0x34,0x1a,0x1a,0x2e },
+    { 0x36,0x1b,0x1b,0x2d }, { 0xdc,0x6e,0x6e,0xb2 },
+    { 0xb4,0x5a,0x5a,0xee }, { 0x5b,0xa0,0xa0,0xfb },
+    { 0xa4,0x52,0x52,0xf6 }, { 0x76,0x3b,0x3b,0x4d },
+    { 0xb7,0xd6,0xd6,0x61 }, { 0x7d,0xb3,0xb3,0xce },
+    { 0x52,0x29,0x29,0x7b }, { 0xdd,0xe3,0xe3,0x3e },
+    { 0x5e,0x2f,0x2f,0x71 }, { 0x13,0x84,0x84,0x97 },
+    { 0xa6,0x53,0x53,0xf5 }, { 0xb9,0xd1,0xd1,0x68 },
+    { 0x00,0x00,0x00,0x00 }, { 0xc1,0xed,0xed,0x2c },
+    { 0x40,0x20,0x20,0x60 }, { 0xe3,0xfc,0xfc,0x1f },
+    { 0x79,0xb1,0xb1,0xc8 }, { 0xb6,0x5b,0x5b,0xed },
+    { 0xd4,0x6a,0x6a,0xbe }, { 0x8d,0xcb,0xcb,0x46 },
+    { 0x67,0xbe,0xbe,0xd9 }, { 0x72,0x39,0x39,0x4b },
+    { 0x94,0x4a,0x4a,0xde }, { 0x98,0x4c,0x4c,0xd4 },
+    { 0xb0,0x58,0x58,0xe8 }, { 0x85,0xcf,0xcf,0x4a },
+    { 0xbb,0xd0,0xd0,0x6b }, { 0xc5,0xef,0xef,0x2a },
+    { 0x4f,0xaa,0xaa,0xe5 }, { 0xed,0xfb,0xfb,0x16 },
+    { 0x86,0x43,0x43,0xc5 }, { 0x9a,0x4d,0x4d,0xd7 },
+    { 0x66,0x33,0x33,0x55 }, { 0x11,0x85,0x85,0x94 },
+    { 0x8a,0x45,0x45,0xcf }, { 0xe9,0xf9,0xf9,0x10 },
+    { 0x04,0x02,0x02,0x06 }, { 0xfe,0x7f,0x7f,0x81 },
+    { 0xa0,0x50,0x50,0xf0 }, { 0x78,0x3c,0x3c,0x44 },
+    { 0x25,0x9f,0x9f,0xba }, { 0x4b,0xa8,0xa8,0xe3 },
+    { 0xa2,0x51,0x51,0xf3 }, { 0x5d,0xa3,0xa3,0xfe },
+    { 0x80,0x40,0x40,0xc0 }, { 0x05,0x8f,0x8f,0x8a },
+    { 0x3f,0x92,0x92,0xad }, { 0x21,0x9d,0x9d,0xbc },
+    { 0x70,0x38,0x38,0x48 }, { 0xf1,0xf5,0xf5,0x04 },
+    { 0x63,0xbc,0xbc,0xdf }, { 0x77,0xb6,0xb6,0xc1 },
+    { 0xaf,0xda,0xda,0x75 }, { 0x42,0x21,0x21,0x63 },
+    { 0x20,0x10,0x10,0x30 }, { 0xe5,0xff,0xff,0x1a },
+    { 0xfd,0xf3,0xf3,0x0e }, { 0xbf,0xd2,0xd2,0x6d },
+    { 0x81,0xcd,0xcd,0x4c }, { 0x18,0x0c,0x0c,0x14 },
+    { 0x26,0x13,0x13,0x35 }, { 0xc3,0xec,0xec,0x2f },
+    { 0xbe,0x5f,0x5f,0xe1 }, { 0x35,0x97,0x97,0xa2 },
+    { 0x88,0x44,0x44,0xcc }, { 0x2e,0x17,0x17,0x39 },
+    { 0x93,0xc4,0xc4,0x57 }, { 0x55,0xa7,0xa7,0xf2 },
+    { 0xfc,0x7e,0x7e,0x82 }, { 0x7a,0x3d,0x3d,0x47 },
+    { 0xc8,0x64,0x64,0xac }, { 0xba,0x5d,0x5d,0xe7 },
+    { 0x32,0x19,0x19,0x2b }, { 0xe6,0x73,0x73,0x95 },
+    { 0xc0,0x60,0x60,0xa0 }, { 0x19,0x81,0x81,0x98 },
+    { 0x9e,0x4f,0x4f,0xd1 }, { 0xa3,0xdc,0xdc,0x7f },
+    { 0x44,0x22,0x22,0x66 }, { 0x54,0x2a,0x2a,0x7e },
+    { 0x3b,0x90,0x90,0xab }, { 0x0b,0x88,0x88,0x83 },
+    { 0x8c,0x46,0x46,0xca }, { 0xc7,0xee,0xee,0x29 },
+    { 0x6b,0xb8,0xb8,0xd3 }, { 0x28,0x14,0x14,0x3c },
+    { 0xa7,0xde,0xde,0x79 }, { 0xbc,0x5e,0x5e,0xe2 },
+    { 0x16,0x0b,0x0b,0x1d }, { 0xad,0xdb,0xdb,0x76 },
+    { 0xdb,0xe0,0xe0,0x3b }, { 0x64,0x32,0x32,0x56 },
+    { 0x74,0x3a,0x3a,0x4e }, { 0x14,0x0a,0x0a,0x1e },
+    { 0x92,0x49,0x49,0xdb }, { 0x0c,0x06,0x06,0x0a },
+    { 0x48,0x24,0x24,0x6c }, { 0xb8,0x5c,0x5c,0xe4 },
+    { 0x9f,0xc2,0xc2,0x5d }, { 0xbd,0xd3,0xd3,0x6e },
+    { 0x43,0xac,0xac,0xef }, { 0xc4,0x62,0x62,0xa6 },
+    { 0x39,0x91,0x91,0xa8 }, { 0x31,0x95,0x95,0xa4 },
+    { 0xd3,0xe4,0xe4,0x37 }, { 0xf2,0x79,0x79,0x8b },
+    { 0xd5,0xe7,0xe7,0x32 }, { 0x8b,0xc8,0xc8,0x43 },
+    { 0x6e,0x37,0x37,0x59 }, { 0xda,0x6d,0x6d,0xb7 },
+    { 0x01,0x8d,0x8d,0x8c }, { 0xb1,0xd5,0xd5,0x64 },
+    { 0x9c,0x4e,0x4e,0xd2 }, { 0x49,0xa9,0xa9,0xe0 },
+    { 0xd8,0x6c,0x6c,0xb4 }, { 0xac,0x56,0x56,0xfa },
+    { 0xf3,0xf4,0xf4,0x07 }, { 0xcf,0xea,0xea,0x25 },
+    { 0xca,0x65,0x65,0xaf }, { 0xf4,0x7a,0x7a,0x8e },
+    { 0x47,0xae,0xae,0xe9 }, { 0x10,0x08,0x08,0x18 },
+    { 0x6f,0xba,0xba,0xd5 }, { 0xf0,0x78,0x78,0x88 },
+    { 0x4a,0x25,0x25,0x6f }, { 0x5c,0x2e,0x2e,0x72 },
+    { 0x38,0x1c,0x1c,0x24 }, { 0x57,0xa6,0xa6,0xf1 },
+    { 0x73,0xb4,0xb4,0xc7 }, { 0x97,0xc6,0xc6,0x51 },
+    { 0xcb,0xe8,0xe8,0x23 }, { 0xa1,0xdd,0xdd,0x7c },
+    { 0xe8,0x74,0x74,0x9c }, { 0x3e,0x1f,0x1f,0x21 },
+    { 0x96,0x4b,0x4b,0xdd }, { 0x61,0xbd,0xbd,0xdc },
+    { 0x0d,0x8b,0x8b,0x86 }, { 0x0f,0x8a,0x8a,0x85 },
+    { 0xe0,0x70,0x70,0x90 }, { 0x7c,0x3e,0x3e,0x42 },
+    { 0x71,0xb5,0xb5,0xc4 }, { 0xcc,0x66,0x66,0xaa },
+    { 0x90,0x48,0x48,0xd8 }, { 0x06,0x03,0x03,0x05 },
+    { 0xf7,0xf6,0xf6,0x01 }, { 0x1c,0x0e,0x0e,0x12 },
+    { 0xc2,0x61,0x61,0xa3 }, { 0x6a,0x35,0x35,0x5f },
+    { 0xae,0x57,0x57,0xf9 }, { 0x69,0xb9,0xb9,0xd0 },
+    { 0x17,0x86,0x86,0x91 }, { 0x99,0xc1,0xc1,0x58 },
+    { 0x3a,0x1d,0x1d,0x27 }, { 0x27,0x9e,0x9e,0xb9 },
+    { 0xd9,0xe1,0xe1,0x38 }, { 0xeb,0xf8,0xf8,0x13 },
+    { 0x2b,0x98,0x98,0xb3 }, { 0x22,0x11,0x11,0x33 },
+    { 0xd2,0x69,0x69,0xbb }, { 0xa9,0xd9,0xd9,0x70 },
+    { 0x07,0x8e,0x8e,0x89 }, { 0x33,0x94,0x94,0xa7 },
+    { 0x2d,0x9b,0x9b,0xb6 }, { 0x3c,0x1e,0x1e,0x22 },
+    { 0x15,0x87,0x87,0x92 }, { 0xc9,0xe9,0xe9,0x20 },
+    { 0x87,0xce,0xce,0x49 }, { 0xaa,0x55,0x55,0xff },
+    { 0x50,0x28,0x28,0x78 }, { 0xa5,0xdf,0xdf,0x7a },
+    { 0x03,0x8c,0x8c,0x8f }, { 0x59,0xa1,0xa1,0xf8 },
+    { 0x09,0x89,0x89,0x80 }, { 0x1a,0x0d,0x0d,0x17 },
+    { 0x65,0xbf,0xbf,0xda }, { 0xd7,0xe6,0xe6,0x31 },
+    { 0x84,0x42,0x42,0xc6 }, { 0xd0,0x68,0x68,0xb8 },
+    { 0x82,0x41,0x41,0xc3 }, { 0x29,0x99,0x99,0xb0 },
+    { 0x5a,0x2d,0x2d,0x77 }, { 0x1e,0x0f,0x0f,0x11 },
+    { 0x7b,0xb0,0xb0,0xcb }, { 0xa8,0x54,0x54,0xfc },
+    { 0x6d,0xbb,0xbb,0xd6 }, { 0x2c,0x16,0x16,0x3a }
+};
+
+static const byte T2[256][4] =
+{
+    { 0xa5,0xc6,0x63,0x63 }, { 0x84,0xf8,0x7c,0x7c },
+    { 0x99,0xee,0x77,0x77 }, { 0x8d,0xf6,0x7b,0x7b },
+    { 0x0d,0xff,0xf2,0xf2 }, { 0xbd,0xd6,0x6b,0x6b },
+    { 0xb1,0xde,0x6f,0x6f }, { 0x54,0x91,0xc5,0xc5 },
+    { 0x50,0x60,0x30,0x30 }, { 0x03,0x02,0x01,0x01 },
+    { 0xa9,0xce,0x67,0x67 }, { 0x7d,0x56,0x2b,0x2b },
+    { 0x19,0xe7,0xfe,0xfe }, { 0x62,0xb5,0xd7,0xd7 },
+    { 0xe6,0x4d,0xab,0xab }, { 0x9a,0xec,0x76,0x76 },
+    { 0x45,0x8f,0xca,0xca }, { 0x9d,0x1f,0x82,0x82 },
+    { 0x40,0x89,0xc9,0xc9 }, { 0x87,0xfa,0x7d,0x7d },
+    { 0x15,0xef,0xfa,0xfa }, { 0xeb,0xb2,0x59,0x59 },
+    { 0xc9,0x8e,0x47,0x47 }, { 0x0b,0xfb,0xf0,0xf0 },
+    { 0xec,0x41,0xad,0xad }, { 0x67,0xb3,0xd4,0xd4 },
+    { 0xfd,0x5f,0xa2,0xa2 }, { 0xea,0x45,0xaf,0xaf },
+    { 0xbf,0x23,0x9c,0x9c }, { 0xf7,0x53,0xa4,0xa4 },
+    { 0x96,0xe4,0x72,0x72 }, { 0x5b,0x9b,0xc0,0xc0 },
+    { 0xc2,0x75,0xb7,0xb7 }, { 0x1c,0xe1,0xfd,0xfd },
+    { 0xae,0x3d,0x93,0x93 }, { 0x6a,0x4c,0x26,0x26 },
+    { 0x5a,0x6c,0x36,0x36 }, { 0x41,0x7e,0x3f,0x3f },
+    { 0x02,0xf5,0xf7,0xf7 }, { 0x4f,0x83,0xcc,0xcc },
+    { 0x5c,0x68,0x34,0x34 }, { 0xf4,0x51,0xa5,0xa5 },
+    { 0x34,0xd1,0xe5,0xe5 }, { 0x08,0xf9,0xf1,0xf1 },
+    { 0x93,0xe2,0x71,0x71 }, { 0x73,0xab,0xd8,0xd8 },
+    { 0x53,0x62,0x31,0x31 }, { 0x3f,0x2a,0x15,0x15 },
+    { 0x0c,0x08,0x04,0x04 }, { 0x52,0x95,0xc7,0xc7 },
+    { 0x65,0x46,0x23,0x23 }, { 0x5e,0x9d,0xc3,0xc3 },
+    { 0x28,0x30,0x18,0x18 }, { 0xa1,0x37,0x96,0x96 },
+    { 0x0f,0x0a,0x05,0x05 }, { 0xb5,0x2f,0x9a,0x9a },
+    { 0x09,0x0e,0x07,0x07 }, { 0x36,0x24,0x12,0x12 },
+    { 0x9b,0x1b,0x80,0x80 }, { 0x3d,0xdf,0xe2,0xe2 },
+    { 0x26,0xcd,0xeb,0xeb }, { 0x69,0x4e,0x27,0x27 },
+    { 0xcd,0x7f,0xb2,0xb2 }, { 0x9f,0xea,0x75,0x75 },
+    { 0x1b,0x12,0x09,0x09 }, { 0x9e,0x1d,0x83,0x83 },
+    { 0x74,0x58,0x2c,0x2c }, { 0x2e,0x34,0x1a,0x1a },
+    { 0x2d,0x36,0x1b,0x1b }, { 0xb2,0xdc,0x6e,0x6e },
+    { 0xee,0xb4,0x5a,0x5a }, { 0xfb,0x5b,0xa0,0xa0 },
+    { 0xf6,0xa4,0x52,0x52 }, { 0x4d,0x76,0x3b,0x3b },
+    { 0x61,0xb7,0xd6,0xd6 }, { 0xce,0x7d,0xb3,0xb3 },
+    { 0x7b,0x52,0x29,0x29 }, { 0x3e,0xdd,0xe3,0xe3 },
+    { 0x71,0x5e,0x2f,0x2f }, { 0x97,0x13,0x84,0x84 },
+    { 0xf5,0xa6,0x53,0x53 }, { 0x68,0xb9,0xd1,0xd1 },
+    { 0x00,0x00,0x00,0x00 }, { 0x2c,0xc1,0xed,0xed },
+    { 0x60,0x40,0x20,0x20 }, { 0x1f,0xe3,0xfc,0xfc },
+    { 0xc8,0x79,0xb1,0xb1 }, { 0xed,0xb6,0x5b,0x5b },
+    { 0xbe,0xd4,0x6a,0x6a }, { 0x46,0x8d,0xcb,0xcb },
+    { 0xd9,0x67,0xbe,0xbe }, { 0x4b,0x72,0x39,0x39 },
+    { 0xde,0x94,0x4a,0x4a }, { 0xd4,0x98,0x4c,0x4c },
+    { 0xe8,0xb0,0x58,0x58 }, { 0x4a,0x85,0xcf,0xcf },
+    { 0x6b,0xbb,0xd0,0xd0 }, { 0x2a,0xc5,0xef,0xef },
+    { 0xe5,0x4f,0xaa,0xaa }, { 0x16,0xed,0xfb,0xfb },
+    { 0xc5,0x86,0x43,0x43 }, { 0xd7,0x9a,0x4d,0x4d },
+    { 0x55,0x66,0x33,0x33 }, { 0x94,0x11,0x85,0x85 },
+    { 0xcf,0x8a,0x45,0x45 }, { 0x10,0xe9,0xf9,0xf9 },
+    { 0x06,0x04,0x02,0x02 }, { 0x81,0xfe,0x7f,0x7f },
+    { 0xf0,0xa0,0x50,0x50 }, { 0x44,0x78,0x3c,0x3c },
+    { 0xba,0x25,0x9f,0x9f }, { 0xe3,0x4b,0xa8,0xa8 },
+    { 0xf3,0xa2,0x51,0x51 }, { 0xfe,0x5d,0xa3,0xa3 },
+    { 0xc0,0x80,0x40,0x40 }, { 0x8a,0x05,0x8f,0x8f },
+    { 0xad,0x3f,0x92,0x92 }, { 0xbc,0x21,0x9d,0x9d },
+    { 0x48,0x70,0x38,0x38 }, { 0x04,0xf1,0xf5,0xf5 },
+    { 0xdf,0x63,0xbc,0xbc }, { 0xc1,0x77,0xb6,0xb6 },
+    { 0x75,0xaf,0xda,0xda }, { 0x63,0x42,0x21,0x21 },
+    { 0x30,0x20,0x10,0x10 }, { 0x1a,0xe5,0xff,0xff },
+    { 0x0e,0xfd,0xf3,0xf3 }, { 0x6d,0xbf,0xd2,0xd2 },
+    { 0x4c,0x81,0xcd,0xcd }, { 0x14,0x18,0x0c,0x0c },
+    { 0x35,0x26,0x13,0x13 }, { 0x2f,0xc3,0xec,0xec },
+    { 0xe1,0xbe,0x5f,0x5f }, { 0xa2,0x35,0x97,0x97 },
+    { 0xcc,0x88,0x44,0x44 }, { 0x39,0x2e,0x17,0x17 },
+    { 0x57,0x93,0xc4,0xc4 }, { 0xf2,0x55,0xa7,0xa7 },
+    { 0x82,0xfc,0x7e,0x7e }, { 0x47,0x7a,0x3d,0x3d },
+    { 0xac,0xc8,0x64,0x64 }, { 0xe7,0xba,0x5d,0x5d },
+    { 0x2b,0x32,0x19,0x19 }, { 0x95,0xe6,0x73,0x73 },
+    { 0xa0,0xc0,0x60,0x60 }, { 0x98,0x19,0x81,0x81 },
+    { 0xd1,0x9e,0x4f,0x4f }, { 0x7f,0xa3,0xdc,0xdc },
+    { 0x66,0x44,0x22,0x22 }, { 0x7e,0x54,0x2a,0x2a },
+    { 0xab,0x3b,0x90,0x90 }, { 0x83,0x0b,0x88,0x88 },
+    { 0xca,0x8c,0x46,0x46 }, { 0x29,0xc7,0xee,0xee },
+    { 0xd3,0x6b,0xb8,0xb8 }, { 0x3c,0x28,0x14,0x14 },
+    { 0x79,0xa7,0xde,0xde }, { 0xe2,0xbc,0x5e,0x5e },
+    { 0x1d,0x16,0x0b,0x0b }, { 0x76,0xad,0xdb,0xdb },
+    { 0x3b,0xdb,0xe0,0xe0 }, { 0x56,0x64,0x32,0x32 },
+    { 0x4e,0x74,0x3a,0x3a }, { 0x1e,0x14,0x0a,0x0a },
+    { 0xdb,0x92,0x49,0x49 }, { 0x0a,0x0c,0x06,0x06 },
+    { 0x6c,0x48,0x24,0x24 }, { 0xe4,0xb8,0x5c,0x5c },
+    { 0x5d,0x9f,0xc2,0xc2 }, { 0x6e,0xbd,0xd3,0xd3 },
+    { 0xef,0x43,0xac,0xac }, { 0xa6,0xc4,0x62,0x62 },
+    { 0xa8,0x39,0x91,0x91 }, { 0xa4,0x31,0x95,0x95 },
+    { 0x37,0xd3,0xe4,0xe4 }, { 0x8b,0xf2,0x79,0x79 },
+    { 0x32,0xd5,0xe7,0xe7 }, { 0x43,0x8b,0xc8,0xc8 },
+    { 0x59,0x6e,0x37,0x37 }, { 0xb7,0xda,0x6d,0x6d },
+    { 0x8c,0x01,0x8d,0x8d }, { 0x64,0xb1,0xd5,0xd5 },
+    { 0xd2,0x9c,0x4e,0x4e }, { 0xe0,0x49,0xa9,0xa9 },
+    { 0xb4,0xd8,0x6c,0x6c }, { 0xfa,0xac,0x56,0x56 },
+    { 0x07,0xf3,0xf4,0xf4 }, { 0x25,0xcf,0xea,0xea },
+    { 0xaf,0xca,0x65,0x65 }, { 0x8e,0xf4,0x7a,0x7a },
+    { 0xe9,0x47,0xae,0xae }, { 0x18,0x10,0x08,0x08 },
+    { 0xd5,0x6f,0xba,0xba }, { 0x88,0xf0,0x78,0x78 },
+    { 0x6f,0x4a,0x25,0x25 }, { 0x72,0x5c,0x2e,0x2e },
+    { 0x24,0x38,0x1c,0x1c }, { 0xf1,0x57,0xa6,0xa6 },
+    { 0xc7,0x73,0xb4,0xb4 }, { 0x51,0x97,0xc6,0xc6 },
+    { 0x23,0xcb,0xe8,0xe8 }, { 0x7c,0xa1,0xdd,0xdd },
+    { 0x9c,0xe8,0x74,0x74 }, { 0x21,0x3e,0x1f,0x1f },
+    { 0xdd,0x96,0x4b,0x4b }, { 0xdc,0x61,0xbd,0xbd },
+    { 0x86,0x0d,0x8b,0x8b }, { 0x85,0x0f,0x8a,0x8a },
+    { 0x90,0xe0,0x70,0x70 }, { 0x42,0x7c,0x3e,0x3e },
+    { 0xc4,0x71,0xb5,0xb5 }, { 0xaa,0xcc,0x66,0x66 },
+    { 0xd8,0x90,0x48,0x48 }, { 0x05,0x06,0x03,0x03 },
+    { 0x01,0xf7,0xf6,0xf6 }, { 0x12,0x1c,0x0e,0x0e },
+    { 0xa3,0xc2,0x61,0x61 }, { 0x5f,0x6a,0x35,0x35 },
+    { 0xf9,0xae,0x57,0x57 }, { 0xd0,0x69,0xb9,0xb9 },
+    { 0x91,0x17,0x86,0x86 }, { 0x58,0x99,0xc1,0xc1 },
+    { 0x27,0x3a,0x1d,0x1d }, { 0xb9,0x27,0x9e,0x9e },
+    { 0x38,0xd9,0xe1,0xe1 }, { 0x13,0xeb,0xf8,0xf8 },
+    { 0xb3,0x2b,0x98,0x98 }, { 0x33,0x22,0x11,0x11 },
+    { 0xbb,0xd2,0x69,0x69 }, { 0x70,0xa9,0xd9,0xd9 },
+    { 0x89,0x07,0x8e,0x8e }, { 0xa7,0x33,0x94,0x94 },
+    { 0xb6,0x2d,0x9b,0x9b }, { 0x22,0x3c,0x1e,0x1e },
+    { 0x92,0x15,0x87,0x87 }, { 0x20,0xc9,0xe9,0xe9 },
+    { 0x49,0x87,0xce,0xce }, { 0xff,0xaa,0x55,0x55 },
+    { 0x78,0x50,0x28,0x28 }, { 0x7a,0xa5,0xdf,0xdf },
+    { 0x8f,0x03,0x8c,0x8c }, { 0xf8,0x59,0xa1,0xa1 },
+    { 0x80,0x09,0x89,0x89 }, { 0x17,0x1a,0x0d,0x0d },
+    { 0xda,0x65,0xbf,0xbf }, { 0x31,0xd7,0xe6,0xe6 },
+    { 0xc6,0x84,0x42,0x42 }, { 0xb8,0xd0,0x68,0x68 },
+    { 0xc3,0x82,0x41,0x41 }, { 0xb0,0x29,0x99,0x99 },
+    { 0x77,0x5a,0x2d,0x2d }, { 0x11,0x1e,0x0f,0x0f },
+    { 0xcb,0x7b,0xb0,0xb0 }, { 0xfc,0xa8,0x54,0x54 },
+    { 0xd6,0x6d,0xbb,0xbb }, { 0x3a,0x2c,0x16,0x16 }
+};
+
+static const byte T3[256][4] =
+{
+    { 0x63,0xa5,0xc6,0x63 }, { 0x7c,0x84,0xf8,0x7c },
+    { 0x77,0x99,0xee,0x77 }, { 0x7b,0x8d,0xf6,0x7b },
+    { 0xf2,0x0d,0xff,0xf2 }, { 0x6b,0xbd,0xd6,0x6b },
+    { 0x6f,0xb1,0xde,0x6f }, { 0xc5,0x54,0x91,0xc5 },
+    { 0x30,0x50,0x60,0x30 }, { 0x01,0x03,0x02,0x01 },
+    { 0x67,0xa9,0xce,0x67 }, { 0x2b,0x7d,0x56,0x2b },
+    { 0xfe,0x19,0xe7,0xfe }, { 0xd7,0x62,0xb5,0xd7 },
+    { 0xab,0xe6,0x4d,0xab }, { 0x76,0x9a,0xec,0x76 },
+    { 0xca,0x45,0x8f,0xca }, { 0x82,0x9d,0x1f,0x82 },
+    { 0xc9,0x40,0x89,0xc9 }, { 0x7d,0x87,0xfa,0x7d },
+    { 0xfa,0x15,0xef,0xfa }, { 0x59,0xeb,0xb2,0x59 },
+    { 0x47,0xc9,0x8e,0x47 }, { 0xf0,0x0b,0xfb,0xf0 },
+    { 0xad,0xec,0x41,0xad }, { 0xd4,0x67,0xb3,0xd4 },
+    { 0xa2,0xfd,0x5f,0xa2 }, { 0xaf,0xea,0x45,0xaf },
+    { 0x9c,0xbf,0x23,0x9c }, { 0xa4,0xf7,0x53,0xa4 },
+    { 0x72,0x96,0xe4,0x72 }, { 0xc0,0x5b,0x9b,0xc0 },
+    { 0xb7,0xc2,0x75,0xb7 }, { 0xfd,0x1c,0xe1,0xfd },
+    { 0x93,0xae,0x3d,0x93 }, { 0x26,0x6a,0x4c,0x26 },
+    { 0x36,0x5a,0x6c,0x36 }, { 0x3f,0x41,0x7e,0x3f },
+    { 0xf7,0x02,0xf5,0xf7 }, { 0xcc,0x4f,0x83,0xcc },
+    { 0x34,0x5c,0x68,0x34 }, { 0xa5,0xf4,0x51,0xa5 },
+    { 0xe5,0x34,0xd1,0xe5 }, { 0xf1,0x08,0xf9,0xf1 },
+    { 0x71,0x93,0xe2,0x71 }, { 0xd8,0x73,0xab,0xd8 },
+    { 0x31,0x53,0x62,0x31 }, { 0x15,0x3f,0x2a,0x15 },
+    { 0x04,0x0c,0x08,0x04 }, { 0xc7,0x52,0x95,0xc7 },
+    { 0x23,0x65,0x46,0x23 }, { 0xc3,0x5e,0x9d,0xc3 },
+    { 0x18,0x28,0x30,0x18 }, { 0x96,0xa1,0x37,0x96 },
+    { 0x05,0x0f,0x0a,0x05 }, { 0x9a,0xb5,0x2f,0x9a },
+    { 0x07,0x09,0x0e,0x07 }, { 0x12,0x36,0x24,0x12 },
+    { 0x80,0x9b,0x1b,0x80 }, { 0xe2,0x3d,0xdf,0xe2 },
+    { 0xeb,0x26,0xcd,0xeb }, { 0x27,0x69,0x4e,0x27 },
+    { 0xb2,0xcd,0x7f,0xb2 }, { 0x75,0x9f,0xea,0x75 },
+    { 0x09,0x1b,0x12,0x09 }, { 0x83,0x9e,0x1d,0x83 },
+    { 0x2c,0x74,0x58,0x2c }, { 0x1a,0x2e,0x34,0x1a },
+    { 0x1b,0x2d,0x36,0x1b }, { 0x6e,0xb2,0xdc,0x6e },
+    { 0x5a,0xee,0xb4,0x5a }, { 0xa0,0xfb,0x5b,0xa0 },
+    { 0x52,0xf6,0xa4,0x52 }, { 0x3b,0x4d,0x76,0x3b },
+    { 0xd6,0x61,0xb7,0xd6 }, { 0xb3,0xce,0x7d,0xb3 },
+    { 0x29,0x7b,0x52,0x29 }, { 0xe3,0x3e,0xdd,0xe3 },
+    { 0x2f,0x71,0x5e,0x2f }, { 0x84,0x97,0x13,0x84 },
+    { 0x53,0xf5,0xa6,0x53 }, { 0xd1,0x68,0xb9,0xd1 },
+    { 0x00,0x00,0x00,0x00 }, { 0xed,0x2c,0xc1,0xed },
+    { 0x20,0x60,0x40,0x20 }, { 0xfc,0x1f,0xe3,0xfc },
+    { 0xb1,0xc8,0x79,0xb1 }, { 0x5b,0xed,0xb6,0x5b },
+    { 0x6a,0xbe,0xd4,0x6a }, { 0xcb,0x46,0x8d,0xcb },
+    { 0xbe,0xd9,0x67,0xbe }, { 0x39,0x4b,0x72,0x39 },
+    { 0x4a,0xde,0x94,0x4a }, { 0x4c,0xd4,0x98,0x4c },
+    { 0x58,0xe8,0xb0,0x58 }, { 0xcf,0x4a,0x85,0xcf },
+    { 0xd0,0x6b,0xbb,0xd0 }, { 0xef,0x2a,0xc5,0xef },
+    { 0xaa,0xe5,0x4f,0xaa }, { 0xfb,0x16,0xed,0xfb },
+    { 0x43,0xc5,0x86,0x43 }, { 0x4d,0xd7,0x9a,0x4d },
+    { 0x33,0x55,0x66,0x33 }, { 0x85,0x94,0x11,0x85 },
+    { 0x45,0xcf,0x8a,0x45 }, { 0xf9,0x10,0xe9,0xf9 },
+    { 0x02,0x06,0x04,0x02 }, { 0x7f,0x81,0xfe,0x7f },
+    { 0x50,0xf0,0xa0,0x50 }, { 0x3c,0x44,0x78,0x3c },
+    { 0x9f,0xba,0x25,0x9f }, { 0xa8,0xe3,0x4b,0xa8 },
+    { 0x51,0xf3,0xa2,0x51 }, { 0xa3,0xfe,0x5d,0xa3 },
+    { 0x40,0xc0,0x80,0x40 }, { 0x8f,0x8a,0x05,0x8f },
+    { 0x92,0xad,0x3f,0x92 }, { 0x9d,0xbc,0x21,0x9d },
+    { 0x38,0x48,0x70,0x38 }, { 0xf5,0x04,0xf1,0xf5 },
+    { 0xbc,0xdf,0x63,0xbc }, { 0xb6,0xc1,0x77,0xb6 },
+    { 0xda,0x75,0xaf,0xda }, { 0x21,0x63,0x42,0x21 },
+    { 0x10,0x30,0x20,0x10 }, { 0xff,0x1a,0xe5,0xff },
+    { 0xf3,0x0e,0xfd,0xf3 }, { 0xd2,0x6d,0xbf,0xd2 },
+    { 0xcd,0x4c,0x81,0xcd }, { 0x0c,0x14,0x18,0x0c },
+    { 0x13,0x35,0x26,0x13 }, { 0xec,0x2f,0xc3,0xec },
+    { 0x5f,0xe1,0xbe,0x5f }, { 0x97,0xa2,0x35,0x97 },
+    { 0x44,0xcc,0x88,0x44 }, { 0x17,0x39,0x2e,0x17 },
+    { 0xc4,0x57,0x93,0xc4 }, { 0xa7,0xf2,0x55,0xa7 },
+    { 0x7e,0x82,0xfc,0x7e }, { 0x3d,0x47,0x7a,0x3d },
+    { 0x64,0xac,0xc8,0x64 }, { 0x5d,0xe7,0xba,0x5d },
+    { 0x19,0x2b,0x32,0x19 }, { 0x73,0x95,0xe6,0x73 },
+    { 0x60,0xa0,0xc0,0x60 }, { 0x81,0x98,0x19,0x81 },
+    { 0x4f,0xd1,0x9e,0x4f }, { 0xdc,0x7f,0xa3,0xdc },
+    { 0x22,0x66,0x44,0x22 }, { 0x2a,0x7e,0x54,0x2a },
+    { 0x90,0xab,0x3b,0x90 }, { 0x88,0x83,0x0b,0x88 },
+    { 0x46,0xca,0x8c,0x46 }, { 0xee,0x29,0xc7,0xee },
+    { 0xb8,0xd3,0x6b,0xb8 }, { 0x14,0x3c,0x28,0x14 },
+    { 0xde,0x79,0xa7,0xde }, { 0x5e,0xe2,0xbc,0x5e },
+    { 0x0b,0x1d,0x16,0x0b }, { 0xdb,0x76,0xad,0xdb },
+    { 0xe0,0x3b,0xdb,0xe0 }, { 0x32,0x56,0x64,0x32 },
+    { 0x3a,0x4e,0x74,0x3a }, { 0x0a,0x1e,0x14,0x0a },
+    { 0x49,0xdb,0x92,0x49 }, { 0x06,0x0a,0x0c,0x06 },
+    { 0x24,0x6c,0x48,0x24 }, { 0x5c,0xe4,0xb8,0x5c },
+    { 0xc2,0x5d,0x9f,0xc2 }, { 0xd3,0x6e,0xbd,0xd3 },
+    { 0xac,0xef,0x43,0xac }, { 0x62,0xa6,0xc4,0x62 },
+    { 0x91,0xa8,0x39,0x91 }, { 0x95,0xa4,0x31,0x95 },
+    { 0xe4,0x37,0xd3,0xe4 }, { 0x79,0x8b,0xf2,0x79 },
+    { 0xe7,0x32,0xd5,0xe7 }, { 0xc8,0x43,0x8b,0xc8 },
+    { 0x37,0x59,0x6e,0x37 }, { 0x6d,0xb7,0xda,0x6d },
+    { 0x8d,0x8c,0x01,0x8d }, { 0xd5,0x64,0xb1,0xd5 },
+    { 0x4e,0xd2,0x9c,0x4e }, { 0xa9,0xe0,0x49,0xa9 },
+    { 0x6c,0xb4,0xd8,0x6c }, { 0x56,0xfa,0xac,0x56 },
+    { 0xf4,0x07,0xf3,0xf4 }, { 0xea,0x25,0xcf,0xea },
+    { 0x65,0xaf,0xca,0x65 }, { 0x7a,0x8e,0xf4,0x7a },
+    { 0xae,0xe9,0x47,0xae }, { 0x08,0x18,0x10,0x08 },
+    { 0xba,0xd5,0x6f,0xba }, { 0x78,0x88,0xf0,0x78 },
+    { 0x25,0x6f,0x4a,0x25 }, { 0x2e,0x72,0x5c,0x2e },
+    { 0x1c,0x24,0x38,0x1c }, { 0xa6,0xf1,0x57,0xa6 },
+    { 0xb4,0xc7,0x73,0xb4 }, { 0xc6,0x51,0x97,0xc6 },
+    { 0xe8,0x23,0xcb,0xe8 }, { 0xdd,0x7c,0xa1,0xdd },
+    { 0x74,0x9c,0xe8,0x74 }, { 0x1f,0x21,0x3e,0x1f },
+    { 0x4b,0xdd,0x96,0x4b }, { 0xbd,0xdc,0x61,0xbd },
+    { 0x8b,0x86,0x0d,0x8b }, { 0x8a,0x85,0x0f,0x8a },
+    { 0x70,0x90,0xe0,0x70 }, { 0x3e,0x42,0x7c,0x3e },
+    { 0xb5,0xc4,0x71,0xb5 }, { 0x66,0xaa,0xcc,0x66 },
+    { 0x48,0xd8,0x90,0x48 }, { 0x03,0x05,0x06,0x03 },
+    { 0xf6,0x01,0xf7,0xf6 }, { 0x0e,0x12,0x1c,0x0e },
+    { 0x61,0xa3,0xc2,0x61 }, { 0x35,0x5f,0x6a,0x35 },
+    { 0x57,0xf9,0xae,0x57 }, { 0xb9,0xd0,0x69,0xb9 },
+    { 0x86,0x91,0x17,0x86 }, { 0xc1,0x58,0x99,0xc1 },
+    { 0x1d,0x27,0x3a,0x1d }, { 0x9e,0xb9,0x27,0x9e },
+    { 0xe1,0x38,0xd9,0xe1 }, { 0xf8,0x13,0xeb,0xf8 },
+    { 0x98,0xb3,0x2b,0x98 }, { 0x11,0x33,0x22,0x11 },
+    { 0x69,0xbb,0xd2,0x69 }, { 0xd9,0x70,0xa9,0xd9 },
+    { 0x8e,0x89,0x07,0x8e }, { 0x94,0xa7,0x33,0x94 },
+    { 0x9b,0xb6,0x2d,0x9b }, { 0x1e,0x22,0x3c,0x1e },
+    { 0x87,0x92,0x15,0x87 }, { 0xe9,0x20,0xc9,0xe9 },
+    { 0xce,0x49,0x87,0xce }, { 0x55,0xff,0xaa,0x55 },
+    { 0x28,0x78,0x50,0x28 }, { 0xdf,0x7a,0xa5,0xdf },
+    { 0x8c,0x8f,0x03,0x8c }, { 0xa1,0xf8,0x59,0xa1 },
+    { 0x89,0x80,0x09,0x89 }, { 0x0d,0x17,0x1a,0x0d },
+    { 0xbf,0xda,0x65,0xbf }, { 0xe6,0x31,0xd7,0xe6 },
+    { 0x42,0xc6,0x84,0x42 }, { 0x68,0xb8,0xd0,0x68 },
+    { 0x41,0xc3,0x82,0x41 }, { 0x99,0xb0,0x29,0x99 },
+    { 0x2d,0x77,0x5a,0x2d }, { 0x0f,0x11,0x1e,0x0f },
+    { 0xb0,0xcb,0x7b,0xb0 }, { 0x54,0xfc,0xa8,0x54 },
+    { 0xbb,0xd6,0x6d,0xbb }, { 0x16,0x3a,0x2c,0x16 }
+};
+
+static const byte T4[256][4] =
+{
+    { 0x63,0x63,0xa5,0xc6 }, { 0x7c,0x7c,0x84,0xf8 },
+    { 0x77,0x77,0x99,0xee }, { 0x7b,0x7b,0x8d,0xf6 },
+    { 0xf2,0xf2,0x0d,0xff }, { 0x6b,0x6b,0xbd,0xd6 },
+    { 0x6f,0x6f,0xb1,0xde }, { 0xc5,0xc5,0x54,0x91 },
+    { 0x30,0x30,0x50,0x60 }, { 0x01,0x01,0x03,0x02 },
+    { 0x67,0x67,0xa9,0xce }, { 0x2b,0x2b,0x7d,0x56 },
+    { 0xfe,0xfe,0x19,0xe7 }, { 0xd7,0xd7,0x62,0xb5 },
+    { 0xab,0xab,0xe6,0x4d }, { 0x76,0x76,0x9a,0xec },
+    { 0xca,0xca,0x45,0x8f }, { 0x82,0x82,0x9d,0x1f },
+    { 0xc9,0xc9,0x40,0x89 }, { 0x7d,0x7d,0x87,0xfa },
+    { 0xfa,0xfa,0x15,0xef }, { 0x59,0x59,0xeb,0xb2 },
+    { 0x47,0x47,0xc9,0x8e }, { 0xf0,0xf0,0x0b,0xfb },
+    { 0xad,0xad,0xec,0x41 }, { 0xd4,0xd4,0x67,0xb3 },
+    { 0xa2,0xa2,0xfd,0x5f }, { 0xaf,0xaf,0xea,0x45 },
+    { 0x9c,0x9c,0xbf,0x23 }, { 0xa4,0xa4,0xf7,0x53 },
+    { 0x72,0x72,0x96,0xe4 }, { 0xc0,0xc0,0x5b,0x9b },
+    { 0xb7,0xb7,0xc2,0x75 }, { 0xfd,0xfd,0x1c,0xe1 },
+    { 0x93,0x93,0xae,0x3d }, { 0x26,0x26,0x6a,0x4c },
+    { 0x36,0x36,0x5a,0x6c }, { 0x3f,0x3f,0x41,0x7e },
+    { 0xf7,0xf7,0x02,0xf5 }, { 0xcc,0xcc,0x4f,0x83 },
+    { 0x34,0x34,0x5c,0x68 }, { 0xa5,0xa5,0xf4,0x51 },
+    { 0xe5,0xe5,0x34,0xd1 }, { 0xf1,0xf1,0x08,0xf9 },
+    { 0x71,0x71,0x93,0xe2 }, { 0xd8,0xd8,0x73,0xab },
+    { 0x31,0x31,0x53,0x62 }, { 0x15,0x15,0x3f,0x2a },
+    { 0x04,0x04,0x0c,0x08 }, { 0xc7,0xc7,0x52,0x95 },
+    { 0x23,0x23,0x65,0x46 }, { 0xc3,0xc3,0x5e,0x9d },
+    { 0x18,0x18,0x28,0x30 }, { 0x96,0x96,0xa1,0x37 },
+    { 0x05,0x05,0x0f,0x0a }, { 0x9a,0x9a,0xb5,0x2f },
+    { 0x07,0x07,0x09,0x0e }, { 0x12,0x12,0x36,0x24 },
+    { 0x80,0x80,0x9b,0x1b }, { 0xe2,0xe2,0x3d,0xdf },
+    { 0xeb,0xeb,0x26,0xcd }, { 0x27,0x27,0x69,0x4e },
+    { 0xb2,0xb2,0xcd,0x7f }, { 0x75,0x75,0x9f,0xea },
+    { 0x09,0x09,0x1b,0x12 }, { 0x83,0x83,0x9e,0x1d },
+    { 0x2c,0x2c,0x74,0x58 }, { 0x1a,0x1a,0x2e,0x34 },
+    { 0x1b,0x1b,0x2d,0x36 }, { 0x6e,0x6e,0xb2,0xdc },
+    { 0x5a,0x5a,0xee,0xb4 }, { 0xa0,0xa0,0xfb,0x5b },
+    { 0x52,0x52,0xf6,0xa4 }, { 0x3b,0x3b,0x4d,0x76 },
+    { 0xd6,0xd6,0x61,0xb7 }, { 0xb3,0xb3,0xce,0x7d },
+    { 0x29,0x29,0x7b,0x52 }, { 0xe3,0xe3,0x3e,0xdd },
+    { 0x2f,0x2f,0x71,0x5e }, { 0x84,0x84,0x97,0x13 },
+    { 0x53,0x53,0xf5,0xa6 }, { 0xd1,0xd1,0x68,0xb9 },
+    { 0x00,0x00,0x00,0x00 }, { 0xed,0xed,0x2c,0xc1 },
+    { 0x20,0x20,0x60,0x40 }, { 0xfc,0xfc,0x1f,0xe3 },
+    { 0xb1,0xb1,0xc8,0x79 }, { 0x5b,0x5b,0xed,0xb6 },
+    { 0x6a,0x6a,0xbe,0xd4 }, { 0xcb,0xcb,0x46,0x8d },
+    { 0xbe,0xbe,0xd9,0x67 }, { 0x39,0x39,0x4b,0x72 },
+    { 0x4a,0x4a,0xde,0x94 }, { 0x4c,0x4c,0xd4,0x98 },
+    { 0x58,0x58,0xe8,0xb0 }, { 0xcf,0xcf,0x4a,0x85 },
+    { 0xd0,0xd0,0x6b,0xbb }, { 0xef,0xef,0x2a,0xc5 },
+    { 0xaa,0xaa,0xe5,0x4f }, { 0xfb,0xfb,0x16,0xed },
+    { 0x43,0x43,0xc5,0x86 }, { 0x4d,0x4d,0xd7,0x9a },
+    { 0x33,0x33,0x55,0x66 }, { 0x85,0x85,0x94,0x11 },
+    { 0x45,0x45,0xcf,0x8a }, { 0xf9,0xf9,0x10,0xe9 },
+    { 0x02,0x02,0x06,0x04 }, { 0x7f,0x7f,0x81,0xfe },
+    { 0x50,0x50,0xf0,0xa0 }, { 0x3c,0x3c,0x44,0x78 },
+    { 0x9f,0x9f,0xba,0x25 }, { 0xa8,0xa8,0xe3,0x4b },
+    { 0x51,0x51,0xf3,0xa2 }, { 0xa3,0xa3,0xfe,0x5d },
+    { 0x40,0x40,0xc0,0x80 }, { 0x8f,0x8f,0x8a,0x05 },
+    { 0x92,0x92,0xad,0x3f }, { 0x9d,0x9d,0xbc,0x21 },
+    { 0x38,0x38,0x48,0x70 }, { 0xf5,0xf5,0x04,0xf1 },
+    { 0xbc,0xbc,0xdf,0x63 }, { 0xb6,0xb6,0xc1,0x77 },
+    { 0xda,0xda,0x75,0xaf }, { 0x21,0x21,0x63,0x42 },
+    { 0x10,0x10,0x30,0x20 }, { 0xff,0xff,0x1a,0xe5 },
+    { 0xf3,0xf3,0x0e,0xfd }, { 0xd2,0xd2,0x6d,0xbf },
+    { 0xcd,0xcd,0x4c,0x81 }, { 0x0c,0x0c,0x14,0x18 },
+    { 0x13,0x13,0x35,0x26 }, { 0xec,0xec,0x2f,0xc3 },
+    { 0x5f,0x5f,0xe1,0xbe }, { 0x97,0x97,0xa2,0x35 },
+    { 0x44,0x44,0xcc,0x88 }, { 0x17,0x17,0x39,0x2e },
+    { 0xc4,0xc4,0x57,0x93 }, { 0xa7,0xa7,0xf2,0x55 },
+    { 0x7e,0x7e,0x82,0xfc }, { 0x3d,0x3d,0x47,0x7a },
+    { 0x64,0x64,0xac,0xc8 }, { 0x5d,0x5d,0xe7,0xba },
+    { 0x19,0x19,0x2b,0x32 }, { 0x73,0x73,0x95,0xe6 },
+    { 0x60,0x60,0xa0,0xc0 }, { 0x81,0x81,0x98,0x19 },
+    { 0x4f,0x4f,0xd1,0x9e }, { 0xdc,0xdc,0x7f,0xa3 },
+    { 0x22,0x22,0x66,0x44 }, { 0x2a,0x2a,0x7e,0x54 },
+    { 0x90,0x90,0xab,0x3b }, { 0x88,0x88,0x83,0x0b },
+    { 0x46,0x46,0xca,0x8c }, { 0xee,0xee,0x29,0xc7 },
+    { 0xb8,0xb8,0xd3,0x6b }, { 0x14,0x14,0x3c,0x28 },
+    { 0xde,0xde,0x79,0xa7 }, { 0x5e,0x5e,0xe2,0xbc },
+    { 0x0b,0x0b,0x1d,0x16 }, { 0xdb,0xdb,0x76,0xad },
+    { 0xe0,0xe0,0x3b,0xdb }, { 0x32,0x32,0x56,0x64 },
+    { 0x3a,0x3a,0x4e,0x74 }, { 0x0a,0x0a,0x1e,0x14 },
+    { 0x49,0x49,0xdb,0x92 }, { 0x06,0x06,0x0a,0x0c },
+    { 0x24,0x24,0x6c,0x48 }, { 0x5c,0x5c,0xe4,0xb8 },
+    { 0xc2,0xc2,0x5d,0x9f }, { 0xd3,0xd3,0x6e,0xbd },
+    { 0xac,0xac,0xef,0x43 }, { 0x62,0x62,0xa6,0xc4 },
+    { 0x91,0x91,0xa8,0x39 }, { 0x95,0x95,0xa4,0x31 },
+    { 0xe4,0xe4,0x37,0xd3 }, { 0x79,0x79,0x8b,0xf2 },
+    { 0xe7,0xe7,0x32,0xd5 }, { 0xc8,0xc8,0x43,0x8b },
+    { 0x37,0x37,0x59,0x6e }, { 0x6d,0x6d,0xb7,0xda },
+    { 0x8d,0x8d,0x8c,0x01 }, { 0xd5,0xd5,0x64,0xb1 },
+    { 0x4e,0x4e,0xd2,0x9c }, { 0xa9,0xa9,0xe0,0x49 },
+    { 0x6c,0x6c,0xb4,0xd8 }, { 0x56,0x56,0xfa,0xac },
+    { 0xf4,0xf4,0x07,0xf3 }, { 0xea,0xea,0x25,0xcf },
+    { 0x65,0x65,0xaf,0xca }, { 0x7a,0x7a,0x8e,0xf4 },
+    { 0xae,0xae,0xe9,0x47 }, { 0x08,0x08,0x18,0x10 },
+    { 0xba,0xba,0xd5,0x6f }, { 0x78,0x78,0x88,0xf0 },
+    { 0x25,0x25,0x6f,0x4a }, { 0x2e,0x2e,0x72,0x5c },
+    { 0x1c,0x1c,0x24,0x38 }, { 0xa6,0xa6,0xf1,0x57 },
+    { 0xb4,0xb4,0xc7,0x73 }, { 0xc6,0xc6,0x51,0x97 },
+    { 0xe8,0xe8,0x23,0xcb }, { 0xdd,0xdd,0x7c,0xa1 },
+    { 0x74,0x74,0x9c,0xe8 }, { 0x1f,0x1f,0x21,0x3e },
+    { 0x4b,0x4b,0xdd,0x96 }, { 0xbd,0xbd,0xdc,0x61 },
+    { 0x8b,0x8b,0x86,0x0d }, { 0x8a,0x8a,0x85,0x0f },
+    { 0x70,0x70,0x90,0xe0 }, { 0x3e,0x3e,0x42,0x7c },
+    { 0xb5,0xb5,0xc4,0x71 }, { 0x66,0x66,0xaa,0xcc },
+    { 0x48,0x48,0xd8,0x90 }, { 0x03,0x03,0x05,0x06 },
+    { 0xf6,0xf6,0x01,0xf7 }, { 0x0e,0x0e,0x12,0x1c },
+    { 0x61,0x61,0xa3,0xc2 }, { 0x35,0x35,0x5f,0x6a },
+    { 0x57,0x57,0xf9,0xae }, { 0xb9,0xb9,0xd0,0x69 },
+    { 0x86,0x86,0x91,0x17 }, { 0xc1,0xc1,0x58,0x99 },
+    { 0x1d,0x1d,0x27,0x3a }, { 0x9e,0x9e,0xb9,0x27 },
+    { 0xe1,0xe1,0x38,0xd9 }, { 0xf8,0xf8,0x13,0xeb },
+    { 0x98,0x98,0xb3,0x2b }, { 0x11,0x11,0x33,0x22 },
+    { 0x69,0x69,0xbb,0xd2 }, { 0xd9,0xd9,0x70,0xa9 },
+    { 0x8e,0x8e,0x89,0x07 }, { 0x94,0x94,0xa7,0x33 },
+    { 0x9b,0x9b,0xb6,0x2d }, { 0x1e,0x1e,0x22,0x3c },
+    { 0x87,0x87,0x92,0x15 }, { 0xe9,0xe9,0x20,0xc9 },
+    { 0xce,0xce,0x49,0x87 }, { 0x55,0x55,0xff,0xaa },
+    { 0x28,0x28,0x78,0x50 }, { 0xdf,0xdf,0x7a,0xa5 },
+    { 0x8c,0x8c,0x8f,0x03 }, { 0xa1,0xa1,0xf8,0x59 },
+    { 0x89,0x89,0x80,0x09 }, { 0x0d,0x0d,0x17,0x1a },
+    { 0xbf,0xbf,0xda,0x65 }, { 0xe6,0xe6,0x31,0xd7 },
+    { 0x42,0x42,0xc6,0x84 }, { 0x68,0x68,0xb8,0xd0 },
+    { 0x41,0x41,0xc3,0x82 }, { 0x99,0x99,0xb0,0x29 },
+    { 0x2d,0x2d,0x77,0x5a }, { 0x0f,0x0f,0x11,0x1e },
+    { 0xb0,0xb0,0xcb,0x7b }, { 0x54,0x54,0xfc,0xa8 },
+    { 0xbb,0xbb,0xd6,0x6d }, { 0x16,0x16,0x3a,0x2c }
+};
+
+static const uint32_t rcon[30] =
+{
+    0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
+    0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35,
+    0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91
+};
+
+static char *AES_SelfTest(void);
+
+/* Perform the key setup.
+ */
+static boolean AES_SetKey(RIJNDAEL_context *ctx, const byte *key,
+                          const unsigned keylen)
+{
+    int ROUNDS;
+    byte k[MAXKC][4];
+    int i,j, r, t, rconpointer = 0;
+    byte tk[MAXKC][4];
+    int KC;
+
+    if( keylen == 128/8 )
+    {
+        ROUNDS = 10;
+        KC = 4;
+    }
+    else if ( keylen == 192/8 )
+    {
+        ROUNDS = 12;
+        KC = 6;
+    }
+    else if ( keylen == 256/8 )
+    {
+        ROUNDS = 14;
+        KC = 8;
+    }
+    else
+    {
+	return false;
+    }
+
+    ctx->ROUNDS = ROUNDS;
+
+    for (i = 0; i < keylen; i++)
+    {
+        k[i >> 2][i & 3] = key[i];
+    }
+#define W (ctx->keySched)
+
+    for (j = KC-1; j >= 0; j--)
+    {
+        *((uint32_t*)tk[j]) = *((uint32_t*)k[j]);
+    }
+    r = 0;
+    t = 0;
+    /* copy values into round key array */
+    for (j = 0; (j < KC) && (r < ROUNDS + 1); )
+    {
+        for (; (j < KC) && (t < 4); j++, t++)
+        {
+            W[r][t] = *((uint32_t*)tk[j]);
+        }
+        if (t == 4)
+        {
+            r++;
+            t = 0;
+        }
+    }
+
+    while (r < ROUNDS + 1)
+    {
+        /* while not enough round key material calculated */
+        /* calculate new values */
+        tk[0][0] ^= S[tk[KC-1][1]];
+        tk[0][1] ^= S[tk[KC-1][2]];
+        tk[0][2] ^= S[tk[KC-1][3]];
+        tk[0][3] ^= S[tk[KC-1][0]];
+        tk[0][0] ^= rcon[rconpointer++];
+
+        if (KC != 8)
+        {
+            for (j = 1; j < KC; j++)
+            {
+                *((uint32_t*)tk[j]) ^= *((uint32_t*)tk[j-1]);
+            }
+        }
+        else
+        {
+            for (j = 1; j < KC/2; j++)
+            {
+                *((uint32_t*)tk[j]) ^= *((uint32_t*)tk[j-1]);
+            }
+            tk[KC/2][0] ^= S[tk[KC/2 - 1][0]];
+            tk[KC/2][1] ^= S[tk[KC/2 - 1][1]];
+            tk[KC/2][2] ^= S[tk[KC/2 - 1][2]];
+            tk[KC/2][3] ^= S[tk[KC/2 - 1][3]];
+            for (j = KC/2 + 1; j < KC; j++)
+            {
+                *((uint32_t*)tk[j]) ^= *((uint32_t*)tk[j-1]);
+            }
+        }
+        /* copy values into round key array */
+        for (j = 0; (j < KC) && (r < ROUNDS + 1); )
+        {
+            for (; (j < KC) && (t < 4); j++, t++)
+            {
+                W[r][t] = *((uint32_t*)tk[j]);
+            }
+            if (t == 4)
+            {
+                r++;
+                t = 0;
+            }
+        }
+    }
+
+#undef W
+    return true;
+}
+
+/* Encrypt one block.  A and B need to be aligned on a 4 byte
+   boundary.  A and B may be the same. */
+static void AES_EncryptAligned(const RIJNDAEL_context *ctx,
+                               byte *b, const byte *a)
+{
+#define rk (ctx->keySched)
+    int ROUNDS = ctx->ROUNDS;
+    int r;
+    union
+    {
+        uint32_t u32;
+        byte b[4];
+    } temp[4];
+
+    temp[0].u32 = *((uint32_t*)(a   )) ^ rk[0][0];
+    temp[1].u32 = *((uint32_t*)(a+ 4)) ^ rk[0][1];
+    temp[2].u32 = *((uint32_t*)(a+ 8)) ^ rk[0][2];
+    temp[3].u32 = *((uint32_t*)(a+12)) ^ rk[0][3];
+    *((uint32_t*)(b    )) = (*((uint32_t*)T1[temp[0].b[0]])
+                           ^ *((uint32_t*)T2[temp[1].b[1]])
+                           ^ *((uint32_t*)T3[temp[2].b[2]])
+                           ^ *((uint32_t*)T4[temp[3].b[3]]));
+    *((uint32_t*)(b + 4)) = (*((uint32_t*)T1[temp[1].b[0]])
+                           ^ *((uint32_t*)T2[temp[2].b[1]])
+                           ^ *((uint32_t*)T3[temp[3].b[2]])
+                           ^ *((uint32_t*)T4[temp[0].b[3]]));
+    *((uint32_t*)(b + 8)) = (*((uint32_t*)T1[temp[2].b[0]])
+                           ^ *((uint32_t*)T2[temp[3].b[1]])
+                           ^ *((uint32_t*)T3[temp[0].b[2]])
+                           ^ *((uint32_t*)T4[temp[1].b[3]]));
+    *((uint32_t*)(b +12)) = (*((uint32_t*)T1[temp[3].b[0]])
+                           ^ *((uint32_t*)T2[temp[0].b[1]])
+                           ^ *((uint32_t*)T3[temp[1].b[2]])
+                           ^ *((uint32_t*)T4[temp[2].b[3]]));
+
+    for (r = 1; r < ROUNDS-1; r++)
+    {
+        temp[0].u32 = *((uint32_t*)(b   )) ^ rk[r][0];
+        temp[1].u32 = *((uint32_t*)(b+ 4)) ^ rk[r][1];
+        temp[2].u32 = *((uint32_t*)(b+ 8)) ^ rk[r][2];
+        temp[3].u32 = *((uint32_t*)(b+12)) ^ rk[r][3];
+
+        *((uint32_t*)(b    )) = (*((uint32_t*)T1[temp[0].b[0]])
+                               ^ *((uint32_t*)T2[temp[1].b[1]])
+                               ^ *((uint32_t*)T3[temp[2].b[2]])
+                               ^ *((uint32_t*)T4[temp[3].b[3]]));
+        *((uint32_t*)(b + 4)) = (*((uint32_t*)T1[temp[1].b[0]])
+                               ^ *((uint32_t*)T2[temp[2].b[1]])
+                               ^ *((uint32_t*)T3[temp[3].b[2]])
+                               ^ *((uint32_t*)T4[temp[0].b[3]]));
+        *((uint32_t*)(b + 8)) = (*((uint32_t*)T1[temp[2].b[0]])
+                               ^ *((uint32_t*)T2[temp[3].b[1]])
+                               ^ *((uint32_t*)T3[temp[0].b[2]])
+                               ^ *((uint32_t*)T4[temp[1].b[3]]));
+        *((uint32_t*)(b +12)) = (*((uint32_t*)T1[temp[3].b[0]])
+                               ^ *((uint32_t*)T2[temp[0].b[1]])
+                               ^ *((uint32_t*)T3[temp[1].b[2]])
+                               ^ *((uint32_t*)T4[temp[2].b[3]]));
+    }
+
+    /* Last round is special. */
+    temp[0].u32 = *((uint32_t*)(b   )) ^ rk[ROUNDS-1][0];
+    temp[1].u32 = *((uint32_t*)(b+ 4)) ^ rk[ROUNDS-1][1];
+    temp[2].u32 = *((uint32_t*)(b+ 8)) ^ rk[ROUNDS-1][2];
+    temp[3].u32 = *((uint32_t*)(b+12)) ^ rk[ROUNDS-1][3];
+    b[ 0] = T1[temp[0].b[0]][1];
+    b[ 1] = T1[temp[1].b[1]][1];
+    b[ 2] = T1[temp[2].b[2]][1];
+    b[ 3] = T1[temp[3].b[3]][1];
+    b[ 4] = T1[temp[1].b[0]][1];
+    b[ 5] = T1[temp[2].b[1]][1];
+    b[ 6] = T1[temp[3].b[2]][1];
+    b[ 7] = T1[temp[0].b[3]][1];
+    b[ 8] = T1[temp[2].b[0]][1];
+    b[ 9] = T1[temp[3].b[1]][1];
+    b[10] = T1[temp[0].b[2]][1];
+    b[11] = T1[temp[1].b[3]][1];
+    b[12] = T1[temp[3].b[0]][1];
+    b[13] = T1[temp[0].b[1]][1];
+    b[14] = T1[temp[1].b[2]][1];
+    b[15] = T1[temp[2].b[3]][1];
+    *((uint32_t*)(b   )) ^= rk[ROUNDS][0];
+    *((uint32_t*)(b+ 4)) ^= rk[ROUNDS][1];
+    *((uint32_t*)(b+ 8)) ^= rk[ROUNDS][2];
+    *((uint32_t*)(b+12)) ^= rk[ROUNDS][3];
+#undef rk
+}
+
+static void AES_Encrypt(const RIJNDAEL_context *ctx,
+                        byte *bx, const byte *ax)
+{
+    /* BX and AX are not necessary correctly aligned.  Thus we need to
+       copy them here. */
+    uint32_t a[4];
+    uint32_t b[4];
+
+    memcpy(a, ax, 16);
+    AES_EncryptAligned(ctx, (byte *) b, (byte *) a);
+    memcpy(bx, b, 16);
+}
+
+/* Test a single encryption and decryption with each key size. */
+
+static char *AES_SelfTest(void)
+{
+    RIJNDAEL_context ctx;
+    byte scratch[16];
+
+    /* The test vectors are from the AES supplied ones; more or less
+     * randomly taken from ecb_tbl.txt (I=42,81,14)
+     */
+    static const byte plaintext[16] = {
+       0x01,0x4B,0xAF,0x22,0x78,0xA6,0x9D,0x33,
+       0x1D,0x51,0x80,0x10,0x36,0x43,0xE9,0x9A
+    };
+    static const byte key[16] = {
+        0xE8,0xE9,0xEA,0xEB,0xED,0xEE,0xEF,0xF0,
+        0xF2,0xF3,0xF4,0xF5,0xF7,0xF8,0xF9,0xFA
+    };
+    static const byte ciphertext[16] = {
+        0x67,0x43,0xC3,0xD1,0x51,0x9A,0xB4,0xF2,
+        0xCD,0x9A,0x78,0xAB,0x09,0xA5,0x11,0xBD
+    };
+
+    static const byte plaintext_192[16] = {
+        0x76,0x77,0x74,0x75,0xF1,0xF2,0xF3,0xF4,
+        0xF8,0xF9,0xE6,0xE7,0x77,0x70,0x71,0x72
+    };
+    static const byte key_192[24] = {
+        0x04,0x05,0x06,0x07,0x09,0x0A,0x0B,0x0C,
+        0x0E,0x0F,0x10,0x11,0x13,0x14,0x15,0x16,
+        0x18,0x19,0x1A,0x1B,0x1D,0x1E,0x1F,0x20
+    };
+    static const byte ciphertext_192[16] = {
+        0x5D,0x1E,0xF2,0x0D,0xCE,0xD6,0xBC,0xBC,
+        0x12,0x13,0x1A,0xC7,0xC5,0x47,0x88,0xAA
+    };
+
+    static const byte plaintext_256[16] = {
+        0x06,0x9A,0x00,0x7F,0xC7,0x6A,0x45,0x9F,
+        0x98,0xBA,0xF9,0x17,0xFE,0xDF,0x95,0x21
+    };
+    static const byte key_256[32] = {
+        0x08,0x09,0x0A,0x0B,0x0D,0x0E,0x0F,0x10,
+        0x12,0x13,0x14,0x15,0x17,0x18,0x19,0x1A,
+        0x1C,0x1D,0x1E,0x1F,0x21,0x22,0x23,0x24,
+        0x26,0x27,0x28,0x29,0x2B,0x2C,0x2D,0x2E
+    };
+    static const byte ciphertext_256[16] = {
+        0x08,0x0E,0x95,0x17,0xEB,0x16,0x77,0x71,
+        0x9A,0xCF,0x72,0x80,0x86,0x04,0x0A,0xE3
+    };
+
+    AES_SetKey(&ctx, key, sizeof(key));
+    AES_Encrypt(&ctx, scratch, plaintext);
+    if (memcmp (scratch, ciphertext, sizeof (ciphertext)))
+        return "Rijndael-128 test encryption failed.";
+
+    AES_SetKey(&ctx, key_192, sizeof(key_192));
+    AES_Encrypt(&ctx, scratch, plaintext_192);
+    if (memcmp (scratch, ciphertext_192, sizeof (ciphertext_192)))
+        return "Rijndael-192 test encryption failed.";
+
+    AES_SetKey(&ctx, key_256, sizeof(key_256));
+    AES_Encrypt(&ctx, scratch, plaintext_256);
+    if (memcmp (scratch, ciphertext_256, sizeof (ciphertext_256)))
+        return "Rijndael-256 test encryption failed.";
+
+    return NULL;
+}
+
+#ifndef TEST
+
+static boolean prng_enabled = false;
+static RIJNDAEL_context prng_context;
+static uint32_t prng_input_counter;
+static uint32_t prng_values[4];
+static unsigned int prng_value_index = 0;
+
+// Initialize Pseudo-RNG using the specified 128-bit key.
+
+void PRNG_Start(prng_seed_t key)
+{
+    char *errormsg;
+
+    errormsg = AES_SelfTest();
+
+    if (errormsg != NULL)
+    {
+        I_Error("Failed to initialize PRNG: %s", errormsg);
+    }
+
+    AES_SetKey(&prng_context, key, sizeof(prng_seed_t));
+    prng_value_index = 4;
+    prng_input_counter = 0;
+    prng_enabled = true;
+}
+
+void PRNG_Stop(void)
+{
+    prng_enabled = false;
+}
+
+// Generate a set of new PRNG values by encrypting a new block.
+
+static void PRNG_Generate(void)
+{
+    byte input[16], output[16];
+    unsigned int i;
+
+    // Input for the cipher is a consecutively increasing 32-bit counter.
+
+    for (i = 0; i < 4; ++i)
+    {
+        input[4*i] = prng_input_counter & 0xff;
+        input[4*i + 1] = (prng_input_counter >> 8) & 0xff;
+        input[4*i + 2] = (prng_input_counter >> 16) & 0xff;
+        input[4*i + 3] = (prng_input_counter >> 24) & 0xff;
+        ++prng_input_counter;
+    }
+
+    AES_Encrypt(&prng_context, output, input);
+
+    for (i = 0; i < 4; ++i)
+    {
+        prng_values[i] = output[4*i]
+                       | (output[4*i + 1] << 8)
+                       | (output[4*i + 2] << 16)
+                       | (output[4*i + 3] << 24);
+    }
+
+    prng_value_index = 0;
+}
+
+// Read a random 32-bit integer from the PRNG.
+
+unsigned int PRNG_Random(void)
+{
+    unsigned int result;
+
+    if (!prng_enabled)
+    {
+        return 0;
+    }
+
+    if (prng_value_index >= 4)
+    {
+        PRNG_Generate();
+    }
+
+    result = prng_values[prng_value_index];
+    ++prng_value_index;
+
+    return result;
+}
+
+
+#else /* #ifndef TEST */
+
+int main(int argc, char *argv[])
+{
+    char *errormsg;
+
+    errormsg = AES_SelfTest();
+
+    if (errormsg == NULL)
+    {
+        printf("AES Self test passed.\n");
+        return 0;
+    }
+    else
+    {
+        fprintf(stderr, "AES self test failed: %s\n", errormsg);
+        return 1;
+    }
+}
+
+#endif
--- /dev/null
+++ b/src/aes_prng.h
@@ -1,0 +1,40 @@
+// Emacs style mode select   -*- C++ -*-
+//-----------------------------------------------------------------------------
+//
+// Copyright(C) 2012 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+// DESCRIPTION:
+//     Pseudo-random number generator for secure demos.
+//
+//-----------------------------------------------------------------------------
+
+#ifndef __AES_PRNG_H__
+#define __AES_PRNG_H__
+
+#include "doomtype.h"
+
+// Nonce value used as random seed for secure demos.
+
+typedef byte prng_seed_t[16];
+
+void PRNG_Start(prng_seed_t seed);
+void PRNG_Stop(void);
+unsigned int PRNG_Random(void);
+
+#endif /* #ifndef __AES_PRNG_H__ */
+
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -175,6 +175,10 @@
     "steamapps\\common\\ultimate doom\\base",
     "steamapps\\common\\hexen\\base",
     "steamapps\\common\\heretic shadow of the serpent riders\\base"
+
+    // From Doom 3: BFG Edition:
+
+    "steamapps\\common\\DOOM 3 BFG Edition\\base\\wads",
 };
 
 static char *GetRegistryString(registry_value_t *reg_val)
@@ -219,7 +223,7 @@
     }
 
     // Close the key
-        
+
     RegCloseKey(key);
 
     return result;
--- a/src/deh_defs.h
+++ b/src/deh_defs.h
@@ -27,7 +27,7 @@
 #ifndef DEH_DEFS_H
 #define DEH_DEFS_H
 
-#include "md5.h"
+#include "sha1.h"
 
 typedef struct deh_context_s deh_context_t;
 typedef struct deh_section_s deh_section_t;
@@ -35,7 +35,7 @@
 typedef void *(*deh_section_start_t)(deh_context_t *context, char *line);
 typedef void (*deh_section_end_t)(deh_context_t *context, void *tag);
 typedef void (*deh_line_parser_t)(deh_context_t *context, char *line, void *tag);
-typedef void (*deh_md5_hash_t)(md5_context_t *context);
+typedef void (*deh_sha1_hash_t)(sha1_context_t *context);
 
 struct deh_section_s
 {
@@ -58,9 +58,9 @@
 
     deh_section_end_t end;
 
-    // Called when generating an MD5 sum of the dehacked state
+    // Called when generating an SHA1 sum of the dehacked state
 
-    deh_md5_hash_t md5_hash;
+    deh_sha1_hash_t sha1_hash;
 };
 
 #endif /* #ifndef DEH_DEFS_H */
--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -54,22 +54,22 @@
 
 boolean deh_apply_cheats = true;
 
-void DEH_Checksum(md5_digest_t digest)
+void DEH_Checksum(sha1_digest_t digest)
 {
-    md5_context_t md5_context;
+    sha1_context_t sha1_context;
     unsigned int i;
 
-    MD5_Init(&md5_context);
+    SHA1_Init(&sha1_context);
 
     for (i=0; deh_section_types[i] != NULL; ++i)
     {
-        if (deh_section_types[i]->md5_hash != NULL)
+        if (deh_section_types[i]->sha1_hash != NULL)
         {
-            deh_section_types[i]->md5_hash(&md5_context);
+            deh_section_types[i]->sha1_hash(&sha1_context);
         }
     }
 
-    MD5_Final(digest, &md5_context);
+    SHA1_Final(digest, &sha1_context);
 }
 
 // Called on startup to call the Init functions
--- a/src/deh_main.h
+++ b/src/deh_main.h
@@ -29,8 +29,8 @@
 
 #include "doomtype.h"
 #include "doomfeatures.h"
-#include "md5.h"
 #include "deh_str.h"
+#include "sha1.h"
 
 // These are the limits that dehacked uses (from dheinit.h in the dehacked
 // source).  If these limits are exceeded, it does not generate an error, but
@@ -46,7 +46,7 @@
 
 boolean DEH_ParseAssignment(char *line, char **variable_name, char **value);
 
-void DEH_Checksum(md5_digest_t digest);
+void DEH_Checksum(sha1_digest_t digest);
 
 extern boolean deh_allow_long_strings;
 extern boolean deh_allow_long_cheats;
--- a/src/deh_mapping.c
+++ b/src/deh_mapping.c
@@ -163,8 +163,8 @@
     return true;
 }
 
-void DEH_StructMD5Sum(md5_context_t *context, deh_mapping_t *mapping,
-                      void *structptr)
+void DEH_StructSHA1Sum(sha1_context_t *context, deh_mapping_t *mapping,
+                       void *structptr)
 {
     int i;
 
@@ -189,13 +189,13 @@
         switch (entry->size)
         {
             case 1:
-                MD5_UpdateInt32(context, *((uint8_t *) location));
+                SHA1_UpdateInt32(context, *((uint8_t *) location));
                 break;
             case 2:
-                MD5_UpdateInt32(context, *((uint16_t *) location));
+                SHA1_UpdateInt32(context, *((uint16_t *) location));
                 break;
             case 4:
-                MD5_UpdateInt32(context, *((uint32_t *) location));
+                SHA1_UpdateInt32(context, *((uint32_t *) location));
                 break;
             default:
                 I_Error("Unknown dehacked mapping field type for '%s' (BUG)", 
--- a/src/deh_mapping.h
+++ b/src/deh_mapping.h
@@ -31,7 +31,7 @@
 
 #include "doomtype.h"
 #include "deh_io.h"
-#include "md5.h"
+#include "sha1.h"
 
 #define DEH_BEGIN_MAPPING(mapping_name, structname)           \
     static structname deh_mapping_base;                       \
@@ -95,8 +95,8 @@
                        void *structptr, char *name, int value);
 boolean DEH_SetStringMapping(deh_context_t *context, deh_mapping_t *mapping,
                              void *structptr, char *name, char *value);
-void DEH_StructMD5Sum(md5_context_t *context, deh_mapping_t *mapping,
-                      void *structptr);
+void DEH_StructSHA1Sum(sha1_context_t *context, deh_mapping_t *mapping,
+                       void *structptr);
 
 #endif /* #ifndef DEH_MAPPING_H */
 
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -123,9 +123,10 @@
 boolean		advancedemo;
 
 // Store demo, do not accept any inputs
-
 boolean         storedemo;
 
+// "BFG Edition" version of doom2.wad does not include TITLEPIC.
+boolean         bfgedition;
 
 char		wadfile[1024];		// primary wad file
 char		mapdir[1024];           // directory of development maps
@@ -566,6 +567,13 @@
 	G_DeferedPlayDemo(DEH_String("demo4"));
 	break;
     }
+
+    // The Doom 3: BFG Edition version of doom2.wad does not have a
+    // TITLETPIC lump. Use INTERPIC instead as a workaround.
+    if (bfgedition && !strcasecmp(pagename, "TITLEPIC"))
+    {
+        pagename = "INTERPIC";
+    }
 }
 
 
@@ -1539,12 +1547,26 @@
     DEH_printf("ST_Init: Init status bar.\n");
     ST_Init ();
 
-    // If Doom II without a MAP01 lump, this is a store demo.  
+    // If Doom II without a MAP01 lump, this is a store demo.
     // Moved this here so that MAP01 isn't constantly looked up
     // in the main loop.
 
     if (gamemode == commercial && W_CheckNumForName("map01") < 0)
         storedemo = true;
+
+    // Doom 3: BFG Edition includes modified versions of the classic
+    // IWADs. The modified version of doom2.wad does not have a
+    // TITLEPIC lump, so detect this so we can apply a workaround.
+    // We specifically check for TITLEPIC here, after PWADs have been
+    // loaded - this means that we can play with the BFG Edition with
+    // PWADs that change the title screen and still see the modified
+    // titles.
+
+    if (gamemode == commercial && W_CheckNumForName("titlepic") < 0)
+    {
+        printf("BFG Edition: Using INTERPIC instead of TITLEPIC.\n");
+        bfgedition = true;
+    }
 
     if (M_CheckParmWithArgs("-statdump", 1))
     {
--- a/src/doom/d_net.c
+++ b/src/doom/d_net.c
@@ -215,8 +215,8 @@
 
     // Read checksums of our WAD directory and dehacked information
 
-    W_Checksum(connect_data->wad_md5sum);
-    DEH_Checksum(connect_data->deh_md5sum);
+    W_Checksum(connect_data->wad_sha1sum);
+    DEH_Checksum(connect_data->deh_sha1sum);
 
     // Are we playing with the Freedoom IWAD?
 
--- a/src/doom/deh_ammo.c
+++ b/src/doom/deh_ammo.c
@@ -89,14 +89,14 @@
     }
 }
 
-static void DEH_AmmoMD5Hash(md5_context_t *context)
+static void DEH_AmmoSHA1Hash(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMAMMO; ++i)
     {
-        MD5_UpdateInt32(context, clipammo[i]);
-        MD5_UpdateInt32(context, maxammo[i]);
+        SHA1_UpdateInt32(context, clipammo[i]);
+        SHA1_UpdateInt32(context, maxammo[i]);
     }
 }
 
@@ -107,6 +107,6 @@
     DEH_AmmoStart,
     DEH_AmmoParseLine,
     NULL,
-    DEH_AmmoMD5Hash,
+    DEH_AmmoSHA1Hash,
 };
 
--- a/src/doom/deh_frame.c
+++ b/src/doom/deh_frame.c
@@ -148,13 +148,13 @@
     }
 }
 
-static void DEH_FrameMD5Sum(md5_context_t *context)
+static void DEH_FrameSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMSTATES; ++i)
     {
-        DEH_StructMD5Sum(context, &state_mapping, &states[i]);
+        DEH_StructSHA1Sum(context, &state_mapping, &states[i]);
     }
 }
 
@@ -165,6 +165,6 @@
     DEH_FrameStart,
     DEH_FrameParseLine,
     NULL,
-    DEH_FrameMD5Sum,
+    DEH_FrameSHA1Sum,
 };
 
--- a/src/doom/deh_misc.c
+++ b/src/doom/deh_misc.c
@@ -215,13 +215,13 @@
     DEH_Warning(context, "Unknown Misc variable '%s'", variable_name);
 }
 
-static void DEH_MiscMD5Sum(md5_context_t *context)
+static void DEH_MiscSHA1Sum(sha1_context_t *context)
 {
     unsigned int i;
 
     for (i=0; i<arrlen(misc_settings); ++i)
     {
-        MD5_UpdateInt32(context, *misc_settings[i].value);
+        SHA1_UpdateInt32(context, *misc_settings[i].value);
     }
 }
 
@@ -232,6 +232,6 @@
     DEH_MiscStart,
     DEH_MiscParseLine,
     NULL,
-    DEH_MiscMD5Sum,
+    DEH_MiscSHA1Sum,
 };
 
--- a/src/doom/deh_ptr.c
+++ b/src/doom/deh_ptr.c
@@ -129,13 +129,13 @@
     }
 }
 
-static void DEH_PointerMD5Sum(md5_context_t *context)
+static void DEH_PointerSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMSTATES; ++i)
     {
-        MD5_UpdateInt32(context, CodePointerIndex(&states[i].action));
+        SHA1_UpdateInt32(context, CodePointerIndex(&states[i].action));
     }
 }
 
@@ -146,6 +146,6 @@
     DEH_PointerStart,
     DEH_PointerParseLine,
     NULL,
-    DEH_PointerMD5Sum,
+    DEH_PointerSHA1Sum,
 };
 
--- a/src/doom/deh_thing.c
+++ b/src/doom/deh_thing.c
@@ -118,13 +118,13 @@
     DEH_SetMapping(context, &thing_mapping, mobj, variable_name, ivalue);
 }
 
-static void DEH_ThingMD5Sum(md5_context_t *context)
+static void DEH_ThingSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMMOBJTYPES; ++i)
     {
-        DEH_StructMD5Sum(context, &thing_mapping, &mobjinfo[i]);
+        DEH_StructSHA1Sum(context, &thing_mapping, &mobjinfo[i]);
     }
 }
 
@@ -135,6 +135,6 @@
     DEH_ThingStart,
     DEH_ThingParseLine,
     NULL,
-    DEH_ThingMD5Sum,
+    DEH_ThingSHA1Sum,
 };
 
--- a/src/doom/deh_weapon.c
+++ b/src/doom/deh_weapon.c
@@ -88,13 +88,13 @@
     DEH_SetMapping(context, &weapon_mapping, weapon, variable_name, ivalue);
 }
 
-static void DEH_WeaponMD5Sum(md5_context_t *context)
+static void DEH_WeaponSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMWEAPONS ;++i)
     {
-        DEH_StructMD5Sum(context, &weapon_mapping, &weaponinfo[i]);
+        DEH_StructSHA1Sum(context, &weapon_mapping, &weaponinfo[i]);
     }
 }
 
@@ -105,6 +105,6 @@
     DEH_WeaponStart,
     DEH_WeaponParseLine,
     NULL,
-    DEH_WeaponMD5Sum,
+    DEH_WeaponSHA1Sum,
 };
 
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -257,6 +257,14 @@
         return false;
     }
 
+    // These weapons aren't available in shareware.
+
+    if ((weapon == wp_plasma || weapon == wp_bfg)
+     && gamemission == doom && gamemode == shareware)
+    {
+        return false;
+    }
+
     // Can't select a weapon if we don't own it.
 
     if (!players[consoleplayer].weaponowned[weapon])
--- a/src/doom/hu_stuff.c
+++ b/src/doom/hu_stuff.c
@@ -595,11 +595,10 @@
     }
     else
     {
-	c = ev->data2;
 	// send a macro
 	if (altdown)
 	{
-	    c = c - '0';
+	    c = ev->data1 - '0';
 	    if (c > 9)
 		return false;
 	    // fprintf(stderr, "got here\n");
@@ -621,6 +620,8 @@
 	}
 	else
 	{
+            c = ev->data2;
+
 	    eatkey = HUlib_keyInIText(&w_chat, c);
 	    if (eatkey)
 	    {
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -132,6 +132,7 @@
 
 char	endstring[160];
 
+static boolean opldev;
 
 //
 // MENU TYPEDEFS
@@ -1887,7 +1888,40 @@
     itemOn = currentMenu->lastOn;   // JDC
 }
 
+// Display OPL debug messages - hack for GENMIDI development.
 
+static void M_DrawOPLDev(void)
+{
+    extern void I_OPL_DevMessages(char *);
+    char debug[1024];
+    char *curr, *p;
+    int line;
+
+    I_OPL_DevMessages(debug);
+    curr = debug;
+    line = 0;
+
+    for (;;)
+    {
+        p = strchr(curr, '\n');
+
+        if (p != NULL)
+        {
+            *p = '\0';
+        }
+
+        M_WriteText(0, line * 8, curr);
+        ++line;
+
+        if (p == NULL)
+        {
+            break;
+        }
+
+        curr = p + 1;
+    }
+}
+
 //
 // M_Drawer
 // Called after the view has been rendered,
@@ -1938,6 +1972,11 @@
 	return;
     }
 
+    if (opldev)
+    {
+        M_DrawOPLDev();
+    }
+
     if (!menuactive)
 	return;
 
@@ -1965,7 +2004,6 @@
     V_DrawPatchDirect(x + SKULLXOFF, currentMenu->y - 5 + itemOn*LINEHEIGHT,
 		      W_CacheLumpName(DEH_String(skullName[whichSkull]),
 				      PU_CACHE));
-
 }
 
 
@@ -2046,6 +2084,7 @@
       default:
 	break;
     }
-    
+
+    opldev = M_CheckParm("-opldev") > 0;
 }
 
--- a/src/doom/p_spec.c
+++ b/src/doom/p_spec.c
@@ -1474,6 +1474,11 @@
 	switch(lines[i].special)
 	{
 	  case 48:
+            if (numlinespecials >= MAXLINEANIMS)
+            {
+                I_Error("Too many scrolling wall linedefs! "
+                        "(Vanilla limit is 64)");
+            }
 	    // EFFECT FIRSTCOL SCROLL+
 	    linespeciallist[numlinespecials] = &lines[i];
 	    numlinespecials++;
--- a/src/heretic/d_net.c
+++ b/src/heretic/d_net.c
@@ -177,8 +177,8 @@
 
     // Read checksums of our WAD directory and dehacked information
 
-    W_Checksum(connect_data->wad_md5sum);
-    DEH_Checksum(connect_data->deh_md5sum);
+    W_Checksum(connect_data->wad_sha1sum);
+    DEH_Checksum(connect_data->deh_sha1sum);
 
     connect_data->is_freedoom = 0;
 }
--- a/src/heretic/deh_ammo.c
+++ b/src/heretic/deh_ammo.c
@@ -95,18 +95,18 @@
     }
 }
 
-static void DEH_AmmoMD5Hash(md5_context_t *context)
+static void DEH_AmmoSHA1Hash(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMAMMO; ++i)
     {
-        MD5_UpdateInt32(context, maxammo[i]);
+        SHA1_UpdateInt32(context, maxammo[i]);
     }
 
     for (i=0; i<NUMWEAPONS; ++i)
     {
-        MD5_UpdateInt32(context, GetWeaponAmmo[i]);
+        SHA1_UpdateInt32(context, GetWeaponAmmo[i]);
     }
 }
 
@@ -117,6 +117,6 @@
     DEH_AmmoStart,
     DEH_AmmoParseLine,
     NULL,
-    DEH_AmmoMD5Hash,
+    DEH_AmmoSHA1Hash,
 };
 
--- a/src/heretic/deh_frame.c
+++ b/src/heretic/deh_frame.c
@@ -322,13 +322,13 @@
     }
 }
 
-static void DEH_FrameMD5Sum(md5_context_t *context)
+static void DEH_FrameSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMSTATES; ++i)
     {
-        DEH_StructMD5Sum(context, &state_mapping, &states[i]);
+        DEH_StructSHA1Sum(context, &state_mapping, &states[i]);
     }
 }
 
@@ -339,6 +339,6 @@
     DEH_FrameStart,
     DEH_FrameParseLine,
     NULL,
-    DEH_FrameMD5Sum,
+    DEH_FrameSHA1Sum,
 };
 
--- a/src/heretic/deh_thing.c
+++ b/src/heretic/deh_thing.c
@@ -128,13 +128,13 @@
     DEH_SetMapping(context, &thing_mapping, mobj, variable_name, ivalue);
 }
 
-static void DEH_ThingMD5Sum(md5_context_t *context)
+static void DEH_ThingSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMMOBJTYPES; ++i)
     {
-        DEH_StructMD5Sum(context, &thing_mapping, &mobjinfo[i]);
+        DEH_StructSHA1Sum(context, &thing_mapping, &mobjinfo[i]);
     }
 }
 
@@ -145,6 +145,6 @@
     DEH_ThingStart,
     DEH_ThingParseLine,
     NULL,
-    DEH_ThingMD5Sum,
+    DEH_ThingSHA1Sum,
 };
 
--- a/src/heretic/deh_weapon.c
+++ b/src/heretic/deh_weapon.c
@@ -108,14 +108,14 @@
     DEH_SetMapping(context, &weapon_mapping, weapon, variable_name, ivalue);
 }
 
-static void DEH_WeaponMD5Sum(md5_context_t *context)
+static void DEH_WeaponSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMWEAPONS ;++i)
     {
-        DEH_StructMD5Sum(context, &weapon_mapping, &wpnlev1info[i]);
-        DEH_StructMD5Sum(context, &weapon_mapping, &wpnlev2info[i]);
+        DEH_StructSHA1Sum(context, &weapon_mapping, &wpnlev1info[i]);
+        DEH_StructSHA1Sum(context, &weapon_mapping, &wpnlev2info[i]);
     }
 }
 
@@ -126,6 +126,6 @@
     DEH_WeaponStart,
     DEH_WeaponParseLine,
     NULL,
-    DEH_WeaponMD5Sum,
+    DEH_WeaponSHA1Sum,
 };
 
--- a/src/hexen/d_net.c
+++ b/src/hexen/d_net.c
@@ -207,8 +207,8 @@
 
     // Read checksums of our WAD directory and dehacked information
 
-    W_Checksum(connect_data->wad_md5sum);
-    memset(connect_data->deh_md5sum, 0, sizeof(md5_digest_t));
+    W_Checksum(connect_data->wad_sha1sum);
+    memset(connect_data->deh_sha1sum, 0, sizeof(sha1_digest_t));
 
     connect_data->is_freedoom = 0;
 }
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -46,11 +46,14 @@
 
 #define MAXMIDLENGTH (96 * 1024)
 #define GENMIDI_NUM_INSTRS  128
+#define GENMIDI_NUM_PERCUSSION 47
 
 #define GENMIDI_HEADER          "#OPL_II#"
 #define GENMIDI_FLAG_FIXED      0x0001         /* fixed pitch */
 #define GENMIDI_FLAG_2VOICE     0x0004         /* double voice (OPL3) */
 
+#define PERCUSSION_LOG_LEN 16
+
 typedef struct
 {
     byte tremolo;
@@ -313,6 +316,8 @@
 
 static genmidi_instr_t *main_instrs;
 static genmidi_instr_t *percussion_instrs;
+static char (*main_instr_names)[32];
+static char (*percussion_names)[32];
 
 // Voices:
 
@@ -327,6 +332,11 @@
 static unsigned int running_tracks = 0;
 static boolean song_looping;
 
+// Mini-log of recently played percussion instruments:
+
+static uint8_t last_perc[PERCUSSION_LOG_LEN];
+static unsigned int last_perc_count;
+
 // Configuration file variable, containing the port number for the
 // adlib chip.
 
@@ -351,6 +361,8 @@
 
     main_instrs = (genmidi_instr_t *) (lump + strlen(GENMIDI_HEADER));
     percussion_instrs = main_instrs + GENMIDI_NUM_INSTRS;
+    main_instr_names = (char (*)[32]) (percussion_instrs + GENMIDI_NUM_PERCUSSION);
+    percussion_names = main_instr_names + GENMIDI_NUM_INSTRS;
 
     return true;
 }
@@ -893,6 +905,9 @@
         }
 
         instrument = &percussion_instrs[key - 35];
+
+        last_perc[last_perc_count] = key;
+        last_perc_count = (last_perc_count + 1) % PERCUSSION_LOG_LEN;
     }
     else
     {
@@ -1466,4 +1481,96 @@
     I_OPL_StopSong,
     I_OPL_MusicIsPlaying,
 };
+
+//----------------------------------------------------------------------
+//
+// Development / debug message generation, to help developing GENMIDI
+// lumps.
+//
+//----------------------------------------------------------------------
+
+static int NumActiveChannels(void)
+{
+    int i;
+
+    for (i = MIDI_CHANNELS_PER_TRACK - 1; i >= 0; --i)
+    {
+        if (tracks[0].channels[i].instrument != &main_instrs[0])
+        {
+            return i + 1;
+        }
+    }
+
+    return 0;
+}
+
+static int ChannelInUse(opl_channel_data_t *channel)
+{
+    opl_voice_t *voice;
+
+    for (voice = voice_alloced_list; voice != NULL; voice = voice->next)
+    {
+        if (voice->channel == channel)
+        {
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+void I_OPL_DevMessages(char *result)
+{
+    int instr_num;
+    int lines;
+    int i;
+
+    if (num_tracks == 0)
+    {
+        sprintf(result, "No OPL track!");
+        return;
+    }
+
+    sprintf(result, "Tracks:\n");
+    lines = 1;
+
+    for (i = 0; i < NumActiveChannels(); ++i)
+    {
+        if (tracks[0].channels[i].instrument == NULL)
+        {
+            continue;
+        }
+
+        instr_num = tracks[0].channels[i].instrument - main_instrs;
+
+        sprintf(result + strlen(result),
+                "chan %i: %c i#%i (%s)\n",
+                i,
+                ChannelInUse(&tracks[0].channels[i]) ? '\'' : ' ',
+                instr_num + 1,
+                main_instr_names[instr_num]);
+        ++lines;
+    }
+
+    sprintf(result + strlen(result), "\nLast percussion:\n");
+    lines += 2;
+
+    i = (last_perc_count + PERCUSSION_LOG_LEN - 1) % PERCUSSION_LOG_LEN;
+
+    do {
+        if (last_perc[i] == 0)
+        {
+            break;
+        }
+
+        sprintf(result + strlen(result),
+                "%cp#%i (%s)\n",
+                i == 0 ? '\'' : ' ',
+                last_perc[i],
+                percussion_names[last_perc[i] - 35]);
+        ++lines;
+
+        i = (i + PERCUSSION_LOG_LEN - 1) % PERCUSSION_LOG_LEN;
+    } while (lines < 25 && i != last_perc_count);
+}
 
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -378,6 +378,37 @@
     screenvisible = (state & SDL_APPACTIVE) != 0;
 }
 
+// Show or hide the mouse cursor. We have to use different techniques
+// depending on the OS.
+
+static void ShowCursor(boolean show)
+{
+    // On Windows, using SDL_ShowCursor() adds lag to the mouse input,
+    // so work around this by setting an invisible cursor instead. On
+    // other systems, it isn't possible to change the cursor, so this
+    // hack has to be Windows-only. (Thanks to entryway for this)
+
+#ifdef _WIN32
+    if (show)
+    {
+        SDL_SetCursor(cursors[1]);
+    }
+    else
+    {
+        SDL_SetCursor(cursors[0]);
+    }
+#else
+    SDL_ShowCursor(show);
+#endif
+
+    // When the cursor is hidden, grab the input.
+
+    if (!screensaver_mode)
+    {
+        SDL_WM_GrabInput(!show);
+    }
+}
+
 void I_EnableLoadingDisk(void)
 {
     patch_t *disk;
@@ -532,12 +563,10 @@
 {
     if (initialized)
     {
-        SDL_SetCursor(cursors[1]);
-        SDL_ShowCursor(1);
-        SDL_WM_GrabInput(SDL_GRAB_OFF);
+        ShowCursor(true);
 
         SDL_QuitSubSystem(SDL_INIT_VIDEO);
-    
+
         initialized = false;
     }
 }
@@ -895,17 +924,15 @@
     {
         // Hide the cursor in screensaver mode
 
-        SDL_SetCursor(cursors[0]);
+        ShowCursor(false);
     }
     else if (grab && !currently_grabbed)
     {
-        SDL_SetCursor(cursors[0]);
-        SDL_WM_GrabInput(SDL_GRAB_ON);
+        ShowCursor(false);
     }
     else if (!grab && currently_grabbed)
     {
-        SDL_SetCursor(cursors[1]);
-        SDL_WM_GrabInput(SDL_GRAB_OFF);
+        ShowCursor(true);
     }
 
     currently_grabbed = grab;
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -32,9 +32,9 @@
 #include <ctype.h>
 #include <errno.h>
 
-// for mkdir:
-
 #ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
 #include <io.h>
 #ifdef _MSC_VER
 #include <direct.h>
@@ -295,4 +295,23 @@
 
     return NULL;
 }
+
+#ifdef _WIN32
+
+char *M_OEMToUTF8(const char *oem)
+{
+    unsigned int len = strlen(oem) + 1;
+    wchar_t *tmp;
+    char *result;
+
+    tmp = malloc(len * sizeof(wchar_t));
+    MultiByteToWideChar(CP_OEMCP, 0, oem, len, tmp, len);
+    result = malloc(len * 4);
+    WideCharToMultiByte(CP_UTF8, 0, tmp, len, result, len * 4, NULL, NULL);
+    free(tmp);
+
+    return result;
+}
+
+#endif
 
--- a/src/m_misc.h
+++ b/src/m_misc.h
@@ -43,6 +43,7 @@
 void M_ExtractFileBase(char *path, char *dest);
 void M_ForceUppercase(char *text);
 char *M_StrCaseStr(char *haystack, char *needle);
+char *M_OEMToUTF8(const char *ansi);
 
 #endif
 
--- a/src/md5.c
+++ /dev/null
@@ -1,264 +1,0 @@
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest.  This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to MD5_Init, call MD5_Update as
- * needed on buffers full of bytes, and then call MD5_Final, which
- * will fill a supplied 16-byte array with the digest.
- *
- * Changed so as no longer to depend on Colin Plumb's `usual.h' header
- * definitions; now uses stuff from dpkg's config.h.
- *  - Ian Jackson <ian@chiark.greenend.org.uk>.
- * Still in the public domain.
- */
-
-#include "i_swap.h"
-
-#include <string.h>             /* for memcpy() */
-#include <sys/types.h>          /* for stupid systems */
-
-#include "md5.h"
-
-#ifdef SYS_LITTLE_ENDIAN
-
-// Little endian system - no byte swapping required
-
-#define ByteSwapBlock(x, y)
-
-#else
-
-void ByteSwapBlock(uint32_t *buf, unsigned words)
-{
-        byte *p = (byte *)buf;
-
-        do {
-                *buf++ = (uint32_t)((unsigned)p[3] << 8 | p[2]) << 16 |
-                        ((unsigned)p[1] << 8 | p[0]);
-                p += 4;
-        } while (--words);
-}
-
-#endif /* #ifndef SYS_LITTLE_ENDIAN */
-
-/*
- * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
- * initialization constants.
- */
-void
-MD5_Init(md5_context_t *ctx)
-{
-        ctx->buf[0] = 0x67452301;
-        ctx->buf[1] = 0xefcdab89;
-        ctx->buf[2] = 0x98badcfe;
-        ctx->buf[3] = 0x10325476;
-
-        ctx->bytes[0] = 0;
-        ctx->bytes[1] = 0;
-}
-
-/*
- * Update context to reflect the concatenation of another buffer full
- * of bytes.
- */
-void
-MD5_Update(md5_context_t *ctx, byte const *buf, unsigned len)
-{
-        uint32_t t;
-
-        /* Update byte count */
-
-        t = ctx->bytes[0];
-        if ((ctx->bytes[0] = t + len) < t)
-                ctx->bytes[1]++;        /* Carry from low to high */
-
-        t = 64 - (t & 0x3f);    /* Space available in ctx->in (at least 1) */
-        if (t > len) {
-                memcpy((byte *)ctx->in + 64 - t, buf, len);
-                return;
-        }
-        /* First chunk is an odd size */
-        memcpy((byte *)ctx->in + 64 - t, buf, t);
-        ByteSwapBlock(ctx->in, 16);
-        MD5_Transform(ctx->buf, ctx->in);
-        buf += t;
-        len -= t;
-
-        /* Process data in 64-byte chunks */
-        while (len >= 64) {
-                memcpy(ctx->in, buf, 64);
-                ByteSwapBlock(ctx->in, 16);
-                MD5_Transform(ctx->buf, ctx->in);
-                buf += 64;
-                len -= 64;
-        }
-
-        /* Handle any remaining bytes of data. */
-        memcpy(ctx->in, buf, len);
-}
-
-void MD5_UpdateInt32(md5_context_t *context, unsigned int val)
-{
-        byte buf[4];
-
-        buf[0] = (val >> 24) & 0xff;
-        buf[1] = (val >> 16) & 0xff;
-        buf[2] = (val >> 8) & 0xff;
-        buf[3] = val & 0xff;
-
-        MD5_Update(context, buf, 4);
-}
-
-void MD5_UpdateString(md5_context_t *context, char *str)
-{
-        MD5_Update(context, (byte *) str, strlen(str) + 1);
-}
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern 
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-void
-MD5_Final(byte digest[16], md5_context_t *ctx)
-{
-        int count = ctx->bytes[0] & 0x3f;       /* Number of bytes in ctx->in */
-        byte *p = (byte *)ctx->in + count;
-
-        /* Set the first char of padding to 0x80.  There is always room. */
-        *p++ = 0x80;
-
-        /* Bytes of padding needed to make 56 bytes (-8..55) */
-        count = 56 - 1 - count;
-
-        if (count < 0) {        /* Padding forces an extra block */
-                memset(p, 0, count + 8);
-                ByteSwapBlock(ctx->in, 16);
-                MD5_Transform(ctx->buf, ctx->in);
-                p = (byte *)ctx->in;
-                count = 56;
-        }
-        memset(p, 0, count);
-        ByteSwapBlock(ctx->in, 14);
-
-        /* Append length in bits and transform */
-        ctx->in[14] = ctx->bytes[0] << 3;
-        ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
-        MD5_Transform(ctx->buf, ctx->in);
-
-        ByteSwapBlock(ctx->buf, 4);
-        memcpy(digest, ctx->buf, 16);
-        memset(ctx, 0, sizeof(ctx));    /* In case it's sensitive */
-}
-
-#ifndef ASM_MD5
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f,w,x,y,z,in,s) \
-         (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data.  MD5_Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-void
-MD5_Transform(uint32_t buf[4], uint32_t const in[16])
-{
-        register uint32_t a, b, c, d;
-
-        a = buf[0];
-        b = buf[1];
-        c = buf[2];
-        d = buf[3];
-
-        MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
-        MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
-        MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
-        MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
-        MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
-        MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
-        MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
-        MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
-        MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
-        MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
-        MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
-        MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
-        MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
-        MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
-        MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
-        MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
-        MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
-        MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
-        MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
-        MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
-        MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
-        MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
-        MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
-        MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
-        MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
-        MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
-        MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
-        MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
-        MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
-        MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
-        MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
-        MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
-        MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
-        MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
-        MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
-        MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
-        MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
-        MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
-        MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
-        MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
-        MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
-        MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
-        MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
-        MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
-        MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
-        MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
-        MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
-        MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
-        MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
-        MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
-        MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
-        MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
-        MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
-        MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
-        MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
-        MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
-        MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
-        MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
-        MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
-        MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
-        MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
-        MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
-        MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
-        MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
-        buf[0] += a;
-        buf[1] += b;
-        buf[2] += c;
-        buf[3] += d;
-}
-
-#endif
-
--- a/src/md5.h
+++ /dev/null
@@ -1,45 +1,0 @@
-/*
- * This is the header file for the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest.  This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * md5_context_s structure, pass it to MD5_Init, call MD5_Update as
- * needed on buffers full of bytes, and then call MD5_Final, which
- * will fill a supplied 16-byte array with the digest.
- *
- * Changed so as no longer to depend on Colin Plumb's `usual.h'
- * header definitions; now uses stuff from dpkg's config.h
- *  - Ian Jackson <ian@chiark.greenend.org.uk>.
- * Still in the public domain.
- */
-
-#ifndef MD5_H
-#define MD5_H
-
-#include "doomtype.h"
-
-typedef struct md5_context_s md5_context_t;
-typedef byte md5_digest_t[16];
-
-struct md5_context_s {
-        uint32_t buf[4];
-        uint32_t bytes[2];
-        uint32_t in[16];
-};
-
-void MD5_Init(md5_context_t *context);
-void MD5_Update(md5_context_t *context, byte const *buf, unsigned len);
-void MD5_UpdateInt32(md5_context_t *context, unsigned int val);
-void MD5_UpdateString(md5_context_t *context, char *str);
-void MD5_Final(unsigned char digest[16], md5_context_t *context);
-void MD5_Transform(uint32_t buf[4], uint32_t const in[16]);
-
-#endif /* !MD5_H */
-
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -154,8 +154,8 @@
 
 // Hash checksums of our wad directory and dehacked data.
 
-md5_digest_t net_local_wad_md5sum;
-md5_digest_t net_local_deh_md5sum;
+sha1_digest_t net_local_wad_sha1sum;
+sha1_digest_t net_local_deh_sha1sum;
 
 // Are we playing with the freedoom IWAD?
 
@@ -905,8 +905,8 @@
 
     server_addr = addr;
 
-    memcpy(net_local_wad_md5sum, data->wad_md5sum, sizeof(md5_digest_t));
-    memcpy(net_local_deh_md5sum, data->deh_md5sum, sizeof(md5_digest_t));
+    memcpy(net_local_wad_sha1sum, data->wad_sha1sum, sizeof(sha1_digest_t));
+    memcpy(net_local_deh_sha1sum, data->deh_sha1sum, sizeof(sha1_digest_t));
     net_local_is_freedoom = data->is_freedoom;
 
     // create a new network I/O context and add just the
@@ -1049,6 +1049,17 @@
         net_player_name = getenv("USER");
     if (net_player_name == NULL)
         net_player_name = getenv("USERNAME");
+
+    // On Windows, environment variables are in OEM codepage
+    // encoding, so convert to UTF8:
+
+#ifdef _WIN32
+    if (net_player_name != NULL)
+    {
+        net_player_name = M_OEMToUTF8(net_player_name);
+    }
+#endif
+
     if (net_player_name == NULL)
         net_player_name = "Player";
 }
--- a/src/net_client.h
+++ b/src/net_client.h
@@ -26,7 +26,7 @@
 
 #include "doomtype.h"
 #include "d_ticcmd.h"
-#include "md5.h"
+#include "sha1.h"
 #include "net_defs.h"
 
 boolean NET_CL_Connect(net_addr_t *addr, net_connect_data_t *data);
@@ -46,11 +46,11 @@
 extern boolean net_waiting_for_start;
 extern char *net_player_name;
 
-extern md5_digest_t net_server_wad_md5sum;
-extern md5_digest_t net_server_deh_md5sum;
+extern sha1_digest_t net_server_wad_sha1sum;
+extern sha1_digest_t net_server_deh_sha1sum;
 extern unsigned int net_server_is_freedoom;
-extern md5_digest_t net_local_wad_md5sum;
-extern md5_digest_t net_local_deh_md5sum;
+extern sha1_digest_t net_local_wad_sha1sum;
+extern sha1_digest_t net_local_deh_sha1sum;
 extern unsigned int net_local_is_freedoom;
 
 extern boolean drone;
--- a/src/net_defs.h
+++ b/src/net_defs.h
@@ -30,7 +30,7 @@
 
 #include "doomtype.h"
 #include "d_ticcmd.h"
-#include "md5.h"
+#include "sha1.h"
 
 // Absolute maximum number of "nodes" in the game.  This is different to
 // NET_MAXPLAYERS, as there may be observers that are not participating
@@ -140,7 +140,13 @@
     NET_MASTER_PACKET_TYPE_ADD,
     NET_MASTER_PACKET_TYPE_ADD_RESPONSE,
     NET_MASTER_PACKET_TYPE_QUERY,
-    NET_MASTER_PACKET_TYPE_QUERY_RESPONSE
+    NET_MASTER_PACKET_TYPE_QUERY_RESPONSE,
+    NET_MASTER_PACKET_TYPE_GET_METADATA,
+    NET_MASTER_PACKET_TYPE_GET_METADATA_RESPONSE,
+    NET_MASTER_PACKET_TYPE_SIGN_START,
+    NET_MASTER_PACKET_TYPE_SIGN_START_RESPONSE,
+    NET_MASTER_PACKET_TYPE_SIGN_END,
+    NET_MASTER_PACKET_TYPE_SIGN_END_RESPONSE,
 } net_master_packet_type_t;
 
 // Settings specified when the client connects to the server.
@@ -153,8 +159,8 @@
     int drone;
     int max_players;
     int is_freedoom;
-    md5_digest_t wad_md5sum;
-    md5_digest_t deh_md5sum;
+    sha1_digest_t wad_sha1sum;
+    sha1_digest_t deh_sha1sum;
     int player_class;
 } net_connect_data_t;
 
@@ -239,8 +245,8 @@
     int consoleplayer;
     char player_names[NET_MAXPLAYERS][MAXPLAYERNAME];
     char player_addrs[NET_MAXPLAYERS][MAXPLAYERNAME];
-    md5_digest_t wad_md5sum;
-    md5_digest_t deh_md5sum;
+    sha1_digest_t wad_sha1sum;
+    sha1_digest_t deh_sha1sum;
     int is_freedoom;
 } net_waitdata_t;
 
--- a/src/net_gui.c
+++ b/src/net_gui.c
@@ -184,13 +184,13 @@
     TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, startgame);
 }
 
-static void PrintMD5Digest(char *s, byte *digest)
+static void PrintSHA1Digest(char *s, byte *digest)
 {
     unsigned int i;
 
     printf("%s: ", s);
 
-    for (i=0; i<sizeof(md5_digest_t); ++i)
+    for (i=0; i<sizeof(sha1_digest_t); ++i)
     {
         printf("%02x", digest[i]);
     }
@@ -198,7 +198,7 @@
     printf("\n");
 }
 
-static void CheckMD5Sums(void)
+static void CheckSHA1Sums(void)
 {
     boolean correct_wad, correct_deh;
     boolean same_freedoom;
@@ -209,12 +209,12 @@
         return;
     }
 
-    correct_wad = memcmp(net_local_wad_md5sum,
-                         net_client_wait_data.wad_md5sum, 
-                         sizeof(md5_digest_t)) == 0;
-    correct_deh = memcmp(net_local_deh_md5sum,
-                         net_client_wait_data.deh_md5sum, 
-                         sizeof(md5_digest_t)) == 0;
+    correct_wad = memcmp(net_local_wad_sha1sum,
+                         net_client_wait_data.wad_sha1sum, 
+                         sizeof(sha1_digest_t)) == 0;
+    correct_deh = memcmp(net_local_deh_sha1sum,
+                         net_client_wait_data.deh_sha1sum, 
+                         sizeof(sha1_digest_t)) == 0;
     same_freedoom = net_client_wait_data.is_freedoom == net_local_is_freedoom;
 
     if (correct_wad && correct_deh && same_freedoom)
@@ -224,9 +224,9 @@
 
     if (!correct_wad)
     {
-        printf("Warning: WAD MD5 does not match server:\n");
-        PrintMD5Digest("Local", net_local_wad_md5sum);
-        PrintMD5Digest("Server", net_client_wait_data.wad_md5sum);
+        printf("Warning: WAD SHA1 does not match server:\n");
+        PrintSHA1Digest("Local", net_local_wad_sha1sum);
+        PrintSHA1Digest("Server", net_client_wait_data.wad_sha1sum);
     }
 
     if (!same_freedoom)
@@ -239,9 +239,9 @@
 
     if (!correct_deh)
     {
-        printf("Warning: Dehacked MD5 does not match server:\n");
-        PrintMD5Digest("Local", net_local_deh_md5sum);
-        PrintMD5Digest("Server", net_client_wait_data.deh_md5sum);
+        printf("Warning: Dehacked SHA1 does not match server:\n");
+        PrintSHA1Digest("Local", net_local_deh_sha1sum);
+        PrintSHA1Digest("Server", net_client_wait_data.deh_sha1sum);
     }
 
     window = TXT_NewWindow("WARNING");
@@ -308,7 +308,7 @@
     while (net_waiting_for_start)
     {
         UpdateGUI(settings);
-        CheckMD5Sums();
+        CheckSHA1Sums();
 
         TXT_DispatchEvents();
         TXT_DrawDesktop();
--- a/src/net_query.c
+++ b/src/net_query.c
@@ -46,6 +46,10 @@
 
 #define QUERY_TIMEOUT_SECS 2
 
+// Time to wait for secure demo signatures before declaring a timeout.
+
+#define SIGNATURE_TIMEOUT_SECS 5
+
 // Number of query attempts to make before giving up on a server.
 
 #define QUERY_MAX_ATTEMPTS 3
@@ -89,6 +93,8 @@
 static boolean printed_header = false;
 static int last_query_time = 0;
 
+static char *securedemo_start_message = NULL;
+
 // Resolve the master server address.
 
 net_addr_t *NET_Query_ResolveMaster(net_context_t *context)
@@ -813,5 +819,126 @@
     {
         return NULL;
     }
+}
+
+// Block until a packet of the given type is received from the given
+// address.
+
+static net_packet_t *BlockForPacket(net_addr_t *addr, unsigned int packet_type,
+                                    unsigned int timeout_ms)
+{
+    net_packet_t *packet;
+    net_addr_t *packet_src;
+    unsigned int read_packet_type;
+    unsigned int start_time;
+
+    start_time = I_GetTimeMS();
+
+    while (I_GetTimeMS() < start_time + timeout_ms)
+    {
+        if (!NET_RecvPacket(query_context, &packet_src, &packet))
+        {
+            I_Sleep(20);
+            continue;
+        }
+
+        if (packet_src == addr
+         && NET_ReadInt16(packet, &read_packet_type)
+         && packet_type == read_packet_type)
+        {
+            return packet;
+        }
+
+        NET_FreePacket(packet);
+    }
+
+    // Timeout - no response.
+
+    return NULL;
+}
+
+// Query master server for secure demo start seed value.
+
+boolean NET_StartSecureDemo(prng_seed_t seed)
+{
+    net_packet_t *request, *response;
+    net_addr_t *master_addr;
+    char *signature;
+    boolean result;
+
+    NET_Query_Init();
+    master_addr = NET_Query_ResolveMaster(query_context);
+
+    // Send request packet to master server.
+
+    request = NET_NewPacket(10);
+    NET_WriteInt16(request, NET_MASTER_PACKET_TYPE_SIGN_START);
+    NET_SendPacket(master_addr, request);
+    NET_FreePacket(request);
+
+    // Block for response and read contents.
+    // The signed start message will be saved for later.
+
+    response = BlockForPacket(master_addr,
+                              NET_MASTER_PACKET_TYPE_SIGN_START_RESPONSE,
+                              SIGNATURE_TIMEOUT_SECS * 1000);
+
+    result = false;
+
+    if (response != NULL)
+    {
+        if (NET_ReadPRNGSeed(response, seed))
+        {
+            signature = NET_ReadString(response);
+
+            if (signature != NULL)
+            {
+                securedemo_start_message = strdup(signature);
+                result = true;
+            }
+        }
+
+        NET_FreePacket(response);
+    }
+
+    return result;
+}
+
+// Query master server for secure demo end signature.
+
+char *NET_EndSecureDemo(sha1_digest_t demo_hash)
+{
+    net_packet_t *request, *response;
+    net_addr_t *master_addr;
+    char *signature;
+
+    master_addr = NET_Query_ResolveMaster(query_context);
+
+    // Construct end request and send to master server.
+
+    request = NET_NewPacket(10);
+    NET_WriteInt16(request, NET_MASTER_PACKET_TYPE_SIGN_END);
+    NET_WriteSHA1Sum(request, demo_hash);
+    NET_WriteString(request, securedemo_start_message);
+    NET_SendPacket(master_addr, request);
+    NET_FreePacket(request);
+
+    // Block for response. The response packet simply contains a string
+    // with the ASCII signature.
+
+    response = BlockForPacket(master_addr,
+                              NET_MASTER_PACKET_TYPE_SIGN_END_RESPONSE,
+                              SIGNATURE_TIMEOUT_SECS * 1000);
+
+    if (response == NULL)
+    {
+        return NULL;
+    }
+
+    signature = NET_ReadString(response);
+
+    NET_FreePacket(response);
+
+    return signature;
 }
 
--- a/src/net_sdl.c
+++ b/src/net_sdl.c
@@ -44,6 +44,7 @@
 
 #define DEFAULT_PORT 2342
 
+static boolean initted = false;
 static int port = DEFAULT_PORT;
 static UDPsocket udpsocket;
 static UDPpacket *recvpacket;
@@ -162,6 +163,9 @@
 {
     int p;
 
+    if (initted)
+        return true;
+
     //!
     // @category net
     // @arg <n>
@@ -189,6 +193,8 @@
     srand(time(NULL));
 #endif
 
+    initted = true;
+
     return true;
 }
 
@@ -195,7 +201,10 @@
 static boolean NET_SDL_InitServer(void)
 {
     int p;
-    
+
+    if (initted)
+        return true;
+
     p = M_CheckParmWithArgs("-port", 1);
     if (p > 0)
         port = atoi(myargv[p+1]);
@@ -213,6 +222,8 @@
 #ifdef DROP_PACKETS
     srand(time(NULL));
 #endif
+
+    initted = true;
 
     return true;
 }
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -50,6 +50,10 @@
 
 #define MASTER_REFRESH_PERIOD 20 * 60 /* 20 minutes */
 
+// How often to re-resolve the address of the master server?
+
+#define MASTER_RESOLVE_PERIOD 8 * 60 * 60 /* 8 hours */
+
 typedef enum
 {
     // waiting for the game to start
@@ -101,10 +105,10 @@
 
     boolean drone;
 
-    // MD5 hash sums of the client's WAD directory and dehacked data
+    // SHA1 hash sums of the client's WAD directory and dehacked data
 
-    md5_digest_t wad_md5sum;
-    md5_digest_t deh_md5sum;
+    sha1_digest_t wad_sha1sum;
+    sha1_digest_t deh_sha1sum;
 
     // Is this client is playing with the Freedoom IWAD?
 
@@ -150,6 +154,7 @@
 
 static net_addr_t *master_server = NULL;
 static unsigned int master_refresh_time;
+static unsigned int master_resolve_time;
 
 // receive window
 
@@ -646,10 +651,10 @@
             sv_gamemission = data.gamemission;
         }
 
-        // Save the MD5 checksums
+        // Save the SHA1 checksums
 
-        memcpy(client->wad_md5sum, data.wad_md5sum, sizeof(md5_digest_t));
-        memcpy(client->deh_md5sum, data.deh_md5sum, sizeof(md5_digest_t));
+        memcpy(client->wad_sha1sum, data.wad_sha1sum, sizeof(sha1_digest_t));
+        memcpy(client->deh_sha1sum, data.deh_sha1sum, sizeof(sha1_digest_t));
         client->is_freedoom = data.is_freedoom;
         client->max_players = data.max_players;
 
@@ -1287,10 +1292,10 @@
         controller = client;
     }
 
-    memcpy(&wait_data.wad_md5sum, &controller->wad_md5sum,
-           sizeof(md5_digest_t));
-    memcpy(&wait_data.deh_md5sum, &controller->deh_md5sum,
-           sizeof(md5_digest_t));
+    memcpy(&wait_data.wad_sha1sum, &controller->wad_sha1sum,
+           sizeof(sha1_digest_t));
+    memcpy(&wait_data.deh_sha1sum, &controller->deh_sha1sum,
+           sizeof(sha1_digest_t));
     wait_data.is_freedoom = controller->is_freedoom;
 
     // set name and address of each player:
@@ -1605,6 +1610,42 @@
     server_initialized = true;
 }
 
+static void UpdateMasterServer(void)
+{
+    unsigned int now;
+
+    now = I_GetTimeMS();
+
+    // The address of the master server can change. Periodically
+    // re-resolve the master server to update.
+
+    if (now - master_resolve_time > MASTER_RESOLVE_PERIOD * 1000)
+    {
+        net_addr_t *new_addr;
+        printf("Re-resolve master server\n");
+
+        new_addr = NET_Query_ResolveMaster(server_context);
+
+        // Has the master server changed address?
+
+        if (new_addr != NULL && new_addr != master_server)
+        {
+            NET_FreeAddress(master_server);
+            master_server = new_addr;
+        }
+
+        master_resolve_time = now;
+    }
+
+    // Possibly refresh our registration with the master server.
+
+    if (now - master_refresh_time > MASTER_REFRESH_PERIOD * 1000)
+    {
+        NET_Query_AddToMaster(master_server);
+        master_refresh_time = now;
+    }
+}
+
 void NET_SV_RegisterWithMaster(void)
 {
     //!
@@ -1629,6 +1670,7 @@
     {
         NET_Query_AddToMaster(master_server);
         master_refresh_time = I_GetTimeMS();
+        master_resolve_time = master_refresh_time;
     }
 }
 
@@ -1652,13 +1694,9 @@
         NET_FreePacket(packet);
     }
 
-    // Possibly refresh our registration with the master server.
-
-    if (master_server != NULL
-     && I_GetTimeMS() - master_refresh_time > MASTER_REFRESH_PERIOD * 1000)
+    if (master_server != NULL)
     {
-        NET_Query_AddToMaster(master_server);
-        master_refresh_time = I_GetTimeMS();
+        UpdateMasterServer();
     }
 
     // "Run" any clients that may have things to do, independent of responses
--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -39,8 +39,8 @@
     NET_WriteInt8(packet, data->drone);
     NET_WriteInt8(packet, data->max_players);
     NET_WriteInt8(packet, data->is_freedoom);
-    NET_WriteMD5Sum(packet, data->wad_md5sum);
-    NET_WriteMD5Sum(packet, data->deh_md5sum);
+    NET_WriteSHA1Sum(packet, data->wad_sha1sum);
+    NET_WriteSHA1Sum(packet, data->deh_sha1sum);
     NET_WriteInt8(packet, data->player_class);
 }
 
@@ -52,8 +52,8 @@
         && NET_ReadInt8(packet, (unsigned int *) &data->drone)
         && NET_ReadInt8(packet, (unsigned int *) &data->max_players)
         && NET_ReadInt8(packet, (unsigned int *) &data->is_freedoom)
-        && NET_ReadMD5Sum(packet, data->wad_md5sum)
-        && NET_ReadMD5Sum(packet, data->deh_md5sum)
+        && NET_ReadSHA1Sum(packet, data->wad_sha1sum)
+        && NET_ReadSHA1Sum(packet, data->deh_sha1sum)
         && NET_ReadInt8(packet, (unsigned int *) &data->player_class);
 }
 
@@ -461,8 +461,8 @@
         NET_WriteString(packet, data->player_addrs[i]);
     }
 
-    NET_WriteMD5Sum(packet, data->wad_md5sum);
-    NET_WriteMD5Sum(packet, data->deh_md5sum);
+    NET_WriteSHA1Sum(packet, data->wad_sha1sum);
+    NET_WriteSHA1Sum(packet, data->deh_sha1sum);
     NET_WriteInt8(packet, data->is_freedoom);
 }
 
@@ -501,17 +501,17 @@
         strcpy(data->player_addrs[i], s);
     }
 
-    return NET_ReadMD5Sum(packet, data->wad_md5sum)
-        && NET_ReadMD5Sum(packet, data->deh_md5sum)
+    return NET_ReadSHA1Sum(packet, data->wad_sha1sum)
+        && NET_ReadSHA1Sum(packet, data->deh_sha1sum)
         && NET_ReadInt8(packet, (unsigned int *) &data->is_freedoom);
 }
 
-boolean NET_ReadMD5Sum(net_packet_t *packet, md5_digest_t digest)
+static boolean NET_ReadBlob(net_packet_t *packet, uint8_t *buf, size_t len)
 {
     unsigned int b;
     int i;
 
-    for (i=0; i<16; ++i)
+    for (i=0; i<len; ++i)
     {
         if (!NET_ReadInt8(packet, &b))
         {
@@ -518,20 +518,40 @@
             return false;
         }
 
-        digest[i] = b;
+        buf[i] = b;
     }
 
     return true;
 }
 
-void NET_WriteMD5Sum(net_packet_t *packet, md5_digest_t digest)
+static void NET_WriteBlob(net_packet_t *packet, uint8_t *buf, size_t len)
 {
     int i;
 
-    for (i=0; i<16; ++i)
+    for (i=0; i<len; ++i)
     {
-        NET_WriteInt8(packet, digest[i]);
+        NET_WriteInt8(packet, buf[i]);
     }
+}
+
+boolean NET_ReadSHA1Sum(net_packet_t *packet, sha1_digest_t digest)
+{
+    return NET_ReadBlob(packet, digest, sizeof(sha1_digest_t));
+}
+
+void NET_WriteSHA1Sum(net_packet_t *packet, sha1_digest_t digest)
+{
+    NET_WriteBlob(packet, digest, sizeof(sha1_digest_t));
+}
+
+boolean NET_ReadPRNGSeed(net_packet_t *packet, prng_seed_t seed)
+{
+    return NET_ReadBlob(packet, seed, sizeof(prng_seed_t));
+}
+
+void NET_WritePRNGSeed(net_packet_t *packet, prng_seed_t seed)
+{
+    NET_WriteBlob(packet, seed, sizeof(prng_seed_t));
 }
 
 // "Safe" version of puts, for displaying messages received from the
--- a/src/net_structrw.h
+++ b/src/net_structrw.h
@@ -22,7 +22,8 @@
 #ifndef NET_STRUCTRW_H
 #define NET_STRUCTRW_H
 
-#include "md5.h"
+#include "aes_prng.h"
+#include "sha1.h"
 #include "net_defs.h"
 #include "net_packet.h"
 
@@ -43,12 +44,15 @@
 boolean NET_ReadFullTiccmd(net_packet_t *packet, net_full_ticcmd_t *cmd, boolean lowres_turn);
 void NET_WriteFullTiccmd(net_packet_t *packet, net_full_ticcmd_t *cmd, boolean lowres_turn);
 
-boolean NET_ReadMD5Sum(net_packet_t *packet, md5_digest_t digest);
-void NET_WriteMD5Sum(net_packet_t *packet, md5_digest_t digest);
+boolean NET_ReadSHA1Sum(net_packet_t *packet, sha1_digest_t digest);
+void NET_WriteSHA1Sum(net_packet_t *packet, sha1_digest_t digest);
 
 void NET_WriteWaitData(net_packet_t *packet, net_waitdata_t *data);
 boolean NET_ReadWaitData(net_packet_t *packet, net_waitdata_t *data);
 
 void NET_SafePuts(char *msg);
+
+boolean NET_ReadPRNGSeed(net_packet_t *packet, prng_seed_t seed);
+void NET_WritePRNGSeed(net_packet_t *packet, prng_seed_t seed);
 
 #endif /* #ifndef NET_STRUCTRW_H */
--- a/src/setup/Makefile.am
+++ b/src/setup/Makefile.am
@@ -31,7 +31,7 @@
 app_DATA = @PROGRAM_PREFIX@setup.desktop
 
 @PROGRAM_PREFIX@setup.desktop : setup.desktop
-	cp $^ $@
+	cp setup.desktop $@
 
 if HAVE_PYTHON
 
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -978,6 +978,7 @@
     int i;
     char *defaults[] = 
     {
+        HUSTR_CHATMACRO0,
         HUSTR_CHATMACRO1,
         HUSTR_CHATMACRO2,
         HUSTR_CHATMACRO3,
@@ -987,7 +988,6 @@
         HUSTR_CHATMACRO7,
         HUSTR_CHATMACRO8,
         HUSTR_CHATMACRO9,
-        HUSTR_CHATMACRO0,
     };
     
     // If the chat macros have not been set, initialize with defaults.
@@ -1001,6 +1001,28 @@
     }
 }
 
+#ifdef _WIN32
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+char *M_OEMToUTF8(const char *oem)
+{
+    unsigned int len = strlen(oem) + 1;
+    wchar_t *tmp;
+    char *result;
+
+    tmp = malloc(len * sizeof(wchar_t));
+    MultiByteToWideChar(CP_OEMCP, 0, oem, len, tmp, len);
+    result = malloc(len * 4);
+    WideCharToMultiByte(CP_UTF8, 0, tmp, len, result, len * 4, NULL, NULL);
+    free(tmp);
+
+    return result;
+}
+
+#endif
+
 void SetPlayerNameDefault(void)
 {
     if (net_player_name == NULL)
@@ -1012,6 +1034,16 @@
     {
         net_player_name = strdup(getenv("USERNAME"));
     }
+
+    // On Windows, environment variables are in OEM codepage
+    // encoding, so convert to UTF8:
+
+#ifdef _WIN32
+    if (net_player_name != NULL)
+    {
+        net_player_name = M_OEMToUTF8(net_player_name);
+    }
+#endif
 
     if (net_player_name == NULL)
     {
--- /dev/null
+++ b/src/sha1.c
@@ -1,0 +1,319 @@
+/* sha1.c - SHA1 hash function
+ *	Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ *
+ * Please see below for more legal information!
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+/*  Test vectors:
+ *
+ *  "abc"
+ *  A999 3E36 4706 816A BA3E  2571 7850 C26C 9CD0 D89D
+ *
+ *  "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
+ *  8498 3E44 1C3B D26E BAAE  4AA1 F951 29E5 E546 70F1
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "i_swap.h"
+#include "sha1.h"
+
+void SHA1_Init(sha1_context_t *hd)
+{
+    hd->h0 = 0x67452301;
+    hd->h1 = 0xefcdab89;
+    hd->h2 = 0x98badcfe;
+    hd->h3 = 0x10325476;
+    hd->h4 = 0xc3d2e1f0;
+    hd->nblocks = 0;
+    hd->count = 0;
+}
+
+
+/****************
+ * Transform the message X which consists of 16 32-bit-words
+ */
+static void Transform(sha1_context_t *hd, byte *data)
+{
+    uint32_t a,b,c,d,e,tm;
+    uint32_t x[16];
+
+    /* get values from the chaining vars */
+    a = hd->h0;
+    b = hd->h1;
+    c = hd->h2;
+    d = hd->h3;
+    e = hd->h4;
+
+#ifdef SYS_BIG_ENDIAN
+    memcpy(x, data, 64);
+#else
+    {
+        int i;
+        byte *p2;
+        for(i=0, p2=(byte*)x; i < 16; i++, p2 += 4 )
+        {
+            p2[3] = *data++;
+            p2[2] = *data++;
+            p2[1] = *data++;
+            p2[0] = *data++;
+        }
+    }
+#endif
+
+
+#define K1  0x5A827999L
+#define K2  0x6ED9EBA1L
+#define K3  0x8F1BBCDCL
+#define K4  0xCA62C1D6L
+#define F1(x,y,z)   ( z ^ ( x & ( y ^ z ) ) )
+#define F2(x,y,z)   ( x ^ y ^ z )
+#define F3(x,y,z)   ( ( x & y ) | ( z & ( x | y ) ) )
+#define F4(x,y,z)   ( x ^ y ^ z )
+
+#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
+
+#define M(i) ( tm =   x[i&0x0f] ^ x[(i-14)&0x0f] \
+		    ^ x[(i-8)&0x0f] ^ x[(i-3)&0x0f] \
+	       , (x[i&0x0f] = rol(tm,1)) )
+
+#define R(a,b,c,d,e,f,k,m)  do { e += rol( a, 5 )     \
+				      + f( b, c, d )  \
+				      + k	      \
+				      + m;	      \
+				 b = rol( b, 30 );    \
+			       } while(0)
+    R( a, b, c, d, e, F1, K1, x[ 0] );
+    R( e, a, b, c, d, F1, K1, x[ 1] );
+    R( d, e, a, b, c, F1, K1, x[ 2] );
+    R( c, d, e, a, b, F1, K1, x[ 3] );
+    R( b, c, d, e, a, F1, K1, x[ 4] );
+    R( a, b, c, d, e, F1, K1, x[ 5] );
+    R( e, a, b, c, d, F1, K1, x[ 6] );
+    R( d, e, a, b, c, F1, K1, x[ 7] );
+    R( c, d, e, a, b, F1, K1, x[ 8] );
+    R( b, c, d, e, a, F1, K1, x[ 9] );
+    R( a, b, c, d, e, F1, K1, x[10] );
+    R( e, a, b, c, d, F1, K1, x[11] );
+    R( d, e, a, b, c, F1, K1, x[12] );
+    R( c, d, e, a, b, F1, K1, x[13] );
+    R( b, c, d, e, a, F1, K1, x[14] );
+    R( a, b, c, d, e, F1, K1, x[15] );
+    R( e, a, b, c, d, F1, K1, M(16) );
+    R( d, e, a, b, c, F1, K1, M(17) );
+    R( c, d, e, a, b, F1, K1, M(18) );
+    R( b, c, d, e, a, F1, K1, M(19) );
+    R( a, b, c, d, e, F2, K2, M(20) );
+    R( e, a, b, c, d, F2, K2, M(21) );
+    R( d, e, a, b, c, F2, K2, M(22) );
+    R( c, d, e, a, b, F2, K2, M(23) );
+    R( b, c, d, e, a, F2, K2, M(24) );
+    R( a, b, c, d, e, F2, K2, M(25) );
+    R( e, a, b, c, d, F2, K2, M(26) );
+    R( d, e, a, b, c, F2, K2, M(27) );
+    R( c, d, e, a, b, F2, K2, M(28) );
+    R( b, c, d, e, a, F2, K2, M(29) );
+    R( a, b, c, d, e, F2, K2, M(30) );
+    R( e, a, b, c, d, F2, K2, M(31) );
+    R( d, e, a, b, c, F2, K2, M(32) );
+    R( c, d, e, a, b, F2, K2, M(33) );
+    R( b, c, d, e, a, F2, K2, M(34) );
+    R( a, b, c, d, e, F2, K2, M(35) );
+    R( e, a, b, c, d, F2, K2, M(36) );
+    R( d, e, a, b, c, F2, K2, M(37) );
+    R( c, d, e, a, b, F2, K2, M(38) );
+    R( b, c, d, e, a, F2, K2, M(39) );
+    R( a, b, c, d, e, F3, K3, M(40) );
+    R( e, a, b, c, d, F3, K3, M(41) );
+    R( d, e, a, b, c, F3, K3, M(42) );
+    R( c, d, e, a, b, F3, K3, M(43) );
+    R( b, c, d, e, a, F3, K3, M(44) );
+    R( a, b, c, d, e, F3, K3, M(45) );
+    R( e, a, b, c, d, F3, K3, M(46) );
+    R( d, e, a, b, c, F3, K3, M(47) );
+    R( c, d, e, a, b, F3, K3, M(48) );
+    R( b, c, d, e, a, F3, K3, M(49) );
+    R( a, b, c, d, e, F3, K3, M(50) );
+    R( e, a, b, c, d, F3, K3, M(51) );
+    R( d, e, a, b, c, F3, K3, M(52) );
+    R( c, d, e, a, b, F3, K3, M(53) );
+    R( b, c, d, e, a, F3, K3, M(54) );
+    R( a, b, c, d, e, F3, K3, M(55) );
+    R( e, a, b, c, d, F3, K3, M(56) );
+    R( d, e, a, b, c, F3, K3, M(57) );
+    R( c, d, e, a, b, F3, K3, M(58) );
+    R( b, c, d, e, a, F3, K3, M(59) );
+    R( a, b, c, d, e, F4, K4, M(60) );
+    R( e, a, b, c, d, F4, K4, M(61) );
+    R( d, e, a, b, c, F4, K4, M(62) );
+    R( c, d, e, a, b, F4, K4, M(63) );
+    R( b, c, d, e, a, F4, K4, M(64) );
+    R( a, b, c, d, e, F4, K4, M(65) );
+    R( e, a, b, c, d, F4, K4, M(66) );
+    R( d, e, a, b, c, F4, K4, M(67) );
+    R( c, d, e, a, b, F4, K4, M(68) );
+    R( b, c, d, e, a, F4, K4, M(69) );
+    R( a, b, c, d, e, F4, K4, M(70) );
+    R( e, a, b, c, d, F4, K4, M(71) );
+    R( d, e, a, b, c, F4, K4, M(72) );
+    R( c, d, e, a, b, F4, K4, M(73) );
+    R( b, c, d, e, a, F4, K4, M(74) );
+    R( a, b, c, d, e, F4, K4, M(75) );
+    R( e, a, b, c, d, F4, K4, M(76) );
+    R( d, e, a, b, c, F4, K4, M(77) );
+    R( c, d, e, a, b, F4, K4, M(78) );
+    R( b, c, d, e, a, F4, K4, M(79) );
+
+    /* update chainig vars */
+    hd->h0 += a;
+    hd->h1 += b;
+    hd->h2 += c;
+    hd->h3 += d;
+    hd->h4 += e;
+}
+
+
+/* Update the message digest with the contents
+ * of INBUF with length INLEN.
+ */
+void SHA1_Update(sha1_context_t *hd, byte *inbuf, size_t inlen)
+{
+    if (hd->count == 64)
+    {
+        /* flush the buffer */
+	Transform(hd, hd->buf);
+	hd->count = 0;
+	hd->nblocks++;
+    }
+    if (!inbuf)
+	return;
+    if (hd->count)
+    {
+	for (; inlen && hd->count < 64; inlen--)
+	    hd->buf[hd->count++] = *inbuf++;
+	SHA1_Update(hd, NULL, 0);
+	if (!inlen)
+	    return;
+    }
+
+    while (inlen >= 64)
+    {
+	Transform(hd, inbuf);
+	hd->count = 0;
+	hd->nblocks++;
+	inlen -= 64;
+	inbuf += 64;
+    }
+    for (; inlen && hd->count < 64; inlen--)
+	hd->buf[hd->count++] = *inbuf++;
+}
+
+
+/* The routine final terminates the computation and
+ * returns the digest.
+ * The handle is prepared for a new cycle, but adding bytes to the
+ * handle will the destroy the returned buffer.
+ * Returns: 20 bytes representing the digest.
+ */
+
+void SHA1_Final(sha1_digest_t digest, sha1_context_t *hd)
+{
+    uint32_t t, msb, lsb;
+    byte *p;
+
+    SHA1_Update(hd, NULL, 0); /* flush */;
+
+    t = hd->nblocks;
+    /* multiply by 64 to make a byte count */
+    lsb = t << 6;
+    msb = t >> 26;
+    /* add the count */
+    t = lsb;
+    if ((lsb += hd->count) < t)
+	msb++;
+    /* multiply by 8 to make a bit count */
+    t = lsb;
+    lsb <<= 3;
+    msb <<= 3;
+    msb |= t >> 29;
+
+    if (hd->count < 56)
+    {
+        /* enough room */
+	hd->buf[hd->count++] = 0x80; /* pad */
+	while (hd->count < 56)
+	    hd->buf[hd->count++] = 0;  /* pad */
+    }
+    else
+    {
+        /* need one extra block */
+	hd->buf[hd->count++] = 0x80; /* pad character */
+	while (hd->count < 64)
+	    hd->buf[hd->count++] = 0;
+	SHA1_Update(hd, NULL, 0);  /* flush */;
+	memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
+    }
+    /* append the 64 bit count */
+    hd->buf[56] = msb >> 24;
+    hd->buf[57] = msb >> 16;
+    hd->buf[58] = msb >>  8;
+    hd->buf[59] = msb	   ;
+    hd->buf[60] = lsb >> 24;
+    hd->buf[61] = lsb >> 16;
+    hd->buf[62] = lsb >>  8;
+    hd->buf[63] = lsb	   ;
+    Transform(hd, hd->buf);
+
+    p = hd->buf;
+#ifdef SYS_BIG_ENDIAN
+#define X(a) do { *(uint32_t*)p = hd->h##a ; p += 4; } while(0)
+#else /* little endian */
+#define X(a) do { *p++ = hd->h##a >> 24; *p++ = hd->h##a >> 16;	 \
+		      *p++ = hd->h##a >> 8; *p++ = hd->h##a; } while(0)
+#endif
+    X(0);
+    X(1);
+    X(2);
+    X(3);
+    X(4);
+#undef X
+
+    memcpy(digest, hd->buf, sizeof(sha1_digest_t));
+}
+
+void SHA1_UpdateInt32(sha1_context_t *context, unsigned int val)
+{
+    byte buf[4];
+
+    buf[0] = (val >> 24) & 0xff;
+    buf[1] = (val >> 16) & 0xff;
+    buf[2] = (val >> 8) & 0xff;
+    buf[3] = val & 0xff;
+
+    SHA1_Update(context, buf, 4);
+}
+
+void SHA1_UpdateString(sha1_context_t *context, char *str)
+{
+    SHA1_Update(context, (byte *) str, strlen(str) + 1);
+}
+
--- /dev/null
+++ b/src/sha1.h
@@ -1,0 +1,48 @@
+// Emacs style mode select   -*- C++ -*- 
+//-----------------------------------------------------------------------------
+//
+// Copyright(C) 2012 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+// DESCRIPTION:
+//     SHA-1 digest.
+//
+//-----------------------------------------------------------------------------
+
+#ifndef __SHA1_H__
+#define __SHA1_H__
+
+#include "doomtype.h"
+
+typedef struct sha1_context_s sha1_context_t;
+typedef byte sha1_digest_t[20];
+
+struct sha1_context_s {
+    uint32_t h0,h1,h2,h3,h4;
+    uint32_t nblocks;
+    byte buf[64];
+    int count;
+};
+
+void SHA1_Init(sha1_context_t *context);
+void SHA1_Update(sha1_context_t *context, byte *buf, size_t len);
+void SHA1_Final(sha1_digest_t digest, sha1_context_t *context);
+void SHA1_UpdateInt32(sha1_context_t *context, unsigned int val);
+void SHA1_UpdateString(sha1_context_t *context, char *str);
+
+#endif /* #ifndef __SHA1_H__ */
+
--- a/src/strife/d_net.c
+++ b/src/strife/d_net.c
@@ -220,8 +220,8 @@
 
     // Read checksums of our WAD directory and dehacked information
 
-    W_Checksum(connect_data->wad_md5sum);
-    DEH_Checksum(connect_data->deh_md5sum);
+    W_Checksum(connect_data->wad_sha1sum);
+    DEH_Checksum(connect_data->deh_sha1sum);
 
     connect_data->is_freedoom = 0;
 }
--- a/src/strife/deh_ammo.c
+++ b/src/strife/deh_ammo.c
@@ -89,14 +89,14 @@
     }
 }
 
-static void DEH_AmmoMD5Hash(md5_context_t *context)
+static void DEH_AmmoSHA1Hash(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMAMMO; ++i)
     {
-        MD5_UpdateInt32(context, clipammo[i]);
-        MD5_UpdateInt32(context, maxammo[i]);
+        SHA1_UpdateInt32(context, clipammo[i]);
+        SHA1_UpdateInt32(context, maxammo[i]);
     }
 }
 
@@ -107,6 +107,6 @@
     DEH_AmmoStart,
     DEH_AmmoParseLine,
     NULL,
-    DEH_AmmoMD5Hash,
+    DEH_AmmoSHA1Hash,
 };
 
--- a/src/strife/deh_frame.c
+++ b/src/strife/deh_frame.c
@@ -146,13 +146,13 @@
     }
 }
 
-static void DEH_FrameMD5Sum(md5_context_t *context)
+static void DEH_FrameSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMSTATES; ++i)
     {
-        DEH_StructMD5Sum(context, &state_mapping, &states[i]);
+        DEH_StructSHA1Sum(context, &state_mapping, &states[i]);
     }
 }
 
@@ -163,6 +163,6 @@
     DEH_FrameStart,
     DEH_FrameParseLine,
     NULL,
-    DEH_FrameMD5Sum,
+    DEH_FrameSHA1Sum,
 };
 
--- a/src/strife/deh_misc.c
+++ b/src/strife/deh_misc.c
@@ -215,13 +215,13 @@
     DEH_Warning(context, "Unknown Misc variable '%s'", variable_name);
 }
 
-static void DEH_MiscMD5Sum(md5_context_t *context)
+static void DEH_MiscSHA1Sum(sha1_context_t *context)
 {
     unsigned int i;
 
     for (i=0; i<arrlen(misc_settings); ++i)
     {
-        MD5_UpdateInt32(context, *misc_settings[i].value);
+        SHA1_UpdateInt32(context, *misc_settings[i].value);
     }
 }
 
@@ -232,6 +232,6 @@
     DEH_MiscStart,
     DEH_MiscParseLine,
     NULL,
-    DEH_MiscMD5Sum,
+    DEH_MiscSHA1Sum,
 };
 
--- a/src/strife/deh_ptr.c
+++ b/src/strife/deh_ptr.c
@@ -129,13 +129,13 @@
     }
 }
 
-static void DEH_PointerMD5Sum(md5_context_t *context)
+static void DEH_PointerSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMSTATES; ++i)
     {
-        MD5_UpdateInt32(context, CodePointerIndex(&states[i].action));
+        SHA1_UpdateInt32(context, CodePointerIndex(&states[i].action));
     }
 }
 
@@ -146,6 +146,6 @@
     DEH_PointerStart,
     DEH_PointerParseLine,
     NULL,
-    DEH_PointerMD5Sum,
+    DEH_PointerSHA1Sum,
 };
 
--- a/src/strife/deh_thing.c
+++ b/src/strife/deh_thing.c
@@ -119,13 +119,13 @@
     DEH_SetMapping(context, &thing_mapping, mobj, variable_name, ivalue);
 }
 
-static void DEH_ThingMD5Sum(md5_context_t *context)
+static void DEH_ThingSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMMOBJTYPES; ++i)
     {
-        DEH_StructMD5Sum(context, &thing_mapping, &mobjinfo[i]);
+        DEH_StructSHA1Sum(context, &thing_mapping, &mobjinfo[i]);
     }
 }
 
@@ -136,6 +136,6 @@
     DEH_ThingStart,
     DEH_ThingParseLine,
     NULL,
-    DEH_ThingMD5Sum,
+    DEH_ThingSHA1Sum,
 };
 
--- a/src/strife/deh_weapon.c
+++ b/src/strife/deh_weapon.c
@@ -89,13 +89,13 @@
     DEH_SetMapping(context, &weapon_mapping, weapon, variable_name, ivalue);
 }
 
-static void DEH_WeaponMD5Sum(md5_context_t *context)
+static void DEH_WeaponSHA1Sum(sha1_context_t *context)
 {
     int i;
 
     for (i=0; i<NUMWEAPONS ;++i)
     {
-        DEH_StructMD5Sum(context, &weapon_mapping, &weaponinfo[i]);
+        DEH_StructSHA1Sum(context, &weapon_mapping, &weaponinfo[i]);
     }
 }
 
@@ -106,6 +106,6 @@
     DEH_WeaponStart,
     DEH_WeaponParseLine,
     NULL,
-    DEH_WeaponMD5Sum,
+    DEH_WeaponSHA1Sum,
 };
 
--- a/src/w_checksum.c
+++ b/src/w_checksum.c
@@ -27,7 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "md5.h"
+#include "sha1.h"
 #include "w_checksum.h"
 #include "w_wad.h"
 
@@ -60,35 +60,35 @@
     return result;
 }
 
-static void ChecksumAddLump(md5_context_t *md5_context, lumpinfo_t *lump)
+static void ChecksumAddLump(sha1_context_t *sha1_context, lumpinfo_t *lump)
 {
     char buf[9];
 
     strncpy(buf, lump->name, 8);
     buf[8] = '\0';
-    MD5_UpdateString(md5_context, buf);
-    MD5_UpdateInt32(md5_context, GetFileNumber(lump->wad_file));
-    MD5_UpdateInt32(md5_context, lump->position);
-    MD5_UpdateInt32(md5_context, lump->size);
+    SHA1_UpdateString(sha1_context, buf);
+    SHA1_UpdateInt32(sha1_context, GetFileNumber(lump->wad_file));
+    SHA1_UpdateInt32(sha1_context, lump->position);
+    SHA1_UpdateInt32(sha1_context, lump->size);
 }
 
-void W_Checksum(md5_digest_t digest)
+void W_Checksum(sha1_digest_t digest)
 {
-    md5_context_t md5_context;
+    sha1_context_t sha1_context;
     unsigned int i;
 
-    MD5_Init(&md5_context);
+    SHA1_Init(&sha1_context);
 
     num_open_wadfiles = 0;
 
     // Go through each entry in the WAD directory, adding information
-    // about each entry to the MD5 hash.
+    // about each entry to the SHA1 hash.
 
     for (i=0; i<numlumps; ++i)
     {
-        ChecksumAddLump(&md5_context, &lumpinfo[i]);
+        ChecksumAddLump(&sha1_context, &lumpinfo[i]);
     }
     
-    MD5_Final(digest, &md5_context);
+    SHA1_Final(digest, &sha1_context);
 }
 
--- a/src/w_checksum.h
+++ b/src/w_checksum.h
@@ -28,7 +28,7 @@
 
 #include "doomtype.h"
 
-extern void W_Checksum(md5_digest_t digest);
+extern void W_Checksum(sha1_digest_t digest);
 
 #endif /* #ifndef W_CHECKSUM_H */
 
--- a/textscreen/Makefile.am
+++ b/textscreen/Makefile.am
@@ -30,6 +30,7 @@
 	                         txt_smallfont.h          \
 	txt_strut.c              txt_strut.h              \
 	txt_table.c              txt_table.h              \
+	txt_utf8.c               txt_utf8.h               \
 	txt_widget.c             txt_widget.h             \
 	txt_window.c             txt_window.h             \
 	txt_window_action.c      txt_window_action.h      \
--- a/textscreen/examples/guitest.c
+++ b/textscreen/examples/guitest.c
@@ -179,6 +179,10 @@
                    NULL);
 
     TXT_AddWidget(unselectable_table, TXT_NewLabel("* Unselectable table *"));
+    TXT_AddWidget(unselectable_table, TXT_NewLabel(
+        "This is a UTF-8 string:\n"
+        "\xc3\x80 bient\xc3\xb4t na\xc3\xaet "
+        "\xc3\xa9v\xc3\xaaque \xc3\xa0 l'\xc5\x93uvre p\xc3\xa8re."));
 
     TXT_AddWidget(window, TXT_NewSeparator("Input boxes"));
     table = TXT_NewTable(2);
--- a/textscreen/txt_button.c
+++ b/textscreen/txt_button.c
@@ -46,8 +46,6 @@
 
     w = button->widget.w;
 
-    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
-
     TXT_SetWidgetBG(button);
 
     TXT_DrawString(button->label);
--- a/textscreen/txt_checkbox.c
+++ b/textscreen/txt_checkbox.c
@@ -43,12 +43,13 @@
 static void TXT_CheckBoxDrawer(TXT_UNCAST_ARG(checkbox))
 {
     TXT_CAST_ARG(txt_checkbox_t, checkbox);
+    txt_saved_colors_t colors;
     int i;
     int w;
 
     w = checkbox->widget.w;
 
-    TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
+    TXT_SaveColors(&colors);
     TXT_FGColor(TXT_COLOR_BRIGHT_CYAN);
     TXT_DrawString("(");
 
@@ -67,11 +68,10 @@
 
     TXT_DrawString(") ");
 
+    TXT_RestoreColors(&colors);
     TXT_SetWidgetBG(checkbox);
-    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
-
     TXT_DrawString(checkbox->label);
-    
+
     for (i=strlen(checkbox->label); i < w-5; ++i)
     {
         TXT_DrawString(" ");
--- a/textscreen/txt_dropdown.c
+++ b/textscreen/txt_dropdown.c
@@ -230,7 +230,6 @@
     // Set bg/fg text colors.
 
     TXT_SetWidgetBG(list);
-    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
 
     // Select a string to draw from the list, if the current value is
     // in range.  Otherwise fall back to a default.
--- a/textscreen/txt_gui.c
+++ b/textscreen/txt_gui.c
@@ -25,9 +25,55 @@
 #include "txt_gui.h"
 #include "txt_io.h"
 #include "txt_main.h"
+#include "txt_utf8.h"
 
 typedef struct txt_cliparea_s txt_cliparea_t;
 
+// Mapping table that converts from the Extended ASCII codes in the
+// CP437 codepage to Unicode character numbers.
+
+static const uint16_t cp437_unicode[] = {
+    0x00c7, 0x00fc, 0x00e9, 0x00e2,         // 80-8f
+    0x00e4, 0x00e0, 0x00e5, 0x00e7,
+    0x00ea, 0x00eb, 0x00e8, 0x00ef,
+    0x00ee, 0x00ec, 0x00c4, 0x00c5,
+
+    0x00c9, 0x00e6, 0x00c6, 0x00f4,         // 90-9f
+    0x00f6, 0x00f2, 0x00fb, 0x00f9,
+    0x00ff, 0x00d6, 0x00dc, 0x00a2,
+    0x00a3, 0x00a5, 0x20a7, 0x0192,
+
+    0x00e1, 0x00ed, 0x00f3, 0x00fa,         // a0-af
+    0x00f1, 0x00d1, 0x00aa, 0x00ba,
+    0x00bf, 0x2310, 0x00ac, 0x00bd,
+    0x00bc, 0x00a1, 0x00ab, 0x00bb,
+
+    0x2591, 0x2592, 0x2593, 0x2502,         // b0-bf
+    0x2524, 0x2561, 0x2562, 0x2556,
+    0x2555, 0x2563, 0x2551, 0x2557,
+    0x255D, 0x255C, 0x255B, 0x2510,
+
+    0x2514, 0x2534, 0x252C, 0x251C,         // c0-cf
+    0x2500, 0x253C, 0x255E, 0x255F,
+    0x255A, 0x2554, 0x2569, 0x2566,
+    0x2560, 0x2550, 0x256C, 0x2567,
+
+    0x2568, 0x2564, 0x2565, 0x2559,         // d0-df
+    0x2558, 0x2552, 0x2553, 0x256B,
+    0x256A, 0x2518, 0x250C, 0x2588,
+    0x2584, 0x258C, 0x2590, 0x2580,
+
+    0x03B1, 0x00DF, 0x0393, 0x03C0,         // e0-ef
+    0x03A3, 0x03C3, 0x00B5, 0x03C4,
+    0x03A6, 0x0398, 0x03A9, 0x03B4,
+    0x221E, 0x03C6, 0x03B5, 0x2229,
+
+    0x2261, 0x00B1, 0x2265, 0x2264,         // f0-ff
+    0x2320, 0x2321, 0x00F7, 0x2248,
+    0x00B0, 0x2219, 0x00B7, 0x221A,
+    0x207F, 0x00B2, 0x25A0, 0x00A0,
+};
+
 struct txt_cliparea_s
 {
     int x1, x2;
@@ -127,11 +173,12 @@
 
 void TXT_DrawWindowFrame(const char *title, int x, int y, int w, int h)
 {
+    txt_saved_colors_t colors;
     int x1, y1;
     int bx, by;
 
+    TXT_SaveColors(&colors);
     TXT_FGColor(TXT_COLOR_BRIGHT_CYAN);
-    TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
 
     for (y1=y; y1<y+h; ++y1)
     {
@@ -180,10 +227,13 @@
 
     TXT_DrawShadow(x + 2, y + h, w, 1);
     TXT_DrawShadow(x + w, y + 1, 2, h);
+
+    TXT_RestoreColors(&colors);
 }
 
 void TXT_DrawSeparator(int x, int y, int w)
 {
+    txt_saved_colors_t colors;
     unsigned char *data;
     int x1;
     int b;
@@ -190,8 +240,8 @@
 
     data = TXT_GetScreenData();
 
+    TXT_SaveColors(&colors);
     TXT_FGColor(TXT_COLOR_BRIGHT_CYAN);
-    TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
 
     if (!VALID_Y(y))
     {
@@ -222,6 +272,8 @@
 
         data += 2;
     }
+
+    TXT_RestoreColors(&colors);
 }
 
 void TXT_DrawString(const char *s)
@@ -251,8 +303,70 @@
     TXT_GotoXY(x + strlen(s), y);
 }
 
+static void PutUnicodeChar(unsigned int c)
+{
+    unsigned int i;
+
+    if (c < 128)
+    {
+        TXT_PutChar(c);
+        return;
+    }
+
+    // We can only display this character if it is in the CP437 codepage.
+
+    for (i = 0; i < 128; ++i)
+    {
+        if (cp437_unicode[i] == c)
+        {
+            TXT_PutChar(128 + i);
+            return;
+        }
+    }
+
+    // Otherwise, print a fallback character (inverted question mark):
+
+    TXT_PutChar('\xa8');
+}
+
+void TXT_DrawUTF8String(const char *s)
+{
+    int x, y;
+    int x1;
+    const char *p;
+    unsigned int c;
+
+    TXT_GetXY(&x, &y);
+
+    if (VALID_Y(y))
+    {
+        x1 = x;
+
+        for (p = s; *p != '\0'; )
+        {
+            c = TXT_DecodeUTF8(&p);
+
+            if (c == 0)
+            {
+                break;
+            }
+
+            if (VALID_X(x1))
+            {
+                TXT_GotoXY(x1, y);
+                PutUnicodeChar(c);
+            }
+
+            x1 += 1;
+        }
+    }
+
+    TXT_GotoXY(x + TXT_UTF8_Strlen(s), y);
+}
+
 void TXT_DrawHorizScrollbar(int x, int y, int w, int cursor, int range)
 {
+    txt_saved_colors_t colors;
     int x1;
     int cursor_x;
 
@@ -261,6 +375,7 @@
         return;
     }
 
+    TXT_SaveColors(&colors);
     TXT_FGColor(TXT_COLOR_BLACK);
     TXT_BGColor(TXT_COLOR_GREY, 0);
 
@@ -269,9 +384,9 @@
 
     cursor_x = x + 1;
 
-    if (range > 1)
+    if (range > 0)
     {
-        cursor_x += (cursor * (w - 3)) / (range - 1);
+        cursor_x += (cursor * (w - 3)) / range;
     }
 
     if (cursor_x > x + w - 2)
@@ -295,10 +410,12 @@
     }
 
     TXT_PutChar('\x1a');
+    TXT_RestoreColors(&colors);
 }
 
 void TXT_DrawVertScrollbar(int x, int y, int h, int cursor, int range)
 {
+    txt_saved_colors_t colors;
     int y1;
     int cursor_y;
 
@@ -307,6 +424,7 @@
         return;
     }
 
+    TXT_SaveColors(&colors);
     TXT_FGColor(TXT_COLOR_BLACK);
     TXT_BGColor(TXT_COLOR_GREY, 0);
 
@@ -320,9 +438,9 @@
         cursor_y = y + h - 2;
     }
 
-    if (range > 1)
+    if (range > 0)
     {
-        cursor_y += (cursor * (h - 3)) / (range - 1);
+        cursor_y += (cursor * (h - 3)) / range;
     }
 
     for (y1=y+1; y1<y+h-1; ++y1)
@@ -344,6 +462,7 @@
 
     TXT_GotoXY(x, y + h - 1);
     TXT_PutChar('\x19');
+    TXT_RestoreColors(&colors);
 }
 
 void TXT_InitClipArea(void)
--- a/textscreen/txt_gui.h
+++ b/textscreen/txt_gui.h
@@ -27,17 +27,18 @@
 #ifndef TXT_GUI_H
 #define TXT_GUI_H
 
-#define TXT_WINDOW_BACKGROUND TXT_COLOR_BLUE
-#define TXT_HOVER_BACKGROUND  TXT_COLOR_CYAN
+#define TXT_INACTIVE_WINDOW_BACKGROUND   TXT_COLOR_BLACK
+#define TXT_ACTIVE_WINDOW_BACKGROUND     TXT_COLOR_BLUE
+#define TXT_HOVER_BACKGROUND             TXT_COLOR_CYAN
 
 void TXT_DrawDesktopBackground(const char *title);
 void TXT_DrawWindowFrame(const char *title, int x, int y, int w, int h);
 void TXT_DrawSeparator(int x, int y, int w);
 void TXT_DrawString(const char *s);
+void TXT_DrawUTF8String(const char *s);
 
 void TXT_DrawHorizScrollbar(int x, int y, int w, int cursor, int range);
 void TXT_DrawVertScrollbar(int x, int y, int h, int cursor, int range);
-
 
 void TXT_InitClipArea(void);
 void TXT_PushClipArea(int x1, int x2, int y1, int y2);
--- a/textscreen/txt_inputbox.c
+++ b/textscreen/txt_inputbox.c
@@ -30,6 +30,7 @@
 #include "txt_gui.h"
 #include "txt_io.h"
 #include "txt_main.h"
+#include "txt_utf8.h"
 #include "txt_window.h"
 
 extern txt_widget_class_t txt_inputbox_class;
@@ -131,8 +132,6 @@
         TXT_SetWidgetBG(inputbox);
     }
 
-    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
-
     if (!inputbox->editing)
     {
         // If not editing, use the current value from inputbox->value.
@@ -140,9 +139,9 @@
         SetBufferFromValue(inputbox);
     }
 
-    TXT_DrawString(inputbox->buffer);
+    TXT_DrawUTF8String(inputbox->buffer);
 
-    chars = strlen(inputbox->buffer);
+    chars = TXT_UTF8_Strlen(inputbox->buffer);
 
     if (chars < w && inputbox->editing && focused)
     {
@@ -166,20 +165,29 @@
 
 static void Backspace(txt_inputbox_t *inputbox)
 {
-    if (strlen(inputbox->buffer) > 0)
+    unsigned int len;
+    char *p;
+
+    len = TXT_UTF8_Strlen(inputbox->buffer);
+
+    if (len > 0)
     {
-        inputbox->buffer[strlen(inputbox->buffer) - 1] = '\0';
+        p = TXT_UTF8_SkipChars(inputbox->buffer, len - 1);
+        *p = '\0';
     }
 }
 
 static void AddCharacter(txt_inputbox_t *inputbox, int key)
 {
-    if (strlen(inputbox->buffer) < inputbox->size)
+    char *end, *p;
+
+    if (TXT_UTF8_Strlen(inputbox->buffer) < inputbox->size)
     {
         // Add character to the buffer
 
-        inputbox->buffer[strlen(inputbox->buffer) + 1] = '\0';
-        inputbox->buffer[strlen(inputbox->buffer)] = key;
+        end = inputbox->buffer + strlen(inputbox->buffer);
+        p = TXT_EncodeUTF8(end, key);
+        *p = '\0';
     }
 }
 
@@ -186,6 +194,7 @@
 static int TXT_InputBoxKeyPress(TXT_UNCAST_ARG(inputbox), int key)
 {
     TXT_CAST_ARG(txt_inputbox_t, inputbox);
+    unsigned int c;
 
     if (!inputbox->editing)
     {
@@ -208,16 +217,18 @@
         inputbox->editing = 0;
     }
 
-    if (isprint(key))
+    if (key == KEY_BACKSPACE)
     {
-        // Add character to the buffer
-
-        AddCharacter(inputbox, key);
+        Backspace(inputbox);
     }
 
-    if (key == KEY_BACKSPACE)
+    c = TXT_KEY_TO_UNICODE(key);
+
+    if (c >= 128 || isprint(c))
     {
-        Backspace(inputbox);
+        // Add character to the buffer
+
+        AddCharacter(inputbox, c);
     }
 
     return 1;
@@ -277,32 +288,32 @@
     TXT_InputBoxFocused,
 };
 
-txt_inputbox_t *TXT_NewInputBox(char **value, int size)
+static txt_inputbox_t *NewInputBox(txt_widget_class_t *widget_class,
+                                   void *value, int size)
 {
     txt_inputbox_t *inputbox;
 
     inputbox = malloc(sizeof(txt_inputbox_t));
 
-    TXT_InitWidget(inputbox, &txt_inputbox_class);
+    TXT_InitWidget(inputbox, widget_class);
     inputbox->value = value;
     inputbox->size = size;
-    inputbox->buffer = malloc(size + 1);
+    // 'size' is the maximum number of characters that can be entered,
+    // but for a UTF-8 string, each character can take up to four
+    // characters.
+    inputbox->buffer = malloc(size * 4 + 1);
     inputbox->editing = 0;
 
     return inputbox;
 }
 
-txt_inputbox_t *TXT_NewIntInputBox(int *value, int size)
+txt_inputbox_t *TXT_NewInputBox(char **value, int size)
 {
-    txt_inputbox_t *inputbox;
+    return NewInputBox(&txt_inputbox_class, value, size);
+}
 
-    inputbox = malloc(sizeof(txt_inputbox_t));
-
-    TXT_InitWidget(inputbox, &txt_int_inputbox_class);
-    inputbox->value = value;
-    inputbox->size = size;
-    inputbox->buffer = malloc(15);
-    inputbox->editing = 0;
-    return inputbox;
+txt_inputbox_t *TXT_NewIntInputBox(int *value, int size)
+{
+    return NewInputBox(&txt_int_inputbox_class, value, size);
 }
 
--- a/textscreen/txt_io.c
+++ b/textscreen/txt_io.c
@@ -30,48 +30,10 @@
 #include "txt_io.h"
 #include "txt_main.h"
 
-static struct 
-{
-    txt_color_t color;
-    const char *name;
-} colors[] = {
-    {TXT_COLOR_BLACK,           "black"},
-    {TXT_COLOR_BLUE,            "blue"},
-    {TXT_COLOR_GREEN,           "green"},
-    {TXT_COLOR_CYAN,            "cyan"},
-    {TXT_COLOR_RED,             "red"},
-    {TXT_COLOR_MAGENTA,         "magenta"},
-    {TXT_COLOR_BROWN,           "brown"},
-    {TXT_COLOR_GREY,            "grey"},
-    {TXT_COLOR_DARK_GREY,       "darkgrey"},
-    {TXT_COLOR_BRIGHT_BLUE,     "brightblue"},
-    {TXT_COLOR_BRIGHT_GREEN,    "brightgreen"},
-    {TXT_COLOR_BRIGHT_CYAN,     "brightcyan"},
-    {TXT_COLOR_BRIGHT_RED,      "brightred"},
-    {TXT_COLOR_BRIGHT_MAGENTA,  "brightmagenta"},
-    {TXT_COLOR_YELLOW,          "yellow"},
-    {TXT_COLOR_BRIGHT_WHITE,    "brightwhite"},
-};
-
 static int cur_x = 0, cur_y = 0;
 static txt_color_t fgcolor = TXT_COLOR_GREY;
 static txt_color_t bgcolor = TXT_COLOR_BLACK;
 
-static int GetColorForName(char *s)
-{
-    size_t i;
-
-    for (i=0; i<sizeof(colors) / sizeof(*colors); ++i)
-    {
-        if (!strcmp(s, colors[i].name))
-        {
-            return colors[i].color;
-        }
-    }
-
-    return -1;
-}
-
 static void NewLine(unsigned char *screendata)
 {
     int i;
@@ -104,7 +66,7 @@
 static void PutChar(unsigned char *screendata, int c)
 {
     unsigned char *p;
-   
+
     p = screendata + cur_y * TXT_SCREEN_W * 2 +  cur_x * 2;
 
     switch (c)
@@ -149,68 +111,16 @@
 
 void TXT_Puts(const char *s)
 {
-    int previous_color = TXT_COLOR_BLACK;
     unsigned char *screen;
     const char *p;
-    char colorname_buf[20];
-    char *ending;
-    int col;
 
     screen = TXT_GetScreenData();
 
     for (p=s; *p != '\0'; ++p)
     {
-        if (*p == '<')
-        {
-            ++p;
-
-            if (*p == '<')
-            {
-                PutChar(screen, '<');
-            }
-            else
-            {
-                ending = strchr(p, '>');
-
-                if (ending == NULL)
-                {
-                    return;
-                }
-
-                strncpy(colorname_buf, p, 19);
-                colorname_buf[ending-p] = '\0';
-
-                if (!strcmp(colorname_buf, "/"))
-                {
-                    // End of color block
-
-                    col = previous_color;
-                }
-                else
-                {
-                    col = GetColorForName(colorname_buf);
-
-                    if (col < 0)
-                    {
-                        return;
-                    }
+        PutChar(screen, *p);
+    }
 
-                    // Save the color for the ending marker
-
-                    previous_color = fgcolor;
-                }
-
-                TXT_FGColor(col);
-                
-                p = ending;
-            }
-        }
-        else
-        {
-            PutChar(screen, *p);
-        }
-    }
-
     PutChar(screen, '\n');
 }
 
@@ -236,6 +146,18 @@
     bgcolor = color;
     if (blinking)
         bgcolor |= TXT_COLOR_BLINKING;
+}
+
+void TXT_SaveColors(txt_saved_colors_t *save)
+{
+    save->bgcolor = bgcolor;
+    save->fgcolor = fgcolor;
+}
+
+void TXT_RestoreColors(txt_saved_colors_t *save)
+{
+    bgcolor = save->bgcolor;
+    fgcolor = save->fgcolor;
 }
 
 void TXT_ClearScreen(void)
--- a/textscreen/txt_io.h
+++ b/textscreen/txt_io.h
@@ -29,6 +29,12 @@
 
 #include "txt_main.h"
 
+typedef struct
+{
+    int bgcolor;
+    int fgcolor;
+} txt_saved_colors_t;
+
 void TXT_PutChar(int c);
 void TXT_Puts(const char *s);
 void TXT_GotoXY(int x, int y);
@@ -35,6 +41,8 @@
 void TXT_GetXY(int *x, int *y);
 void TXT_FGColor(txt_color_t color);
 void TXT_BGColor(int color, int blinking);
+void TXT_SaveColors(txt_saved_colors_t *save);
+void TXT_RestoreColors(txt_saved_colors_t *save);
 void TXT_ClearScreen(void);
 
 #endif /* #ifndef TXT_IO_H */
--- a/textscreen/txt_label.c
+++ b/textscreen/txt_label.c
@@ -26,6 +26,7 @@
 #include "txt_gui.h"
 #include "txt_io.h"
 #include "txt_main.h"
+#include "txt_utf8.h"
 #include "txt_window.h"
 
 static void TXT_LabelSizeCalc(TXT_UNCAST_ARG(label))
@@ -46,8 +47,14 @@
 
     w = label->widget.w;
 
-    TXT_BGColor(label->bgcolor, 0);
-    TXT_FGColor(label->fgcolor);
+    if (label->bgcolor >= 0)
+    {
+        TXT_BGColor(label->bgcolor, 0);
+    }
+    if (label->fgcolor >= 0)
+    {
+        TXT_FGColor(label->fgcolor);
+    }
 
     TXT_GetXY(&origin_x, &origin_y);
 
@@ -68,7 +75,7 @@
                 align_indent = label->w - strlen(label->lines[y]);
                 break;
         }
-        
+
         // Draw this line
 
         TXT_GotoXY(origin_x, origin_y + y);
@@ -82,8 +89,8 @@
 
         // The string itself
 
-        TXT_DrawString(label->lines[y]);
-        x += strlen(label->lines[y]);
+        TXT_DrawUTF8String(label->lines[y]);
+        x += TXT_UTF8_Strlen(label->lines[y]);
 
         // Gap at the end
 
@@ -123,7 +130,7 @@
     free(label->label);
     free(label->lines);
 
-    // Set the new value 
+    // Set the new value
 
     label->label = strdup(value);
 
@@ -144,7 +151,7 @@
     label->lines = malloc(sizeof(char *) * label->h);
     label->lines[0] = label->label;
     y = 1;
-    
+
     for (p = label->label; *p != '\0'; ++p)
     {
         if (*p == '\n')
@@ -159,8 +166,12 @@
 
     for (y=0; y<label->h; ++y)
     {
-        if (strlen(label->lines[y]) > label->w)
-            label->w = strlen(label->lines[y]);
+        unsigned int line_len;
+
+        line_len = TXT_UTF8_Strlen(label->lines[y]);
+
+        if (line_len > label->w)
+            label->w = line_len;
     }
 }
 
@@ -176,8 +187,8 @@
 
     // Default colors
 
-    label->bgcolor = TXT_WINDOW_BACKGROUND;
-    label->fgcolor = TXT_COLOR_BRIGHT_WHITE;
+    label->bgcolor = -1;
+    label->fgcolor = -1;
 
     TXT_SetLabel(label, text);
 
--- a/textscreen/txt_label.h
+++ b/textscreen/txt_label.h
@@ -45,8 +45,8 @@
     char *label;
     char **lines;
     unsigned int w, h;
-    txt_color_t fgcolor;
-    txt_color_t bgcolor;
+    int fgcolor;
+    int bgcolor;
 };
 
 /**
--- a/textscreen/txt_main.h
+++ b/textscreen/txt_main.h
@@ -32,9 +32,21 @@
 
 #include "txt_sdl.h"
 
+// textscreen key values:
+// Key values are difficult because we have to support multiple conflicting
+// address spaces.
+// First, Doom's key constants use 0-127 as ASCII and extra values from
+// 128-255 to represent special keys. Second, mouse buttons are represented
+// as buttons. Finally, we want to be able to support Unicode.
+//
+// So we define different ranges:
+// 0-255:    Doom key constants, including ASCII.
+// 256-511:  Mouse buttons and other reserved.
+// >=512:    Unicode values greater than 127 are offset up into this range.
+
 // Special keypress values that correspond to mouse button clicks
 
-#define TXT_MOUSE_BASE         0x10000
+#define TXT_MOUSE_BASE         256
 #define TXT_MOUSE_LEFT         (TXT_MOUSE_BASE + 0)
 #define TXT_MOUSE_RIGHT        (TXT_MOUSE_BASE + 1)
 #define TXT_MOUSE_MIDDLE       (TXT_MOUSE_BASE + 2)
@@ -41,6 +53,22 @@
 #define TXT_MOUSE_SCROLLUP     (TXT_MOUSE_BASE + 3)
 #define TXT_MOUSE_SCROLLDOWN   (TXT_MOUSE_BASE + 4)
 #define TXT_MAX_MOUSE_BUTTONS  16
+
+#define TXT_KEY_TO_MOUSE_BUTTON(x)                                        \
+        ( (x) >= TXT_MOUSE_BASE                                           \
+       && (x) < TXT_MOUSE_BASE + TXT_MAX_MOUSE_BUTTONS ?                  \
+          (x) - TXT_MOUSE_BASE : -1 )
+
+// Unicode offset. Unicode values from 128 onwards are offset up into
+// this range, so TXT_UNICODE_BASE = Unicode character #128, and so on.
+
+#define TXT_UNICODE_BASE       512
+
+// Convert a key value to a Unicode character:
+
+#define TXT_KEY_TO_UNICODE(x)                                             \
+        ( (x) < 128 ? (x) :                                               \
+          (x) >= TXT_UNICODE_BASE ? ((x) - TXT_UNICODE_BASE + 128) : 0 )
 
 // Screen size
 
--- a/textscreen/txt_radiobutton.c
+++ b/textscreen/txt_radiobutton.c
@@ -43,12 +43,13 @@
 static void TXT_RadioButtonDrawer(TXT_UNCAST_ARG(radiobutton))
 {
     TXT_CAST_ARG(txt_radiobutton_t, radiobutton);
+    txt_saved_colors_t colors;
     int i;
     int w;
 
     w = radiobutton->widget.w;
 
-    TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
+    TXT_SaveColors(&colors);
     TXT_FGColor(TXT_COLOR_BRIGHT_CYAN);
     TXT_DrawString("(");
 
@@ -67,11 +68,11 @@
 
     TXT_DrawString(") ");
 
+    TXT_RestoreColors(&colors);
     TXT_SetWidgetBG(radiobutton);
-    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
 
     TXT_DrawString(radiobutton->label);
-    
+
     for (i=strlen(radiobutton->label); i < w-5; ++i)
     {
         TXT_DrawString(" ");
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -436,7 +436,17 @@
 
     if (key_mapping)
     {
-        return sym->unicode;
+        // Unicode characters beyond the ASCII range need to be
+        // mapped up into textscreen's Unicode range.
+
+        if (sym->unicode < 128)
+        {
+            return sym->unicode;
+        }
+        else
+        {
+            return sym->unicode - 128 + TXT_UNICODE_BASE;
+        }
     }
     else
     {
--- a/textscreen/txt_separator.c
+++ b/textscreen/txt_separator.c
@@ -65,7 +65,6 @@
     {
         TXT_GotoXY(x, y);
 
-        TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
         TXT_FGColor(TXT_COLOR_BRIGHT_GREEN);
         TXT_DrawString(" ");
         TXT_DrawString(separator->label);
--- a/textscreen/txt_spinctrl.c
+++ b/textscreen/txt_spinctrl.c
@@ -147,17 +147,18 @@
     TXT_CAST_ARG(txt_spincontrol_t, spincontrol);
     unsigned int i;
     unsigned int padding;
+    txt_saved_colors_t colors;
     int focused;
 
     focused = spincontrol->widget.focused;
 
-    TXT_FGColor(TXT_COLOR_BRIGHT_CYAN);
-    TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
+    TXT_SaveColors(&colors);
 
+    TXT_FGColor(TXT_COLOR_BRIGHT_CYAN);
     TXT_DrawString("\x1b ");
-    
-    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
 
+    TXT_RestoreColors(&colors);
+
     // Choose background color
 
     if (focused && spincontrol->editing)
@@ -173,7 +174,7 @@
     {
         SetBuffer(spincontrol);
     }
-    
+
     i = 0;
 
     padding = spincontrol->widget.w - strlen(spincontrol->buffer) - 4;
@@ -193,8 +194,8 @@
         ++i;
     }
 
+    TXT_RestoreColors(&colors);
     TXT_FGColor(TXT_COLOR_BRIGHT_CYAN);
-    TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
     TXT_DrawString(" \x1a");
 }
 
--- /dev/null
+++ b/textscreen/txt_utf8.c
@@ -1,0 +1,160 @@
+// Emacs style mode select   -*- C++ -*- 
+//-----------------------------------------------------------------------------
+//
+// Copyright(C) 2012 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "txt_utf8.h"
+
+// Encode a Unicode character as UTF-8, storing it in the buffer 'p'
+// and returning the new, incremented position.
+
+char *TXT_EncodeUTF8(char *p, unsigned int c)
+{
+    if (c < 0x80)                             // 1 character (ASCII):
+    {
+        p[0] = c;
+        return p + 1;
+    }
+    else if (c < 0x800)                       // 2 character:
+    {
+        p[0] = 0xc0 | (c >> 6);
+        p[1] = 0x80 | (c & 0x3f);
+        return p + 2;
+    }
+    else if (c < 0x10000)                     // 3 chacater:
+    {
+        p[0] = 0xe0 | (c >> 12);
+        p[1] = 0x80 | ((c >> 6) & 0x3f);
+        p[2] = 0x80 | (c & 0x3f);
+        return p + 3;
+    }
+    else if (c < 0x200000)                    // 4 character:
+    {
+        p[0] = 0xf0 | (c >> 18);
+        p[1] = 0x80 | ((c >> 12) & 0x3f);
+        p[2] = 0x80 | ((c >> 6) & 0x3f);
+        p[3] = 0x80 | (c & 0x3f);
+        return p + 4;
+    }
+    else
+    {
+        // Too big!
+
+        return p;
+    }
+}
+
+// Decode UTF-8 character, incrementing *ptr over the decoded bytes.
+
+unsigned int TXT_DecodeUTF8(const char **ptr)
+{
+    const char *p = *ptr;
+    unsigned int c;
+
+    // UTF-8 decode.
+
+    if ((*p & 0x80) == 0)                     // 1 character (ASCII):
+    {
+        c = *p;
+        *ptr += 1;
+    }
+    else if ((p[0] & 0xe0) == 0xc0            // 2 character:
+          && (p[1] & 0xc0) == 0x80)
+    {
+        c = ((p[0] & 0x1f) << 6)
+          |  (p[1] & 0x3f);
+        *ptr += 2;
+    }
+    else if ((p[0] & 0xf0) == 0xe0            // 3 character:
+          && (p[1] & 0xc0) == 0x80
+          && (p[2] & 0xc0) == 0x80)
+    {
+        c = ((p[0] & 0x0f) << 12)
+          | ((p[1] & 0x3f) << 6)
+          |  (p[2] & 0x3f);
+        *ptr += 3;
+    }
+    else if ((p[0] & 0xf8) == 0xf0            // 4 character:
+          && (p[1] & 0xc0) == 0x80
+          && (p[2] & 0xc0) == 0x80
+          && (p[3] & 0xc0) == 0x80)
+    {
+        c = ((p[0] & 0x07) << 18)
+          | ((p[1] & 0x3f) << 12)
+          | ((p[2] & 0x3f) << 6)
+          |  (p[3] & 0x3f);
+        *ptr += 4;
+    }
+    else
+    {
+        // Decode failure.
+        // Don't bother with 5/6 byte sequences.
+
+        c = 0;
+    }
+
+    return c;
+}
+
+// Count the number of characters in a UTF-8 string.
+
+unsigned int TXT_UTF8_Strlen(const char *s)
+{
+    const char *p;
+    unsigned int result = 0;
+    unsigned int c;
+
+    for (p = s; *p != '\0';)
+    {
+        c = TXT_DecodeUTF8(&p);
+
+        if (c == 0)
+        {
+            break;
+        }
+
+        ++result;
+    }
+
+    return result;
+}
+
+// Skip past the first n characters in a UTF-8 string.
+
+char *TXT_UTF8_SkipChars(const char *s, unsigned int n)
+{
+    unsigned int i;
+    const char *p;
+
+    p = s;
+
+    for (i = 0; i < n; ++i)
+    {
+        if (TXT_DecodeUTF8(&p) == 0)
+        {
+            break;
+        }
+    }
+
+    return (char *) p;
+}
+
--- /dev/null
+++ b/textscreen/txt_utf8.h
@@ -1,0 +1,31 @@
+// Emacs style mode select   -*- C++ -*- 
+//-----------------------------------------------------------------------------
+//
+// Copyright(C) 2012 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+
+#ifndef TXT_UTF8_H
+#define TXT_UTF8_H
+
+char *TXT_EncodeUTF8(char *p, unsigned int c);
+unsigned int TXT_DecodeUTF8(const char **ptr);
+unsigned int TXT_UTF8_Strlen(const char *s);
+char *TXT_UTF8_SkipChars(const char *s, unsigned int n);
+
+#endif /* #ifndef TXT_UTF8_H */
+
--- a/textscreen/txt_widget.c
+++ b/textscreen/txt_widget.c
@@ -162,14 +162,22 @@
 void TXT_DrawWidget(TXT_UNCAST_ARG(widget))
 {
     TXT_CAST_ARG(txt_widget_t, widget);
+    txt_saved_colors_t colors;
 
+    // The drawing function might change the fg/bg colors,
+    // so make sure we restore them after it's done.
+
+    TXT_SaveColors(&colors);
+
     // For convenience...
 
     TXT_GotoXY(widget->x, widget->y);
 
     // Call drawer method
- 
+
     widget->widget_class->drawer(widget);
+
+    TXT_RestoreColors(&colors);
 }
 
 void TXT_DestroyWidget(TXT_UNCAST_ARG(widget))
@@ -319,7 +327,7 @@
     }
     else
     {
-        TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
+        // Use normal window background.
     }
 }
 
--- a/textscreen/txt_window.c
+++ b/textscreen/txt_window.c
@@ -28,6 +28,7 @@
 #include "txt_label.h"
 #include "txt_desktop.h"
 #include "txt_gui.h"
+#include "txt_io.h"
 #include "txt_main.h"
 #include "txt_separator.h"
 #include "txt_window.h"
@@ -321,7 +322,18 @@
     txt_widget_t *widgets;
 
     TXT_LayoutWindow(window);
-    
+
+    if (window->table.widget.focused)
+    {
+        TXT_BGColor(TXT_ACTIVE_WINDOW_BACKGROUND, 0);
+    }
+    else
+    {
+        TXT_BGColor(TXT_INACTIVE_WINDOW_BACKGROUND, 0);
+    }
+
+    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
+
     // Draw the window
 
     TXT_DrawWindowFrame(window->title, 
--- a/textscreen/txt_window_action.c
+++ b/textscreen/txt_window_action.c
@@ -55,10 +55,6 @@
     {
         TXT_BGColor(TXT_COLOR_BLACK, 0);
     }
-    else
-    {
-        TXT_BGColor(TXT_WINDOW_BACKGROUND, 0);
-    }
 
     TXT_DrawString(" ");
     TXT_FGColor(TXT_COLOR_BRIGHT_GREEN);