diff --git a/source/common/console/c_cvars.cpp b/source/common/console/c_cvars.cpp index 6da4fa01e..c51c72f8c 100644 --- a/source/common/console/c_cvars.cpp +++ b/source/common/console/c_cvars.cpp @@ -39,6 +39,7 @@ #include "configfile.h" #include "c_console.h" +#include "gamecvars.h" //#include "cmdlib.h" //#include "c_dispatch.h" @@ -1410,9 +1411,10 @@ void C_ArchiveCVars (FConfigFile *f, uint32_t filter) qsort(cvarlist.Data(), cvarlist.Size(), sizeof(FBaseCVar*), cvarcmp); for (auto cvar : cvarlist) { - const char* const value = (cvar->Flags & CVAR_ISDEFAULT) - ? cvar->GetGenericRep(CVAR_String).String - : cvar->SafeValue.GetChars(); + // This does not work with the menus at use here. + const char* const value = //(cvar->Flags & CVAR_ISDEFAULT) + /*?*/ cvar->GetGenericRep(CVAR_String).String + /*: cvar->SafeValue.GetChars()*/; f->SetValueForKey(cvar->GetName(), value); } } diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index c3d9fc606..83871ebde 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -1457,10 +1457,10 @@ ACTOR_STATIC void G_MoveFX(void) int32_t const spriteHitag = (uint16_t)pSprite->hitag; auto const pPlayer = g_player[screenpeek].ps; - if (T2(spriteNum) != snd_enabled) + if (T2(spriteNum) != (int)SoundEnabled()) { // If sound playback was toggled, restart. - T2(spriteNum) = snd_enabled; + T2(spriteNum) = SoundEnabled(); T1(spriteNum) = 0; } diff --git a/source/duke3d/src/demo.cpp b/source/duke3d/src/demo.cpp index 9dc616f14..8152678f5 100644 --- a/source/duke3d/src/demo.cpp +++ b/source/duke3d/src/demo.cpp @@ -69,8 +69,8 @@ void Demo_PrepareWarp(void) { if (!g_demo_paused) { - g_demo_soundToggle = snd_enabled; - snd_enabled = 0; + g_demo_soundToggle = userConfig.nosound; + userConfig.nosound = true; } FX_StopAllSounds(); @@ -403,8 +403,8 @@ static void Demo_SetupProfile(void) { g_demo_profile *= -1; // now >0: profile for real - g_demo_soundToggle = snd_enabled; - snd_enabled = 0; // restored by Demo_FinishProfile() + g_demo_soundToggle = userConfig.nosound; + userConfig.nosound = true; // restored by Demo_FinishProfile() Bmemset(&g_prof, 0, sizeof(g_prof)); @@ -420,7 +420,7 @@ static void Demo_FinishProfile(void) double gms=g_prof.totalgamems; double dms1=g_prof.totalroomsdrawms, dms2=g_prof.totalrestdrawms; - snd_enabled = g_demo_soundToggle; + userConfig.nosound = g_demo_soundToggle; if (nt > 0) { @@ -689,7 +689,7 @@ nextdemo_nomenu: if (g_demo_goalCnt>0) { g_demo_goalCnt=0; - snd_enabled = g_demo_soundToggle; + userConfig.nosound = g_demo_soundToggle; } if (Demo_IsProfiling()) // don't reset g_demo_profile if it's < 0 @@ -731,10 +731,10 @@ nextdemo_nomenu: } else { - int32_t k = snd_enabled; - snd_enabled = 0; + int32_t k = userConfig.nosound; + userConfig.nosound = true; G_DoMoveThings(); - snd_enabled = k; + userConfig.nosound = k; } ototalclock += TICSPERFRAME; @@ -749,7 +749,7 @@ nextdemo_nomenu: if (g_demo_cnt>=g_demo_goalCnt) { g_demo_goalCnt = 0; - snd_enabled = g_demo_soundToggle; + userConfig.nosound = g_demo_soundToggle; } } } diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 1aff0ca14..29528f9bd 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -1486,7 +1486,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2) case USERDEFS_VM_PLAYER: labelNum = vm.playerNum; break; case USERDEFS_VM_SPRITE: labelNum = vm.spriteNum; break; case USERDEFS_VM_DISTANCE: labelNum = vm.playerDist; break; - case USERDEFS_SOUNDTOGGLE: labelNum = snd_enabled; break; + case USERDEFS_SOUNDTOGGLE: labelNum = SoundEnabled(); break; case USERDEFS_GAMETEXT_TRACKING: labelNum = MF_Bluefont.between.x; break; case USERDEFS_MENUTEXT_TRACKING: labelNum = MF_Redfont.between.x; break; case USERDEFS_MAXSPRITESONSCREEN: labelNum = maxspritesonscreen; break; diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 1cbc73b6e..b2e8ca9d1 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -2399,7 +2399,7 @@ static void postloadplayer(int32_t savegamep) for (SPRITES_OF(STAT_FX, i)) if (sprite[i].picnum == MUSICANDSFX) { - T2(i) = snd_enabled; + T2(i) = SoundEnabled(); T1(i) = 0; } diff --git a/source/rr/src/actors.cpp b/source/rr/src/actors.cpp index cbd846a60..f30ded343 100644 --- a/source/rr/src/actors.cpp +++ b/source/rr/src/actors.cpp @@ -1324,10 +1324,10 @@ ACTOR_STATIC void G_MoveFX(void) int32_t const spriteHitag = (uint16_t)pSprite->hitag; DukePlayer_t *const pPlayer = g_player[screenpeek].ps; - if (T2(spriteNum) != snd_enabled) + if (T2(spriteNum) != (int)SoundEnabled()) { // If sound playback was toggled, restart. - T2(spriteNum) = snd_enabled; + T2(spriteNum) = SoundEnabled(); T1(spriteNum) = 0; } diff --git a/source/rr/src/demo.cpp b/source/rr/src/demo.cpp index 861920fdc..b06ec2254 100644 --- a/source/rr/src/demo.cpp +++ b/source/rr/src/demo.cpp @@ -72,8 +72,8 @@ void Demo_PrepareWarp(void) { if (!g_demo_paused) { - g_demo_soundToggle = snd_enabled; - snd_enabled = 0; + g_demo_soundToggle = userConfig.nosound; + userConfig.nosound = true; } FX_StopAllSounds(); @@ -406,8 +406,8 @@ static void Demo_SetupProfile(void) { g_demo_profile *= -1; // now >0: profile for real - g_demo_soundToggle = snd_enabled; - snd_enabled = 0; // restored by Demo_FinishProfile() + g_demo_soundToggle = userConfig.nosound; + userConfig.nosound = true; // restored by Demo_FinishProfile() Bmemset(&g_prof, 0, sizeof(g_prof)); @@ -423,7 +423,7 @@ static void Demo_FinishProfile(void) double gms=g_prof.totalgamems; double dms1=g_prof.totalroomsdrawms, dms2=g_prof.totalrestdrawms; - snd_enabled = g_demo_soundToggle; + userConfig.nosound = g_demo_soundToggle; if (nt > 0) { @@ -692,7 +692,7 @@ nextdemo_nomenu: if (g_demo_goalCnt>0) { g_demo_goalCnt=0; - snd_enabled = g_demo_soundToggle; + userConfig.nosound = g_demo_soundToggle; } if (Demo_IsProfiling()) // don't reset g_demo_profile if it's < 0 @@ -736,10 +736,10 @@ nextdemo_nomenu: } else { - int32_t k = snd_enabled; - snd_enabled = 0; + int32_t k = userConfig.nosound; + userConfig.nosound = true; G_DoMoveThings(); - snd_enabled = k; + userConfig.nosound = k; } ototalclock += TICSPERFRAME; @@ -754,7 +754,7 @@ nextdemo_nomenu: if (g_demo_cnt>=g_demo_goalCnt) { g_demo_goalCnt = 0; - snd_enabled = g_demo_soundToggle; + userConfig.nosound = g_demo_soundToggle; } } } diff --git a/source/rr/src/savegame.cpp b/source/rr/src/savegame.cpp index 2147e7360..abf598c77 100644 --- a/source/rr/src/savegame.cpp +++ b/source/rr/src/savegame.cpp @@ -1892,7 +1892,7 @@ static void postloadplayer(int32_t savegamep) for (SPRITES_OF(STAT_FX, i)) if (sprite[i].picnum == MUSICANDSFX) { - T2(i) = snd_enabled; + T2(i) = SoundEnabled(); T1(i) = 0; }