summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-04-01Replace all snprintf() calls with M_snprintf().Simon Howard
The Windows API has an _snprintf function that is not the same as Unix's snprintf(): if the string is truncated then no trailing NUL character is appended. This makes the function unsafe. Define a replacement/wrapper called M_snprintf that works the same but always appends a trailing NUL, for safety on Windows and other OSes that behave like this. Do the same thing for vsnprintf(), and update HACKING to list snprintf/vsnprintf as forbidden functions. This fixes #375; thanks to Quasar for pointing out the different behavior of these functions.
2014-03-31strife: Add missing NULL to M_StringJoin call.Simon Howard
2014-03-31Fix typo in src/strife/p_saveg.cFabian Greffrath
2014-03-30sound: Fix compile when using libsamplerate.Simon Howard
The change in commit 62b5c6028.. broke the compile.
2014-03-30strife: Eliminate use of sprintf().Simon Howard
Use snprintf() in place of sprintf(). This is part of fixing #371.
2014-03-30hexen: Eliminate use of sprintf().Simon Howard
Use snprintf() in place of sprintf(). This is part of fixing #371.
2014-03-30heretic: Eliminate use of sprintf().Simon Howard
Use snprintf() in place of sprintf(). This is part of fixing #371.
2014-03-30doom: Eliminate use of sprintf().Simon Howard
Use snprintf() or other functions in place of sprintf(). This is part of fixing #371.
2014-03-30music: Free string using free() rather than Z_Free().Simon Howard
Mistake introduced in previous commit.
2014-03-30Eliminate some uses of sprintf() from common code.Simon Howard
As part of this, add DIR_SEPARATOR_S as a string version of the DIR_SEPARATOR macro. Change M_TempFile() to return a string allocated on the C heap rather than the zone heap. This is a first step towards fixing #371.
2014-03-30dehacked: Eliminate some more uses of strncpy().Simon Howard
Use M_StringCopy() instead of strncpy() in the Dehacked code.
2014-03-30hexen: Make -playdemo cope with paths.Simon Howard
Vanilla Hexen makes you specify the demo name to play by giving the plain lump name, eg. heretic -playdemo mydemo to load mydemo.lmp. It doesn't work if you specify the extension or the full file path. As a convenience and to match the behavior of Chocolate Doom, allow paths and extensions. Also rework the code for other games so that they're slightly more consistent. This fixes #301.
2014-03-30heretic: Make -playdemo cope with paths.Simon Howard
Vanilla Heretic makes you specify the demo name to play by giving the plain lump name, eg. heretic -playdemo mydemo to load mydemo.lmp. It doesn't work if you specify the extension or the full file path. As a convenience and to match the behavior of Chocolate Doom, allow paths and extensions. This fixes half of #301.
2014-03-29HACKING: Add note about unsafe C functions.Simon Howard
Add a section to the HACKING file listing unsafe C library functions that should not be used.
2014-03-29common: Eliminate use of unsafe string functions.Simon Howard
Remove some remaining uses of strncpy() and use M_StringCopy() instead.
2014-03-29setup: Eliminate use of unsafe string functions.Simon Howard
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
2014-03-29strife: Eliminate use of unsafe string functions.Simon Howard
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
2014-03-29misc: Make arguments to string functions const.Simon Howard
Where a pointer is to a buffer that does not need to be mutable for the operation of the function, use const char * instead. This avoids some type errors where constant string are passed.
2014-03-29heretic: Eliminate use of unsafe string functions.Simon Howard
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
2014-03-29heretic: Eliminate use of unsafe string functions.Simon Howard
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
2014-03-29doom: Eliminate use of unsafe string functions.Simon Howard
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
2014-03-29Fix erroneous call to M_StringJoinSimon Howard
2014-03-29misc: Add M_StringConcat.Simon Howard
Just as M_StringCopy behaves the same as strlcpy(), M_StringConcat behaves the same as strlcat(). Use this in one location.
2014-03-29misc: Add string utility functions.Simon Howard
It's more readable to write "M_StringEndsWith(..." than doing a bunch of pointer arithmetic, and this is a common pattern. Also add M_StringStartsWith, M_StringJoin and M_StringCopy. The latter is a safe alternative for strcpy() that works the same as OpenBSD's strlcpy(). Use these functions in a few places where it makes sense.
2014-03-28textscreen: Add label for PrintScreen key.Simon Howard
Needed to properly fix bug #369.
2014-03-28video: Fix calculation of -devparm ticker.Simon Howard
The released linuxdoom source had the devparm ticker dots at a spacing of two pixels rather than four pixels (as used in Vanilla Doom). In commit 4a31ec8fcee20e.. I changed this back to four pixel spacing, but forgot to multiply the number of tics to adjust as appropriate. Fix this so that the dots are calculated just like Vanilla Doom is. Thanks to _bruce_ for pointing this out on Doomworld, and to Alexandre-Xavier for questioning my reasoning when I wasn't convinced that the current behavior was wrong. This fixes #360.
2014-03-27hexen: Allow abort on startup by pressing escape.Simon Howard
Vanilla Hexen allows the game startup to be aborted by pressing the escape key. This can also be used to abort netgame startup. Add back this functionality by polling the SDL event loop; this feature only works if the graphical startup is enabled, but that's good enough.
2014-03-27Fix .rc files so version info shows on Windows 7.Simon Howard
Thanks to Brad Harding for the bug report. This fixes #319.
2014-03-27video: Fix crash when running fullscreen with -2.Simon Howard
Remove special logic for setting a scale factor (2x, 3x, etc.) when running fullscreen instead of windowed. This fixes a crash due to the fact that I_GraphicsCheckCommandLine() is called before SDL's video subsystem is initialized. This makes -2 identical to -geometry 640x480, which is arguably a better (more easily comprehensible) behavior. Thanks to Fabian Greffrath for reporting the bug. This fixes #338.
2014-03-27setup: Make default sound volumes match Vanilla.Simon Howard
Doom, Heretic, Hexen and Strife have different default SFX and music volumes. Make sure the setup tool sets the appropriate default when creating a new configuration file. Thanks to Alexandre-Xavier for reporting this and providing the correct defaults. This fixes #347.
2014-03-27strife: Fix default music volume to match Vanilla.Simon Howard
Strife's default music volume is 13 as opposed to Doom's value of 8. This was apparently not changed during the development of Chocolate Strife. Thanks to Alexandre-Xavier for noticing this and providing the correct value (bug #347).
2014-03-27Define a keyboard scan code for PrintScreen.Simon Howard
There is no real scan code for the PrintScreen key under DOS, but it is convenient to be able to bind it as a screenshot key. Define a "fake" scancode (126) to represent PrintScreen so that it can be represented as a key binding in configuration files. Also add some comments/notes to the scantokey[] lookup table. This fixes #369.
2014-03-26Fix typos in config API usageFabian Greffrath
2014-03-26Add explicit check for libzFabian Greffrath
Fixes static linking and libpng won't link without it anyway.
2014-03-25Set GUS patch path variable using D_SetVariable.Simon Howard
commit 42faefce1fd03 added code to set the GUS patch path automatically when the BFG Edition is installed, but this caused problems because gusconf.c is not included as part of the build for the setup tool. Use D_SetVariable() instead which accomplishes the same thing without a hard dependency.
2014-03-25config: Add API to get/set config variables.Simon Howard
It is useful to be able to set variables through an API provided by the config module; this means that it is possible for one module to set config variables of another in a more loosely-coupled way.
2014-03-24Fix libpng detection for static librariesFabian Greffrath
2014-03-24Fix various Clang compiler warnings.Simon Howard
2014-03-23Autodetect GUS patches installed with BFG Edition.Simon Howard
Doom 3: BFG Edition installs copies of the GUS instrument files (patches) that can be used for the GUS pseudo-emulation. Detect these on startup if no GUS patch path has been configured and configure gus_patch_path config variable automatically. This fixes #333.
2014-03-23Rearrange order of SDL sound startup.Simon Howard
Initialize low-level sound startup (calls to I_InitSound) separately from the high-level sound startup (S_Init). In particular, make sure that SDL sound is initialized before the textscreen multiplayer waiting screen is shown. This is an attempt to fix a bug with sound in multiplayer games on Windows; calling SDL_QuitSubSystem(SDL_INIT_VIDEO) (on closedown of the textscreen library) causes subsequent attempts to initialize audio to fail. Big thanks go to Alexandre-Xavier (AXDOOMER) for working out a fix for this bug and James Haley (Quasar) for giving some technical background about the lack of separation between SDL subsystems. This (hopefully) fixes #270.
2014-03-23Set default for key_menu_screenshot to 0.Simon Howard
In #364 I recommended -1 as the default to avoid taking screenshots in some situations where a key event is posted for key 0. It turns out that wasn't such a great idea, as -1 is not parsed properly by the config parser, and is shown as ??-1 in the setup tool. Default to zero instead, and add guards to prevent screenshots being taken by mistake. Thanks to Alexandre-Xavier for pointing this out.
2014-03-23heretic/hexen: Fix -timedemo.Simon Howard
The -timedemo flag is broken in Vanilla Heretic/Hexen, as not all fields are read from the demo headers. Fix it, as there's no utility in having it nonfunctional and plenty of utility in having it functional. This fixes #300.
2014-03-23doom: Add initial support for versions < v1.9.Simon Howard
Add -gameversion options for v1.666, v1.7, v1.8. Set demo and savegame headers appropriately depending on version. Also add an enum entry for Doom v1.2 but no code support for it yet.
2014-03-23doom: Emulate 'no fog on spawn west' Vanilla bug.Simon Howard
A deathmatch player spawning facing directly west does not see the normal teleport fog (or hear it). This is because of an angle that should be unsigned but is actually signed. Import PrBoom's code to emulate this bug. This fixes #186.
2014-03-23pcsound: Extend frequency table to 128 entries.Simon Howard
Extend from 96 to the full 128 entries found in the frequency table in the Vanilla .exes. This was helpfully posted by Gez to the Doom wiki: http://doomwiki.org/wiki/Talk:PC_speaker_sound_effects Change from the current scheme of storing frequency values to using the timer divisor values used by the Vanilla .exes; divide into the PC timer frequency to calculate the frequencies to play. Thanks to Gez for dumping the full list of frequencies; this fixes #336.
2014-03-23setup: Add missing snd_maxslicetime_ms variable.Simon Howard
Preserve the snd_maxslicetime_ms variable when loading/saving configs in the setup tool.
2014-03-23music: Add config var for external music program.Simon Howard
Mix_SetMusicCMD() allows a program to be specified to configure an external program to be invoked for music playback. Add a config variable (snd_musiccmd) to allow this to be set from a configuration file. Thanks to Holering for his comments on Doomworld about how to do this.
2014-03-23sound: Add config variable to control buffer size.Simon Howard
Add snd_maxslicetime_ms variable to control the size of the output sound buffer, and reduce the default from 70ms to 28ms to match Doom's 35fps timer. Thanks to Holering for reporting this (fixes #345).
2014-03-22heretic/hexen: Fix automap background scrolling.Simon Howard
There was a bug where it was possible to keep moving the background when the boundaries of the map were reached. This is because the code to move the background was done in calls to AM_Drawer(), which is fundamentally a bad idea. Some old commented-out code shows that this was previously done in AM_Drawer (same location that scrolls the map itself), but it was moved. Move it back. Thanks to Chris Fielder for the bug report; this fixes #321.
2014-03-20Merge pull request #365 from fabiangreffrath/bfg_warningSimon Howard
Print a warning if the user is attempting to record or playback a demo o...