From 346fcf584cd338b7d1642dfcb23dd19a8a785e1c Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Mon, 27 Apr 2015 15:22:09 +0200 Subject: [PATCH 1/3] - Fixed C++11 warnings from recent commits. --- src/oplsynth/music_opldumper_mididevice.cpp | 4 +- src/sound/oalsound.cpp | 42 ++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/oplsynth/music_opldumper_mididevice.cpp b/src/oplsynth/music_opldumper_mididevice.cpp index 33e026c07d..46dcdfef21 100644 --- a/src/oplsynth/music_opldumper_mididevice.cpp +++ b/src/oplsynth/music_opldumper_mididevice.cpp @@ -113,7 +113,7 @@ public: BYTE chipnum = reg >> 8; if (chipnum != CurChip) { - BYTE switcher[2] = { chipnum + 1, 2 }; + BYTE switcher[2] = { (BYTE)(chipnum + 1), 2 }; fwrite(switcher, 1, 2, File); } reg &= 255; @@ -192,7 +192,7 @@ public: "\0\0\0\0" // Total milliseconds "\0\0\0", // Total data 1, 20, File); - char type[4] = { Dual * 2, 0, 0, 0 }; // Single or dual OPL-2 + char type[4] = { (char)(Dual * 2), 0, 0, 0 }; // Single or dual OPL-2 fwrite(type, 1, 4, File); } virtual ~OPL_DOSBOXdump() diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index 6d7cb210e6..447de49f98 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -634,7 +634,7 @@ ALCdevice *OpenALSoundRenderer::InitDevice() { device = alcOpenDevice(*snd_aldevice); if(!device) - Printf(TEXTCOLOR_BLUE" Failed to open device "TEXTCOLOR_BOLD"%s"TEXTCOLOR_BLUE". Trying default.\n", *snd_aldevice); + Printf(TEXTCOLOR_BLUE" Failed to open device " TEXTCOLOR_BOLD"%s" TEXTCOLOR_BLUE". Trying default.\n", *snd_aldevice); } if(!device) @@ -674,13 +674,13 @@ OpenALSoundRenderer::OpenALSoundRenderer() current = alcGetString(Device, ALC_ALL_DEVICES_SPECIFIER); if(alcGetError(Device) != ALC_NO_ERROR || !current) current = alcGetString(Device, ALC_DEVICE_SPECIFIER); - Printf(" Opened device "TEXTCOLOR_ORANGE"%s\n", current); + Printf(" Opened device " TEXTCOLOR_ORANGE"%s\n", current); ALCint major=0, minor=0; alcGetIntegerv(Device, ALC_MAJOR_VERSION, 1, &major); alcGetIntegerv(Device, ALC_MINOR_VERSION, 1, &minor); - DPrintf(" ALC Version: "TEXTCOLOR_BLUE"%d.%d\n", major, minor); - DPrintf(" ALC Extensions: "TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_EXTENSIONS)); + DPrintf(" ALC Version: " TEXTCOLOR_BLUE"%d.%d\n", major, minor); + DPrintf(" ALC Extensions: " TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_EXTENSIONS)); TArray attribs; if(*snd_samplerate > 0) @@ -710,10 +710,10 @@ OpenALSoundRenderer::OpenALSoundRenderer() } attribs.Clear(); - DPrintf(" Vendor: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VENDOR)); - DPrintf(" Renderer: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_RENDERER)); - DPrintf(" Version: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VERSION)); - DPrintf(" Extensions: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS)); + DPrintf(" Vendor: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VENDOR)); + DPrintf(" Renderer: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_RENDERER)); + DPrintf(" Version: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VERSION)); + DPrintf(" Extensions: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS)); ALC.EXT_EFX = !!alcIsExtensionPresent(Device, "ALC_EXT_EFX"); ALC.EXT_disconnect = !!alcIsExtensionPresent(Device, "ALC_EXT_disconnect");; @@ -775,7 +775,7 @@ OpenALSoundRenderer::OpenALSoundRenderer() return; } FreeSfx = Sources; - DPrintf(" Allocated "TEXTCOLOR_BLUE"%u"TEXTCOLOR_NORMAL" sources\n", Sources.Size()); + DPrintf(" Allocated " TEXTCOLOR_BLUE"%u" TEXTCOLOR_NORMAL" sources\n", Sources.Size()); WasInWater = false; if(*snd_efx && ALC.EXT_EFX) @@ -1735,7 +1735,7 @@ float OpenALSoundRenderer::GetAudibility(FISoundChannel *chan) void OpenALSoundRenderer::PrintStatus() { - Printf("Output device: "TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_DEVICE_SPECIFIER)); + Printf("Output device: " TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_DEVICE_SPECIFIER)); getALCError(Device); ALCint frequency, major, minor, mono, stereo; @@ -1746,10 +1746,10 @@ void OpenALSoundRenderer::PrintStatus() alcGetIntegerv(Device, ALC_STEREO_SOURCES, 1, &stereo); if(getALCError(Device) == AL_NO_ERROR) { - Printf("Device sample rate: "TEXTCOLOR_BLUE"%d"TEXTCOLOR_NORMAL"hz\n", frequency); - Printf("ALC Version: "TEXTCOLOR_BLUE"%d.%d\n", major, minor); - Printf("ALC Extensions: "TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_EXTENSIONS)); - Printf("Available sources: "TEXTCOLOR_BLUE"%d"TEXTCOLOR_NORMAL" ("TEXTCOLOR_BLUE"%d"TEXTCOLOR_NORMAL" mono, "TEXTCOLOR_BLUE"%d"TEXTCOLOR_NORMAL" stereo)\n", mono+stereo, mono, stereo); + Printf("Device sample rate: " TEXTCOLOR_BLUE"%d" TEXTCOLOR_NORMAL"hz\n", frequency); + Printf("ALC Version: " TEXTCOLOR_BLUE"%d.%d\n", major, minor); + Printf("ALC Extensions: " TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_EXTENSIONS)); + Printf("Available sources: " TEXTCOLOR_BLUE"%d" TEXTCOLOR_NORMAL" (" TEXTCOLOR_BLUE"%d" TEXTCOLOR_NORMAL" mono, " TEXTCOLOR_BLUE"%d" TEXTCOLOR_NORMAL" stereo)\n", mono+stereo, mono, stereo); } if(!alcIsExtensionPresent(Device, "ALC_EXT_EFX")) Printf("EFX not found\n"); @@ -1761,14 +1761,14 @@ void OpenALSoundRenderer::PrintStatus() alcGetIntegerv(Device, ALC_MAX_AUXILIARY_SENDS, 1, &sends); if(getALCError(Device) == AL_NO_ERROR) { - Printf("EFX Version: "TEXTCOLOR_BLUE"%d.%d\n", major, minor); - Printf("Auxiliary sends: "TEXTCOLOR_BLUE"%d\n", sends); + Printf("EFX Version: " TEXTCOLOR_BLUE"%d.%d\n", major, minor); + Printf("Auxiliary sends: " TEXTCOLOR_BLUE"%d\n", sends); } } - Printf("Vendor: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VENDOR)); - Printf("Renderer: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_RENDERER)); - Printf("Version: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VERSION)); - Printf("Extensions: "TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS)); + Printf("Vendor: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VENDOR)); + Printf("Renderer: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_RENDERER)); + Printf("Version: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VERSION)); + Printf("Extensions: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS)); getALError(); } @@ -1783,7 +1783,7 @@ FString OpenALSoundRenderer::GatherStats() uint32 unused = FreeSfx.Size(); FString out; - out.Format("%u sources ("TEXTCOLOR_YELLOW"%u"TEXTCOLOR_NORMAL" active, "TEXTCOLOR_YELLOW"%u"TEXTCOLOR_NORMAL" free), Update interval: "TEXTCOLOR_YELLOW"%d"TEXTCOLOR_NORMAL"ms", + out.Format("%u sources (" TEXTCOLOR_YELLOW"%u" TEXTCOLOR_NORMAL" active, " TEXTCOLOR_YELLOW"%u" TEXTCOLOR_NORMAL" free), Update interval: " TEXTCOLOR_YELLOW"%d" TEXTCOLOR_NORMAL"ms", total, used, unused, 1000/updates); return out; } From ae16e5d195ab16ca03404a60b65815d8a1df9855 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 27 Apr 2015 15:14:01 +0200 Subject: [PATCH 2/3] - Assigned editor number 5006 to SkyCamCompat class, to match Eternity's definition. --- wadsrc/static/mapinfo/common.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index eece14c84a..f26ca67315 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -37,6 +37,7 @@ DoomEdNums 5001 = PointPusher 5002 = PointPuller 5004 = FS_Mapspot + 5006 = SkyCamCompat 5061 = InvisibleBridge32 5064 = InvisibleBridge16 5065 = InvisibleBridge8 From 9ba5e30bed6d42c958fdf4b8a9e4cb46eb0545b8 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 27 Apr 2015 14:15:03 -0400 Subject: [PATCH 3/3] - Moved autoload initialization to a separate function so that the rest of the ini can be loaded as before. Some platforms do indeed place zdoom.pk3 elsewhere. --- src/d_main.cpp | 11 +++++++---- src/gameconfigfile.cpp | 40 ++++++++++++++++++++++------------------ src/gameconfigfile.h | 3 ++- src/m_misc.cpp | 4 ++-- src/m_misc.h | 2 +- 5 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 9ddc17cd58..98be13e337 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1981,6 +1981,9 @@ static void D_DoomInit() } FRandom::StaticClearRandom (); + + Printf ("M_LoadDefaults: Load system defaults.\n"); + M_LoadDefaults (); // load before initing other systems } //========================================================================== @@ -1989,7 +1992,7 @@ static void D_DoomInit() // //========================================================================== -static void AddAutoloadFiles(const char *autoname) +static void AddAutoloadFiles(const char *autoname) { LumpFilterIWAD.Format("%s.", autoname); // The '.' is appened to simplify parsing the string @@ -2247,8 +2250,8 @@ void D_DoomMain (void) iwad_man = new FIWadManager; iwad_man->ParseIWadInfos(basewad); - Printf ("M_LoadDefaults: Load system defaults.\n"); - M_LoadDefaults (iwad_man); // load before initing other systems + // Now that we have the IWADINFO, initialize the autoload ini sections. + GameConfig->DoAutoloadSetup(iwad_man); PClass::StaticInit (); atterm(FinalGC); @@ -2292,7 +2295,7 @@ void D_DoomMain (void) FBaseCVar::DisableCallbacks(); GameConfig->DoGameSetup (gameinfo.ConfigName); - AddAutoloadFiles(iwad_info->Autoname); + AddAutoloadFiles(iwad_info->Autoname); // Process automatically executed files FExecList *exec; diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 30dc2276db..3d396d98b5 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -76,7 +76,7 @@ EXTERN_CVAR (Color, am_cdwallcolor) EXTERN_CVAR (Float, spc_amp) EXTERN_CVAR (Bool, wi_percents) -FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man) +FGameConfigFile::FGameConfigFile () { #ifdef __APPLE__ FString user_docs, user_app_support, local_app_support; @@ -161,6 +161,27 @@ FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man) SetValueForKey ("Path", "$DOOMWADDIR", true); } + // Add some self-documentation. + SetSectionNote("IWADSearch.Directories", + "# These are the directories to automatically search for IWADs.\n" + "# Each directory should be on a separate line, preceded by Path=\n"); + SetSectionNote("FileSearch.Directories", + "# These are the directories to search for wads added with the -file\n" + "# command line parameter, if they cannot be found with the path\n" + "# as-is. Layout is the same as for IWADSearch.Directories\n"); +} + +FGameConfigFile::~FGameConfigFile () +{ +} + +void FGameConfigFile::WriteCommentHeader (FILE *file) const +{ + fprintf (file, "# This file was generated by " GAMENAME " %s on %s\n", GetVersionString(), myasctime()); +} + +void FGameConfigFile::DoAutoloadSetup (FIWadManager *iwad_man) +{ // Create auto-load sections, so users know what's available. // Note that this totem pole is the reverse of the order that // they will appear in the file. @@ -220,14 +241,6 @@ FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man) MoveSectionToStart("FileSearch.Directories"); MoveSectionToStart("IWADSearch.Directories"); - // Add some self-documentation. - SetSectionNote("IWADSearch.Directories", - "# These are the directories to automatically search for IWADs.\n" - "# Each directory should be on a separate line, preceded by Path=\n"); - SetSectionNote("FileSearch.Directories", - "# These are the directories to search for wads added with the -file\n" - "# command line parameter, if they cannot be found with the path\n" - "# as-is. Layout is the same as for IWADSearch.Directories\n"); SetSectionNote("Doom.AutoExec", "# Files to automatically execute when running the corresponding game.\n" "# Each file should be on its own line, preceded by Path=\n\n"); @@ -245,15 +258,6 @@ FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man) "# 'doom.doom2.commercial.Autoload' only when playing doom2.wad.\n\n"); } -FGameConfigFile::~FGameConfigFile () -{ -} - -void FGameConfigFile::WriteCommentHeader (FILE *file) const -{ - fprintf (file, "# This file was generated by " GAMENAME " %s on %s\n", GetVersionString(), myasctime()); -} - void FGameConfigFile::DoGlobalSetup () { if (SetSection ("GlobalSettings.Unknown")) diff --git a/src/gameconfigfile.h b/src/gameconfigfile.h index 5862bb79ec..68630f5107 100644 --- a/src/gameconfigfile.h +++ b/src/gameconfigfile.h @@ -43,9 +43,10 @@ class FIWadManager; class FGameConfigFile : public FConfigFile { public: - FGameConfigFile (FIWadManager *iwad_man); + FGameConfigFile (); ~FGameConfigFile (); + void DoAutoloadSetup (FIWadManager *iwad_man); void DoGlobalSetup (); void DoGameSetup (const char *gamename); void DoKeySetup (const char *gamename); diff --git a/src/m_misc.cpp b/src/m_misc.cpp index 1369bdb520..7f4fa482d9 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -410,9 +410,9 @@ CCMD (writeini) // M_LoadDefaults // -void M_LoadDefaults (FIWadManager *iwad_man) +void M_LoadDefaults () { - GameConfig = new FGameConfigFile(iwad_man); + GameConfig = new FGameConfigFile; GameConfig->DoGlobalSetup (); atterm (M_SaveDefaultsFinal); } diff --git a/src/m_misc.h b/src/m_misc.h index ea146c6905..8b0da1050c 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -41,7 +41,7 @@ void M_FindResponseFile (void); // Pass a NULL to get the original behavior. void M_ScreenShot (const char *filename); -void M_LoadDefaults (FIWadManager *iwad_man); +void M_LoadDefaults (); bool M_SaveDefaults (const char *filename); void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection, size_t sublen);