From 8145b52037ab3b877aac56d9cab3630bd1bc752b Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 3 Mar 2018 15:17:30 +0200 Subject: [PATCH 1/8] Added explicit fallback to default soundfont With no soundfonts found the game crashed on startup Local UNIX build had the same issue because $PROGDIR/soundfonts is not in search path --- src/sound/i_soundfont.cpp | 5 +++++ src/sound/mididevices/music_fluidsynth_mididevice.cpp | 5 +---- src/version.h | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sound/i_soundfont.cpp b/src/sound/i_soundfont.cpp index ab7e31907a..4bb6eeeef5 100644 --- a/src/sound/i_soundfont.cpp +++ b/src/sound/i_soundfont.cpp @@ -372,6 +372,11 @@ void FSoundFontManager::CollectSoundfonts() } } } + + if (soundfonts.Size() == 0) + { + ProcessOneFile(NicePath("$PROGDIR/soundfonts/gzdoom.sf2")); + } } //========================================================================== diff --git a/src/sound/mididevices/music_fluidsynth_mididevice.cpp b/src/sound/mididevices/music_fluidsynth_mididevice.cpp index 3f87c8107c..a00fb01e61 100644 --- a/src/sound/mididevices/music_fluidsynth_mididevice.cpp +++ b/src/sound/mididevices/music_fluidsynth_mididevice.cpp @@ -324,10 +324,7 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice(const char *args) { return; } - if (LoadPatchSets(nullptr)) - { - return; - } + // The following will only be used if no soundfont at all is provided, i.e. even the standard one coming with GZDoom is missing. #ifdef __unix__ // This is the standard location on Ubuntu. diff --git a/src/version.h b/src/version.h index a4328141d6..afda99a21f 100644 --- a/src/version.h +++ b/src/version.h @@ -97,7 +97,6 @@ const char *GetVersionString(); #define GAMESIG "GZDOOM" #define BASEWAD "gzdoom.pk3" #define OPTIONALWAD "zd_extra.pk3" -#define BASESF "gzdoom.sf2" // More stuff that needs to be different for derivatives. #define GAMENAME "GZDoom" From c9613b2fd1405055fd19f892fc232ae0546c143b Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Sat, 3 Mar 2018 16:39:13 +0100 Subject: [PATCH 2/8] Make sidedef vertex and secplane height functions callable from ui --- wadsrc/static/zscript/mapdata.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index 12d4a8037e..011400f86e 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -80,8 +80,8 @@ struct Side native play //native DInterpolation *SetInterpolation(int position); //native void StopInterpolation(int position); - native Vertex V1(); - native Vertex V2(); + native clearscope Vertex V1(); + native clearscope Vertex V2(); native int Index(); @@ -179,7 +179,7 @@ struct SecPlane native play native bool isSlope() const; native int PointOnSide(Vector3 pos) const; - native double ZatPoint (Vector2 v) const; + native clearscope double ZatPoint (Vector2 v) const; native double ZatPointDist(Vector2 v, double dist) const; native bool isEqual(Secplane other) const; native void ChangeHeight(double hdiff); From d802abec5b66d1fd7efa84d50f37bcc7eda28a7c Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 4 Mar 2018 11:06:11 +0200 Subject: [PATCH 3/8] Fixed initialization of search paths on macOS IWAD directories previously set in user configuration file led to inconsistent file and soundfont search paths --- src/gameconfigfile.cpp | 60 ++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 80e08b3e70..c2655c3590 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -73,6 +73,38 @@ FGameConfigFile::FGameConfigFile () { #ifdef __APPLE__ FString user_docs, user_app_support, local_app_support; + { + char cpath[PATH_MAX]; + FSRef folder; + + if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) && + noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) + { + user_docs << cpath << "/" GAME_DIR; + } + else + { + user_docs = "~/" GAME_DIR; + } + if (noErr == FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &folder) && + noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) + { + user_app_support << cpath << "/" GAME_DIR; + } + else + { + user_app_support = "~/Library/Application Support/" GAME_DIR; + } + if (noErr == FSFindFolder(kLocalDomain, kApplicationSupportFolderType, kCreateFolder, &folder) && + noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) + { + local_app_support << cpath << "/" GAME_DIR; + } + else + { + local_app_support = "Library/Application Support/" GAME_DIR; + } + } #endif FString pathname; @@ -95,32 +127,10 @@ FGameConfigFile::FGameConfigFile () SetValueForKey ("Path", ".", true); SetValueForKey ("Path", "$DOOMWADDIR", true); #ifdef __APPLE__ - char cpath[PATH_MAX]; - FSRef folder; - - if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) && - noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) - { - user_docs << cpath << "/" GAME_DIR; - SetValueForKey("Path", user_docs, true); - } - else - { - SetValueForKey("Path", "~/" GAME_DIR, true); - } - if (noErr == FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &folder) && - noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) - { - user_app_support << cpath << "/" GAME_DIR; - SetValueForKey("Path", user_app_support, true); - } + SetValueForKey ("Path", user_docs, true); + SetValueForKey ("Path", user_app_support, true); SetValueForKey ("Path", "$PROGDIR", true); - if (noErr == FSFindFolder(kLocalDomain, kApplicationSupportFolderType, kCreateFolder, &folder) && - noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) - { - local_app_support << cpath << "/" GAME_DIR; - SetValueForKey("Path", local_app_support, true); - } + SetValueForKey ("Path", local_app_support, true); #elif !defined(__unix__) SetValueForKey ("Path", "$HOME", true); SetValueForKey ("Path", "$PROGDIR", true); From d0ec6ef1d4f0facbb18eeb48f85648bd88797c10 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 4 Mar 2018 13:09:29 +0200 Subject: [PATCH 4/8] TiMidity++ now loads SF2 soundfont with spaces in path --- src/sound/i_soundfont.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/i_soundfont.cpp b/src/sound/i_soundfont.cpp index 4bb6eeeef5..4a073bc5e9 100644 --- a/src/sound/i_soundfont.cpp +++ b/src/sound/i_soundfont.cpp @@ -107,7 +107,7 @@ int FSoundFontReader::pathcmp(const char *p1, const char *p2) FSF2Reader::FSF2Reader(const char *fn) { - mMainConfigForSF2.Format("soundfont %s\n", fn); + mMainConfigForSF2.Format("soundfont \"%s\"\n", fn); mFilename = fn; } From ac47166894a9eb7d6281eb9d067c2fd0891b8c31 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 4 Mar 2018 15:11:45 +0200 Subject: [PATCH 5/8] Fixed freeze after saving game when cl_waitforsave CVAR set to false Restored assertions that help to spot incorrect usage of I_FreezeTime() function https://forum.zdoom.org/viewtopic.php?t=59672 --- src/g_game.cpp | 4 +++- src/i_time.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index d0cf74be7c..2ca349631e 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2388,7 +2388,9 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio level.info->Snapshot.Clean(); insave = false; - I_FreezeTime(false); + + if (cl_waitforsave) + I_FreezeTime(false); } diff --git a/src/i_time.cpp b/src/i_time.cpp index 29119ddb4d..8fd0587236 100644 --- a/src/i_time.cpp +++ b/src/i_time.cpp @@ -187,10 +187,12 @@ void I_FreezeTime(bool frozen) { if (frozen) { + assert(FreezeTime == 0); FreezeTime = GetClockTimeNS(); } else { + assert(FreezeTime != 0); FirstFrameStartTime += GetClockTimeNS() - FreezeTime; FreezeTime = 0; I_SetFrameTime(); From 77e1a1d289adf7f4fe76d98f51aaac29679606cb Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 5 Mar 2018 12:31:50 +0200 Subject: [PATCH 6/8] Replaced usages of fluid_settings_getstr() function This function is deprecated since FluidSynth 1.1.9 and removed in upcoming 2.x --- src/sound/i_musicinterns.h | 1 - src/sound/mididevices/music_fluidsynth_mididevice.cpp | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/sound/i_musicinterns.h b/src/sound/i_musicinterns.h index 2f04a39c15..b4269aabaf 100644 --- a/src/sound/i_musicinterns.h +++ b/src/sound/i_musicinterns.h @@ -297,7 +297,6 @@ protected: static TReqProc fluid_settings_setnum; static TReqProc fluid_settings_setstr; static TReqProc fluid_settings_setint; - static TReqProc fluid_settings_getstr; static TReqProc fluid_settings_getint; static TReqProc fluid_synth_set_reverb_on; static TReqProc fluid_synth_set_chorus_on; diff --git a/src/sound/mididevices/music_fluidsynth_mididevice.cpp b/src/sound/mididevices/music_fluidsynth_mididevice.cpp index a00fb01e61..05ed275323 100644 --- a/src/sound/mididevices/music_fluidsynth_mididevice.cpp +++ b/src/sound/mididevices/music_fluidsynth_mididevice.cpp @@ -656,10 +656,9 @@ FString FluidSynthMIDIDevice::GetStats() int polyphony = fluid_synth_get_polyphony(FluidSynth); int voices = fluid_synth_get_active_voice_count(FluidSynth); double load = fluid_synth_get_cpu_load(FluidSynth); - char *chorus, *reverb; - int maxpoly; - fluid_settings_getstr(FluidSettings, "synth.chorus.active", &chorus); - fluid_settings_getstr(FluidSettings, "synth.reverb.active", &reverb); + int chorus, reverb, maxpoly; + fluid_settings_getint(FluidSettings, "synth.chorus.active", &chorus); + fluid_settings_getint(FluidSettings, "synth.reverb.active", &reverb); fluid_settings_getint(FluidSettings, "synth.polyphony", &maxpoly); CritSec.Leave(); @@ -667,7 +666,7 @@ FString FluidSynthMIDIDevice::GetStats() TEXTCOLOR_YELLOW "%6.2f" TEXTCOLOR_NORMAL "%% CPU " "Reverb: " TEXTCOLOR_YELLOW "%3s" TEXTCOLOR_NORMAL " Chorus: " TEXTCOLOR_YELLOW "%3s", - voices, polyphony, maxpoly, load, reverb, chorus); + voices, polyphony, maxpoly, load, reverb ? "yes" : "no", chorus ? "yes" : "no"); return out; } @@ -691,7 +690,6 @@ DYN_FLUID_SYM(delete_fluid_settings); DYN_FLUID_SYM(fluid_settings_setnum); DYN_FLUID_SYM(fluid_settings_setstr); DYN_FLUID_SYM(fluid_settings_setint); -DYN_FLUID_SYM(fluid_settings_getstr); DYN_FLUID_SYM(fluid_settings_getint); DYN_FLUID_SYM(fluid_synth_set_reverb_on); DYN_FLUID_SYM(fluid_synth_set_chorus_on); From 3e9de3788d71bc91bd31025cbaa8713de22df665 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 5 Mar 2018 15:02:39 +0200 Subject: [PATCH 7/8] Fixed spelling of MissileShootersActivateImpactLines MAPINFO property https://forum.zdoom.org/viewtopic.php?t=59686 --- src/g_mapinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 951b6a346d..325f6c2d2a 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1431,7 +1431,7 @@ MapFlagHandlers[] = { "activateowndeathspecials", MITYPE_SETFLAG, LEVEL_ACTOWNSPECIAL, 0 }, { "killeractivatesdeathspecials", MITYPE_CLRFLAG, LEVEL_ACTOWNSPECIAL, 0 }, { "missilesactivateimpactlines", MITYPE_SETFLAG2, LEVEL2_MISSILESACTIVATEIMPACT, 0 }, - { "missileshootersactivetimpactlines",MITYPE_CLRFLAG2, LEVEL2_MISSILESACTIVATEIMPACT, 0 }, + { "missileshootersactivateimpactlines",MITYPE_CLRFLAG2, LEVEL2_MISSILESACTIVATEIMPACT, 0 }, { "noinventorybar", MITYPE_SETFLAG, LEVEL_NOINVENTORYBAR, 0 }, { "deathslideshow", MITYPE_IGNORE, 0, 0 }, { "strictmonsteractivation", MITYPE_CLRFLAG2, LEVEL2_LAXMONSTERACTIVATION, LEVEL2_LAXACTIVATIONMAPINFO }, From adae6c19b868c732a14a31b8ad7e8faca6bc704a Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 5 Mar 2018 16:53:17 +0200 Subject: [PATCH 8/8] Made left button down event available to UI event handler Main menu is no longer triggered in game on left mouse button press when handler is processing UI events https://forum.zdoom.org/viewtopic.php?t=59673 --- src/menu/menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index f03c37eb73..bf8999ded8 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -714,7 +714,7 @@ bool M_Responder (event_t *ev) return false; } else if (ev->type == EV_GUI_Event && ev->subtype == EV_GUI_LButtonDown && - ConsoleState != c_down && m_use_mouse) + ConsoleState != c_down && gamestate != GS_LEVEL && m_use_mouse) { M_StartControlPanel(true); M_SetMenu(NAME_Mainmenu, -1);