diff --git a/src/console/c_dispatch.cpp b/src/console/c_dispatch.cpp index abd851b3512..1921e2be334 100644 --- a/src/console/c_dispatch.cpp +++ b/src/console/c_dispatch.cpp @@ -1134,6 +1134,11 @@ FString BuildString (int argc, FString *argv) // //=========================================================================== +void FConsoleCommand::PrintCommand() +{ + Printf("%s\n", m_Name); +} + FString SubstituteAliasParams (FString &command, FCommandLine &args) { // Do substitution by replacing %x with the argument x. diff --git a/src/console/c_dispatch.h b/src/console/c_dispatch.h index f9fbd31d532..88976d95f5a 100644 --- a/src/console/c_dispatch.h +++ b/src/console/c_dispatch.h @@ -34,7 +34,9 @@ #ifndef __C_DISPATCH_H__ #define __C_DISPATCH_H__ -#include "doomtype.h" +#include +#include "tarray.h" +#include "zstring.h" class FConfigFile; @@ -63,7 +65,7 @@ struct FExecList TArray Commands; TArray Pullins; - void AddCommand(const char *cmd, const char *file = NULL); + void AddCommand(const char *cmd, const char *file = nullptr); void ExecCommands() const; void AddPullins(TArray &wads) const; }; @@ -107,7 +109,7 @@ class FConsoleCommand FConsoleCommand (const char *name, CCmdRun RunFunc); virtual ~FConsoleCommand (); virtual bool IsAlias (); - void PrintCommand () { Printf ("%s\n", m_Name); } + void PrintCommand(); virtual void Run (FCommandLine &args, AActor *instigator, int key); static FConsoleCommand* FindByName (const char* name); diff --git a/src/console/c_expr.cpp b/src/console/c_expr.cpp index 0f5cb9c4fa9..cde8527e251 100644 --- a/src/console/c_expr.cpp +++ b/src/console/c_expr.cpp @@ -40,6 +40,7 @@ #include "c_dispatch.h" #include "c_cvars.h" +#include "doomtype.h" // MACROS ------------------------------------------------------------------ diff --git a/src/gamedata/fonts/v_text.h b/src/gamedata/fonts/v_text.h index 365674b5214..cb16ebb7452 100644 --- a/src/gamedata/fonts/v_text.h +++ b/src/gamedata/fonts/v_text.h @@ -34,7 +34,6 @@ #ifndef __V_TEXT_H__ #define __V_TEXT_H__ -#include "doomtype.h" #include "v_font.h" struct FBrokenLines diff --git a/src/r_data/r_vanillatrans.cpp b/src/r_data/r_vanillatrans.cpp index 6bf89795154..ff2584e58ae 100644 --- a/src/r_data/r_vanillatrans.cpp +++ b/src/r_data/r_vanillatrans.cpp @@ -28,6 +28,7 @@ #include "templates.h" #include "c_cvars.h" #include "w_wad.h" +#include "doomtype.h" #ifdef _DEBUG #include "c_dispatch.h" #endif diff --git a/src/sound/backend/i_sound.cpp b/src/sound/backend/i_sound.cpp index 616120b98fb..0ba595ac7b3 100644 --- a/src/sound/backend/i_sound.cpp +++ b/src/sound/backend/i_sound.cpp @@ -47,7 +47,6 @@ #include "v_text.h" #include "c_cvars.h" #include "stats.h" -#include "s_music.h" #include "zmusic/zmusic.h" @@ -259,20 +258,12 @@ void I_InitSound () return; } -#ifndef NO_OPENAL - // Simplify transition to OpenAL backend - if (stricmp(snd_backend, "fmod") == 0) - { - Printf (TEXTCOLOR_ORANGE "FMOD Ex sound system was removed, switching to OpenAL\n"); - snd_backend = "openal"; - } -#endif // NO_OPENAL - + // Keep it simple: let everything except "null" init the sound. if (stricmp(snd_backend, "null") == 0) { GSnd = new NullSoundRenderer; } - else if(stricmp(snd_backend, "openal") == 0) + else { #ifndef NO_OPENAL if (IsOpenALPresent()) @@ -281,11 +272,6 @@ void I_InitSound () } #endif } - else - { - Printf (TEXTCOLOR_RED"%s: Unknown sound system specified\n", *snd_backend); - snd_backend = "null"; - } if (!GSnd || !GSnd->IsValid ()) { I_CloseSound(); diff --git a/src/sound/backend/i_soundinternal.h b/src/sound/backend/i_soundinternal.h index 311ed22b0bc..99dc1badbb5 100644 --- a/src/sound/backend/i_soundinternal.h +++ b/src/sound/backend/i_soundinternal.h @@ -3,7 +3,6 @@ #include -#include "doomtype.h" #include "vectors.h" #include "tarray.h" #include "zmusic/sounddecoder.h" diff --git a/src/sound/backend/oalsound.cpp b/src/sound/backend/oalsound.cpp index a16d42b41b9..3f3ede72f56 100644 --- a/src/sound/backend/oalsound.cpp +++ b/src/sound/backend/oalsound.cpp @@ -35,17 +35,18 @@ #include #include -#include "doomstat.h" +#include "c_cvars.h" #include "templates.h" #include "oalsound.h" #include "c_dispatch.h" #include "v_text.h" #include "i_module.h" #include "cmdlib.h" -#include "menu/menu.h" +#include "m_fixed.h" #include "zmusic/sounddecoder.h" #include "filereadermusicinterface.h" + const char *GetSampleTypeName(SampleType type); const char *GetChannelConfigName(ChannelConfig chan); @@ -96,58 +97,6 @@ bool IsOpenALPresent() -void I_BuildALDeviceList(FOptionValues *opt) -{ - opt->mValues.Resize(1); - opt->mValues[0].TextValue = "Default"; - opt->mValues[0].Text = "Default"; - -#ifndef NO_OPENAL - if (IsOpenALPresent()) - { - const ALCchar *names = (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") ? - alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER) : - alcGetString(NULL, ALC_DEVICE_SPECIFIER)); - if (!names) - Printf("Failed to get device list: %s\n", alcGetString(NULL, alcGetError(NULL))); - else while (*names) - { - unsigned int i = opt->mValues.Reserve(1); - opt->mValues[i].TextValue = names; - opt->mValues[i].Text = names; - - names += strlen(names) + 1; - } - } -#endif -} - -void I_BuildALResamplersList(FOptionValues *opt) -{ - opt->mValues.Resize(1); - opt->mValues[0].TextValue = "Default"; - opt->mValues[0].Text = "Default"; - -#ifndef NO_OPENAL - if (!IsOpenALPresent()) - return; - if (!alcGetCurrentContext() || !alIsExtensionPresent("AL_SOFT_source_resampler")) - return; - - LPALGETSTRINGISOFT alGetStringiSOFT = reinterpret_cast(alGetProcAddress("alGetStringiSOFT")); - ALint num_resamplers = alGetInteger(AL_NUM_RESAMPLERS_SOFT); - - unsigned int idx = opt->mValues.Reserve(num_resamplers); - for(ALint i = 0;i < num_resamplers;++i) - { - const ALchar *name = alGetStringiSOFT(AL_RESAMPLER_NAME_SOFT, i); - opt->mValues[idx].TextValue = name; - opt->mValues[idx].Text = name; - ++idx; - } -#endif -} - ReverbContainer *ForcedEnvironment; @@ -2359,4 +2308,60 @@ FSoundChan *OpenALSoundRenderer::FindLowestChannel() return lowest; } + +#include "menu/menu.h" + +void I_BuildALDeviceList(FOptionValues* opt) +{ + opt->mValues.Resize(1); + opt->mValues[0].TextValue = "Default"; + opt->mValues[0].Text = "Default"; + +#ifndef NO_OPENAL + if (IsOpenALPresent()) + { + const ALCchar* names = (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") ? + alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER) : + alcGetString(NULL, ALC_DEVICE_SPECIFIER)); + if (!names) + Printf("Failed to get device list: %s\n", alcGetString(NULL, alcGetError(NULL))); + else while (*names) + { + unsigned int i = opt->mValues.Reserve(1); + opt->mValues[i].TextValue = names; + opt->mValues[i].Text = names; + + names += strlen(names) + 1; + } + } +#endif +} + +void I_BuildALResamplersList(FOptionValues* opt) +{ + opt->mValues.Resize(1); + opt->mValues[0].TextValue = "Default"; + opt->mValues[0].Text = "Default"; + +#ifndef NO_OPENAL + if (!IsOpenALPresent()) + return; + if (!alcGetCurrentContext() || !alIsExtensionPresent("AL_SOFT_source_resampler")) + return; + + LPALGETSTRINGISOFT alGetStringiSOFT = reinterpret_cast(alGetProcAddress("alGetStringiSOFT")); + ALint num_resamplers = alGetInteger(AL_NUM_RESAMPLERS_SOFT); + + unsigned int idx = opt->mValues.Reserve(num_resamplers); + for (ALint i = 0; i < num_resamplers; ++i) + { + const ALchar* name = alGetStringiSOFT(AL_RESAMPLER_NAME_SOFT, i); + opt->mValues[idx].TextValue = name; + opt->mValues[idx].Text = name; + ++idx; + } +#endif +} + + #endif // NO_OPENAL diff --git a/src/sound/s_environment.cpp b/src/sound/s_environment.cpp index 9e1d19e37a9..276770f6caa 100644 --- a/src/sound/s_environment.cpp +++ b/src/sound/s_environment.cpp @@ -32,21 +32,11 @@ ** */ -#include "doomtype.h" -#include "s_sound.h" +#include "s_soundinternal.h" #include "sc_man.h" -#include "cmdlib.h" #include "templates.h" -#include "w_wad.h" -#include "i_system.h" #include "m_misc.h" -#include "c_cvars.h" -#include "c_dispatch.h" -#include "vm.h" -#include "dobject.h" -#include "menu/menu.h" - FReverbField ReverbFields[] = { @@ -526,7 +516,7 @@ void S_ReadReverbDef (FScanner &sc) while (sc.GetString ()) { - name = copystring (sc.String); + name = strdup (sc.String); sc.MustGetNumber (); id1 = sc.Number; sc.MustGetNumber (); @@ -627,7 +617,7 @@ void S_UnloadReverbDef () if (!probe->Builtin) { if (pNext != NULL) *pNext = probe->Next; - delete[] const_cast(probe->Name); + free(const_cast(probe->Name)); delete probe; } else diff --git a/src/sound/s_sound.cpp b/src/sound/s_sound.cpp index 7b6492c2a8c..4fba205dc5c 100644 --- a/src/sound/s_sound.cpp +++ b/src/sound/s_sound.cpp @@ -39,9 +39,7 @@ #include #endif -#include "i_system.h" -#include "i_sound.h" -#include "s_sound.h" +#include "s_soundinternal.h" #include "m_swap.h" #include "superfasthash.h"