summaryrefslogtreecommitdiff
path: root/src/doom/d_main.c
AgeCommit message (Collapse)Author
2015-05-01Perform case-insensitive check for .lmp extension.Simon Howard
When using the -playdemo parameter, we support a convenience feature where the .lmp extension is not appended if it is already part of the filename. This makes tab completion much nicer. But if the .lmp file has a filename that is in all-caps (.LMP) we were still appending the extension because the check was case sensitive. Change the check to be case insensitive. This fixes #501 (thanks Ioan Chera).
2015-03-26Add a wrapper with "void (void)" signature around G_CheckDemoStatusFabian Greffrath
This is meant to be passed over to I_AtExit() which expects an argument of void type. It thus prevents undefined behaviour because of the different signature of G_CheckDemoStatus() which is of boolean type. Fixes #519
2015-02-20Refactor config file API.Simon Howard
The config file API previously relied on binding config variables using M_BindVariable() which took a void pointer. It occurred to me that if used on a boolean variable, this would be erroneous, but the void pointer would make it impossible to tell. Split this into separate M_Bind{Foo}Variable() functions based on type, which allows for proper type checking on the pointers that are passed. Vaguely related to #509.
2014-10-24Replace strdup() with M_StringDuplicate().Simon Howard
strdup() can theoretically fail and return NULL. This could lead to a crash or undesirable behavior. Add M_StringDuplicate() which does the same thing but exits with an error if a string cannot be allocated. This fixes #456. Thanks to Quasar for the suggestion.
2014-10-21Merge branch 'master' of github.com:chocolate-doom/chocolate-doomSimon Howard
2014-10-21bfgedition: remap menu graphics by means of DEH_AddStringReplacement()Fabian Greffrath
during the initialization instead of a hard-coded diversion in the options menu itself
2014-10-21doom: Add -pack parameter to specify mission pack.Simon Howard
The main purpose for this parameter is to allow mods made for the Final Doom IWADs to be played properly with Freedoom. Chocolate Doom detects mission packs (pack_tnt/pack_plut) based on the file name. However, the Freedoom: Phase 2 IWAD contains the textures for all three Doom2-format IWADs, so can be used to play MegaWADs like Plutonia 2 that were designed to be played with plutonia.wad. Because mission pack detection is done based on filename, freedoom2.wad is handled the same as doom2.wad (a sensible default). But this means that when playing using a mod like Plutonia 2, the wrong level name is shown on the automap screen (along with eg. intermission text). To fix this we need a way to manually override the mission pack. -pack allows this to be done. It's kind of tedious that this has to be done manually but at least it can be done. Thanks chungy for the bug report/suggestion. This fixes #449.
2014-10-19doom: Write -cdrom savegames to c:\doomdata.Simon Howard
When using the -cdrom command line parameter (does anyone still use that?), savegames should be written to c:\doomdata to properly reproduce Vanilla behavior. These were being incorrectly written to c:\doomdata\savegames\foo.wad instead. This fixes #175. Thanks Alexandre-Xavier.
2014-10-19doom: Add game names for Freedoom IWADs.Simon Howard
When playing using one of the Freedoom IWADs, set the gamedescription string to be the full title of the IWAD being played, rather than showing "Ultimate Doom" or "Doom II: Hell on Earth" etc. This fixes #446 (thanks chungy).
2014-10-18Fix dehacked patch loading order.Simon Howard
The order in which we load dehacked patches is important. Change the order so that IWAD dehacked patches are loaded before any others, and so if, for example, we're playing with Freedoom, the Freedoom string replacements can be overridden by those from extra mods we're playing with. As part of this, ditch DEH_Init() and use DEH_ParseCommandLine() instead to handle the -deh option. Remove the DEH_Init() message from startup and show messages about dehacked patches that we load with the WAD files that we load.
2014-10-18doom: Refactor IWAD dehacked patch loading.Simon Howard
As per suggestions from Fabian Greffrath: * Change -noiwaddeh to -nodeh for consistency with other source ports (Boom-derived source ports use this to disable loading of DEHACKED lumps). * Extend the parameter so that it also disables loading of the Chex Quest dehacked patch. * Refactor the code for loading IWAD dehacked patches to all be in a single function.
2014-10-17doom: Add -noiwaddeh command line parameter.Simon Howard
Both the Freedoom IWADs and the rereleased HACX IWAD contain embedded DEHACKED lumps that are automatically loaded on startup. However, there may be some situations where it is undesirable to load these patches - when loading certain mods such as BTSX, for example. For these cases, allow the user to override the default behavior with a command line parameter.
2014-09-13dehacked: Load Freedoom DEHACKED lump on startup.Simon Howard
If using one of the Freedoom IWADs, detect it by checking for the FREEDOOM lump, and then load its DEHACKED lump to apply the cosmetic string changes that it includes. In case we're using an old version of one of the Freedoom IWADs, don't bomb out with an error while parsing the DEHACKED lump.
2014-05-05Clean up file headers.Simon Howard
This change rewrites and simplifies the copyright headers at the top of all source files: * Remove "Emacs style mode select" line; this line was included in the headers for the originally released source files and appears to be to set the file type for old versions of Emacs. I'm not sure entirely why it was required but I don't think it is any more. * Remove "You should have received a copy of..." text from copyright header. This refers to the old 59 Temple Place address where the FSF headquarters used to be located and is no longer correct. Rather than change to the new address, just remove the paragraph as it is superfluous anyway. This fixes #311. * Remove ---- separator lines so that the file headers are barer and more simplified.
2014-04-19Exit with error on startup if using the wrong IWAD.Simon Howard
Having multiple binaries can cause some confusion - some users try to run chocolate-doom with hexen.wad, thinking it is supported. Add a startup check that makes sure the user is not trying to start the game using the wrong IWAD file for the binary being run. This fixes #382.
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-30doom: Eliminate use of sprintf().Simon Howard
Use snprintf() or other functions in place of sprintf(). This is part of fixing #371.
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-29doom: Eliminate use of unsafe string functions.Simon Howard
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
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-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-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-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-20Remove superfluous dividers.Fabian Greffrath
2014-03-20Print a warning if the user is attempting to record or playback a demo or ↵Fabian Greffrath
connect to a network game using one of the BFG Edition IWADs.
2014-03-16doom: Add -dehlump parameter to load DEHACKED lumps.Simon Howard
Lots of otherwise Vanilla-compatible WADs contain DEHACKED lumps. Allow these to be loaded by adding a -dehlump command line parameter. Thanks to Fabian Greffrath for the suggestion (fixes #349).
2014-02-24Keep (bfgedition) as part of the check for TITLEPIC.Fabian Greffrath
2014-02-24More robust checks for BFG Edition.Fabian Greffrath
1) Move the check for (bfgedition) right behind loading the IWAD, i.e. before any PWADs are loaded that could probably provide a DMENUPIC lump. 2) Instead of checking for a missing TITLEPIC lump (which is only true for the doom2.wad shipped with the BFG Edition) check for the presence of DMENUPIC (which is exclusive to both classic IWADs shipped with the BFG Edition). The M_GDHIGH lumps, however, are incompatibly modified in *both* IWADs. 3) Move the check for the missing TITLEPIC lump to the place where it becomes actually crucial, i.e. D_DoAdvanceDemo() and make it independent of the (bfgedition) check. So, PWADs still have a chance to provide their own TITLEPIC lump.
2014-01-19doom: Add support for Freedoom IWAD names.Simon Howard
Freedoom has new IWAD names. Support these as fallbacks if no other IWAD file can be found, but prefer FreeDM as it has Vanilla- compatible levels. Show a warning on startup if running using the main Freedoom IWADs.
2013-11-17Change names of Doom II MAP31/MAP32 when using the BFG edition (thanksSimon Howard
Fabian Greffrath). Subversion-branch: /branches/v2-branch Subversion-revision: 2747
2013-10-12Tweak mouse grab behavior: don't arbitrarily warp the mouse at gameSimon Howard
startup. Subversion-branch: /branches/v2-branch Subversion-revision: 2699
2013-09-04Don't show ENDOOM screen when aborting netgame startup (thanks AlexandreSimon Howard
Xavier). Subversion-branch: /branches/v2-branch Subversion-revision: 2635
2013-04-05Split Doom netgame startup into two stages.Simon Howard
Subversion-branch: /branches/v2-branch Subversion-revision: 2583
2012-10-28Merge from trunk.Simon Howard
Subversion-branch: /branches/v2-branch Subversion-revision: 2537
2011-10-29Enable gcc warning to detect redundant declarations, and clean upSimon Howard
instances of this within the code (thanks Edward-san). Subversion-branch: /branches/v2-branch Subversion-revision: 2468
2011-10-22Merge from trunk.Simon Howard
Subversion-branch: /branches/v2-branch Subversion-revision: 2458
2011-10-21Add -statdump command line parameter, to generate the same output asSimon Howard
statdump.exe does with Vanilla Doom. Subversion-branch: /branches/v2-branch Subversion-revision: 2450
2011-10-17Always show the Strife intro splash screen in windowed mode, and finishSimon Howard
the splash screen before network startup. Subversion-branch: /branches/v2-branch Subversion-revision: 2435
2011-10-13Split out common main loop code into separate file, d_loop.c.Simon Howard
Subversion-branch: /branches/v2-branch Subversion-revision: 2413
2011-09-24Rework mouse speed box drawing code and move to common code, so that itSimon Howard
can be added to other games. Subversion-branch: /branches/v2-branch Subversion-revision: 2395
2011-09-24Remove duplicate code for parsing -file parameter.Simon Howard
Subversion-branch: /branches/v2-branch Subversion-revision: 2394
2011-09-20Add dedicated pack_chex and pack_hacx values for the Chex Quest and HacxSimon Howard
IWADs. Subversion-branch: /branches/v2-branch Subversion-revision: 2390
2011-09-17Merge from trunk.Simon Howard
Subversion-branch: /branches/v2-branch Subversion-revision: 2381
2011-09-05Refactor savegamedir calculation code to work the same as trunk.Simon Howard
Subversion-branch: /branches/raven-branch Subversion-revision: 2360
2011-06-13Merge from trunk.Simon Howard
Subversion-branch: /branches/raven-branch Subversion-revision: 2347
2011-02-24Load response files from main() before calling D_DoomMain, so that allSimon Howard
executables load response files, including the setup tool. Subversion-branch: /branches/raven-branch Subversion-revision: 2276
2011-02-12Merge from trunk.Simon Howard
Subversion-branch: /branches/raven-branch Subversion-revision: 2258
2010-12-10Merge from trunk. This is slightly out of date as I did the mergeSimon Howard
several days ago. Subversion-branch: /branches/raven-branch Subversion-revision: 2212
2010-09-26Restructure player quit code to take place on the first tic after theSimon Howard
player quit, to avoid possible desyncs. Further refactoring to split game-specific code from generic code. Subversion-branch: /branches/raven-branch Subversion-revision: 2141