From c7d167d2788d4741aa4bc6d7989ac1218370ae75 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Jul 2013 17:15:47 +0200 Subject: [PATCH 1/7] - used TEXTCOLOR_ #defines for colorizing CCMD list, remove use of strbin1. --- src/c_console.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index 0ecd600e4..e5d3d97ab 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -2125,16 +2125,16 @@ static bool C_TabCompleteList () const char* colorcode = ""; FConsoleCommand* ccmd; if (FindCVar (TabCommands[i].TabName, NULL)) - colorcode = "\\c[Green]"; + colorcode = TEXTCOLOR_GREEN; else if ((ccmd = FConsoleCommand::FindByName (TabCommands[i].TabName)) != NULL) { if (ccmd->IsAlias()) - colorcode = "\\c[Red]"; + colorcode = TEXTCOLOR_RED; else - colorcode = "\\c[Light Blue]"; + colorcode = TEXTCOLOR_LIGHTBLUE; } - Printf ("%s%-*s", strbin1 (colorcode).GetChars(), int(maxwidth), TabCommands[i].TabName.GetChars()); + Printf ("%s%-*s", colorcode, int(maxwidth), TabCommands[i].TabName.GetChars()); x += maxwidth; if (x > ConCols - maxwidth) { From eb5d57be06843b91f81790816245d000840f50ad Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 29 Jul 2013 18:30:26 -0400 Subject: [PATCH 2/7] - Fixed: crash when closing ZDoom in the save menu and a memory leak. --- src/menu/loadsavemenu.cpp | 3 ++- src/sdl/i_system.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 20779a221..9a87bb806 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -131,7 +131,8 @@ void ClearSaveGames() { for(unsigned i=0;ibNoDelete) + delete DLoadSaveMenu::SaveGames[i]; } DLoadSaveMenu::SaveGames.Clear(); } diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 292da5930..def35606a 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -749,6 +749,8 @@ int I_FindClose (void *handle) findstate_t *state = (findstate_t *)handle; if (handle != (void*)-1 && state->count > 0) { + for(int i = 0;i < state->count;++i) + free (state->namelist[i]); state->count = 0; free (state->namelist); state->namelist = NULL; From 805de60aa422e722af05d2b2fe41fca7e4d25985 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Jul 2013 09:16:27 +0200 Subject: [PATCH 3/7] - fixed: ChangeSpy didn't check if a player's camera's player pointer was valid before using it to get an index into the players table. --- src/g_game.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 0db149b0b..506b8e24b 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -862,7 +862,10 @@ static void ChangeSpy (int changespy) int pnum = consoleplayer; if (changespy != SPY_CANCEL) { - pnum = int(players[consoleplayer].camera->player - players); + player_t *player = players[consoleplayer].camera->player; + // only use the camera as starting index if it's a valid player. + if (player != NULL) pnum = int(players[consoleplayer].camera->player - players); + int step = (changespy == SPY_NEXT) ? 1 : -1; do From 27de9f45af14258b5f34469cb542f9fbfb9fd2f8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Jul 2013 09:25:07 +0200 Subject: [PATCH 4/7] - commented out autoloading of .DEH lumps for maint branch. --- src/d_dehacked.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index dd0000043..82ba21eba 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -2338,6 +2338,7 @@ int D_LoadDehLumps() count += D_LoadDehLump(lumpnum); } +#if 0 // commented out for 'maint' version. if (0 == PatchSize) { // No DEH/BEX patch is loaded yet, try to find lump(s) with specific extensions @@ -2358,6 +2359,7 @@ int D_LoadDehLumps() } } } +#endif return count; } From 81334809c4340c5332a53af83f6bcb5851e514b1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Jul 2013 09:32:33 +0200 Subject: [PATCH 5/7] - changed autoloading of *.deh lumps: it is now controlled by a CVAR with 3 options: never load *.deh lumps, load all of them or only load the last one. *.deh loading is disabled by default. --- src/d_dehacked.cpp | 44 ++++++++++++++++++++++++++------------- wadsrc/static/menudef.txt | 8 +++++++ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 82ba21eba..eb4e2fcd6 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -2329,6 +2329,18 @@ static int DoInclude (int dummy) return GetLine(); } +CVAR(Int, dehload, 0, CVAR_ARCHIVE) // Autoloading of .DEH lumps is disabled by default. + +// checks if lump is a .deh or .bex file. Only lumps in the root directory are considered valid. +static bool isDehFile(int lumpnum) +{ + const char* const fullName = Wads.GetLumpFullName(lumpnum); + const char* const extension = strrchr(fullName, '.'); + + return NULL != extension && strchr(fullName, '/') == NULL + && (0 == stricmp(extension, ".deh") || 0 == stricmp(extension, ".bex")); +} + int D_LoadDehLumps() { int lastlump = 0, lumpnum, count = 0; @@ -2338,28 +2350,32 @@ int D_LoadDehLumps() count += D_LoadDehLump(lumpnum); } -#if 0 // commented out for 'maint' version. - if (0 == PatchSize) + if (0 == PatchSize && dehload > 0) { // No DEH/BEX patch is loaded yet, try to find lump(s) with specific extensions - for (lumpnum = 0, lastlump = Wads.GetNumLumps(); - lumpnum < lastlump; - ++lumpnum) + if (dehload == 1) // load all .DEH lumps that are found. { - const char* const fullName = Wads.GetLumpFullName(lumpnum); - const char* const extension = strrchr(fullName, '.'); - - const bool isDehOrBex = NULL != extension - && (0 == stricmp(extension, ".deh") || 0 == stricmp(extension, ".bex")); - - if (isDehOrBex) + for (lumpnum = 0, lastlump = Wads.GetNumLumps(); lumpnum < lastlump; ++lumpnum) { - count += D_LoadDehLump(lumpnum); + if (isDehFile(lumpnum)) + { + count += D_LoadDehLump(lumpnum); + } + } + } + else // only load the last .DEH lump that is found. + { + for (lumpnum = Wads.GetNumLumps()-1; lumpnum >=0; --lumpnum) + { + if (isDehFile(lumpnum)) + { + count += D_LoadDehLump(lumpnum); + break; + } } } } -#endif return count; } diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 21f19c106..12201e379 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -850,6 +850,13 @@ OptionValue Autosave 2, "Never" } +OptionValue dehopt +{ + 0, "Never" + 1, "All" + 2, "Only last one" +} + OptionMenu "MiscOptions" { Title "Miscellaneous Options" @@ -864,6 +871,7 @@ OptionMenu "MiscOptions" Option "Enable cheats from all games", "allcheats", "OnOff" Option "Enable autosaves", "disableautosave", "Autosave" Slider "Number of autosaves", "autosavecount", 1, 20, 1, 0 + Option "Load *.deh/*.bex lumps", "dehload", "dehopt" StaticText " " Option "Cache nodes", "gl_cachenodes", "OnOff" Slider "Time threshold for node caching", "gl_cachetime", 0.0, 2.0, 0.1 From 4ce0574b3f562c25f30d1dd5f8a6af835a1eb0de Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Tue, 30 Jul 2013 11:45:42 +0200 Subject: [PATCH 6/7] - Use a more conformant C++ preprocessor macro identifier for Unix systems. The 'unix' identifier isn't defined when '-std' is passed to the compiler (tested with gcc and clang), so use '__unix__' which is well enough documented. --- src/b_game.cpp | 2 +- src/c_console.cpp | 2 +- src/c_dispatch.cpp | 2 +- src/ct_chat.cpp | 2 +- src/d_main.cpp | 8 ++++---- src/g_game.cpp | 4 ++-- src/gameconfigfile.cpp | 6 +++--- src/m_misc.cpp | 6 +++--- src/menu/loadsavemenu.cpp | 2 +- src/menu/menudef.cpp | 2 +- src/sound/fmodsound.cpp | 2 +- src/sound/music_fluidsynth_mididevice.cpp | 4 ++-- src/timidity/instrum.cpp | 2 +- src/version.h | 2 +- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/b_game.cpp b/src/b_game.cpp index a4c0a1842..ed3a5c848 100644 --- a/src/b_game.cpp +++ b/src/b_game.cpp @@ -505,7 +505,7 @@ bool FCajunMaster::LoadBots () bool gotteam = false; bglobal.ForgetBots (); -#ifndef unix +#ifndef __unix__ tmp = progdir; tmp += "zcajun/" BOTFILENAME; if (!FileExists (tmp)) diff --git a/src/c_console.cpp b/src/c_console.cpp index e5d3d97ab..0c02d0489 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -1742,7 +1742,7 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len) } break; -#ifdef unix +#ifdef __unix__ case EV_GUI_MButtonDown: C_PasteText(I_GetFromClipboard(true), buffer, len); break; diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 76b6e395d..88dbc5d64 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -1506,7 +1506,7 @@ CCMD (pullin) { const char *lastSlash; -#ifdef unix +#ifdef __unix__ lastSlash = strrchr (PullinFile, '/'); #else const char *lastSlash1, *lastSlash2; diff --git a/src/ct_chat.cpp b/src/ct_chat.cpp index d99acda42..c0c1f13f0 100644 --- a/src/ct_chat.cpp +++ b/src/ct_chat.cpp @@ -169,7 +169,7 @@ bool CT_Responder (event_t *ev) } return true; } -#ifdef unix +#ifdef __unix__ else if (ev->subtype == EV_GUI_MButtonDown) { CT_PasteChat(I_GetFromClipboard(true)); diff --git a/src/d_main.cpp b/src/d_main.cpp index 6c92babe4..5e67b69dd 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -38,7 +38,7 @@ #endif #include -#if defined(unix) || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) #include #endif @@ -2009,7 +2009,7 @@ static void AddAutoloadFiles(const char *gamesection) D_AddFile (allwads, wad); // [RH] Add any .wad files in the skins directory -#ifdef unix +#ifdef __unix__ file = SHARE_DIR; #else file = progdir; @@ -2017,7 +2017,7 @@ static void AddAutoloadFiles(const char *gamesection) file += "skins"; D_AddDirectory (allwads, file); -#ifdef unix +#ifdef __unix__ file = NicePath("~/" GAME_DIR "/skins"); D_AddDirectory (allwads, file); #endif @@ -2137,7 +2137,7 @@ static void CheckCmdLine() Printf ("%s", GStrings("D_DEVSTR")); } -#if !defined(unix) && !defined(__APPLE__) +#if !defined(__unix__) && !defined(__APPLE__) // We do not need to support -cdrom under Unix, because all the files // that would go to c:\\zdoomdat are already stored in .zdoom inside // the user's home directory. diff --git a/src/g_game.cpp b/src/g_game.cpp index 506b8e24b..79cd4b233 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1919,7 +1919,7 @@ FString G_BuildSaveName (const char *prefix, int slot) leader = Args->CheckValue ("-savedir"); if (leader.IsEmpty()) { -#if !defined(unix) && !defined(__APPLE__) +#if !defined(__unix__) && !defined(__APPLE__) if (Args->CheckParm ("-cdrom")) { leader = CDROM_DIR "/"; @@ -1931,7 +1931,7 @@ FString G_BuildSaveName (const char *prefix, int slot) } if (leader.IsEmpty()) { -#ifdef unix +#ifdef __unix__ leader = "~/" GAME_DIR; #elif defined(__APPLE__) char cpath[PATH_MAX]; diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 5c6fb0ce2..211ef96c6 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -135,7 +135,7 @@ FGameConfigFile::FGameConfigFile () local_app_support << cpath << "/" GAME_DIR; SetValueForKey("Path", local_app_support, true); } -#elif !defined(unix) +#elif !defined(__unix__) SetValueForKey ("Path", "$HOME", true); SetValueForKey ("Path", "$PROGDIR", true); #else @@ -153,7 +153,7 @@ FGameConfigFile::FGameConfigFile () SetValueForKey ("Path", user_app_support, true); SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", local_app_support, true); -#elif !defined(unix) +#elif !defined(__unix__) SetValueForKey ("Path", "$PROGDIR", true); #else SetValueForKey ("Path", "~/" GAME_DIR, true); @@ -683,7 +683,7 @@ void FGameConfigFile::CreateStandardAutoExec(const char *section, bool start) { path << cpath << "/" GAME_DIR "/autoexec.cfg"; } -#elif !defined(unix) +#elif !defined(__unix__) path = "$PROGDIR/autoexec.cfg"; #else path = GetUserFile ("autoexec.cfg"); diff --git a/src/m_misc.cpp b/src/m_misc.cpp index a8c6b7380..e218cadc4 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -333,7 +333,7 @@ static long ParseCommandLine (const char *args, int *argc, char **argv) } -#if defined(unix) +#if defined(__unix__) FString GetUserFile (const char *file) { FString path; @@ -698,7 +698,7 @@ void M_ScreenShot (const char *filename) // find a file name to save it to if (filename == NULL || filename[0] == '\0') { -#if !defined(unix) && !defined(__APPLE__) +#if !defined(__unix__) && !defined(__APPLE__) if (Args->CheckParm ("-cdrom")) { autoname = CDROM_DIR "\\"; @@ -715,7 +715,7 @@ void M_ScreenShot (const char *filename) dirlen = autoname.Len(); if (dirlen == 0) { -#ifdef unix +#ifdef __unix__ autoname = "~/" GAME_DIR "/screenshots/"; #elif defined(__APPLE__) char cpath[PATH_MAX]; diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 9a87bb806..f16e1cbc2 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -345,7 +345,7 @@ void DLoadSaveMenu::NotifyNewSave (const char *file, const char *title, bool okF for (unsigned i=0; iFilename.Compare (file) == 0) #else if (node->Filename.CompareNoCase (file) == 0) diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 00af179a5..616bdf2ca 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -158,7 +158,7 @@ static bool CheckSkipOptionBlock(FScanner &sc) } else if (sc.Compare("unix")) { - #ifdef unix + #ifdef __unix__ filter = true; #endif } diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index c21ba4054..f832183c0 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -816,7 +816,7 @@ bool FMODSoundRenderer::Init() } result = Sys->getNumDrivers(&driver); -#ifdef unix +#ifdef __unix__ if (result == FMOD_OK) { // On Linux, FMOD defaults to OSS. If OSS is not present, it doesn't diff --git a/src/sound/music_fluidsynth_mididevice.cpp b/src/sound/music_fluidsynth_mididevice.cpp index 53a93fe09..af8fe6667 100644 --- a/src/sound/music_fluidsynth_mididevice.cpp +++ b/src/sound/music_fluidsynth_mididevice.cpp @@ -295,7 +295,7 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice() fluid_chorus_speed, fluid_chorus_depth, fluid_chorus_type); if (0 == LoadPatchSets(fluid_patchset)) { -#ifdef unix +#ifdef __unix__ // This is the standard location on Ubuntu. if (0 == LoadPatchSets("/usr/share/sounds/sf2/FluidR3_GS.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2")) { @@ -322,7 +322,7 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice() } } #endif -#ifdef unix +#ifdef __unix__ } #endif } diff --git a/src/timidity/instrum.cpp b/src/timidity/instrum.cpp index 55683cb4e..5ab55201e 100644 --- a/src/timidity/instrum.cpp +++ b/src/timidity/instrum.cpp @@ -166,7 +166,7 @@ static Instrument *load_instrument(Renderer *song, const char *name, int percuss tmp += ".pat"; if ((fp = open_filereader(tmp, openmode, NULL)) == NULL) { -#ifdef unix // Windows isn't case-sensitive. +#ifdef __unix__ // Windows isn't case-sensitive. tmp.ToUpper(); if ((fp = open_filereader(tmp, openmode, NULL)) == NULL) #endif diff --git a/src/version.h b/src/version.h index 8bdd8ca81..a5bf7be29 100644 --- a/src/version.h +++ b/src/version.h @@ -91,7 +91,7 @@ const char *GetVersionString(); #define FORUM_URL "http://forum.zdoom.org" #define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3" -#ifdef unix +#ifdef __unix__ #define GAME_DIR ".config/zdoom" #elif defined(__APPLE__) #define GAME_DIR GAMENAME From 16456bec56aab807eb39b1abff57e4ab14cc6a8a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Jul 2013 13:17:20 +0200 Subject: [PATCH 7/7] - added separate colors for the various types of 2-sided walls for the overlay automap. They previously all mapped to the same CVAR. --- src/am_map.cpp | 7 ++++++- wadsrc/static/menudef.txt | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 0c8293ebe..8a4d1cc36 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -186,6 +186,9 @@ CVAR (Color, am_ovwallcolor, 0x00ff00, CVAR_ARCHIVE); CVAR (Color, am_ovspecialwallcolor, 0xffffff, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovotherwallscolor, 0x008844, CVAR_ARCHIVE); +CVAR (Color, am_ovefwallcolor, 0x008844, CVAR_ARCHIVE); +CVAR (Color, am_ovfdwallcolor, 0x008844, CVAR_ARCHIVE); +CVAR (Color, am_ovcdwallcolor, 0x008844, CVAR_ARCHIVE); CVAR (Color, am_ovunseencolor, 0x00226e, CVAR_ARCHIVE); CVAR (Color, am_ovtelecolor, 0xffff00, CVAR_ARCHIVE); CVAR (Color, am_intralevelcolor, 0x0000ff, CVAR_ARCHIVE); @@ -921,7 +924,9 @@ static void AM_initColors (bool overlayed) ThingColor_Monster.FromCVar (am_ovthingcolor_monster); ThingColor.FromCVar (am_ovthingcolor); LockedColor.FromCVar (am_ovotherwallscolor); - EFWallColor = FDWallColor = CDWallColor = LockedColor; + EFWallColor.FromCVar (am_ovefwallcolor); + FDWallColor.FromCVar (am_ovfdwallcolor); + CDWallColor.FromCVar (am_ovcdwallcolor); TSWallColor.FromCVar (am_ovunseencolor); NotSeenColor = TSWallColor; InterTeleportColor.FromCVar (am_ovtelecolor); diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 21f19c106..6097643ba 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1010,8 +1010,11 @@ OptionMenu MapColorMenu StaticText "Overlay Mode", 1 ColorPicker "You", "am_ovyourcolor" ColorPicker "1-sided walls", "am_ovwallcolor" - ColorPicker "2-sided walls", "am_ovotherwallscolor" + ColorPicker "2-sided walls with different floors", "am_ovfdwallcolor" + ColorPicker "2-sided walls with different ceilings", "am_ovcdwallcolor" + ColorPicker "2-sided walls with 3D floors", "am_ovefwallcolor" ColorPicker "Not-yet-seen walls", "am_ovunseencolor" + ColorPicker "Locked doors", "am_ovotherwallscolor" ColorPicker "Teleporter", "am_ovtelecolor" ColorPicker "Secret sector", "am_ovsecretsectorcolor" ColorPicker "Special trigger lines", "am_ovspecialwallcolor"