- refactoring of music CVARs

This is a lot of changes in a lot of code because nothing here was abstracted into the sound system. :(

Hopefully most of the affected code here can be tossed out soon, it's not pretty.
This commit is contained in:
Christoph Oelckers 2019-10-22 02:01:05 +02:00
parent d2be5a4db9
commit 8431266d27
55 changed files with 369 additions and 653 deletions

View file

@ -54,7 +54,7 @@ int nAmbChannels = 0;
void ambProcess(void)
{
if (!SoundToggle)
if (!snd_enabled)
return;
for (int nSprite = headspritestat[kStatAmbience]; nSprite >= 0; nSprite = nextspritestat[nSprite])
{

View file

@ -400,7 +400,7 @@ void PreloadCache(void)
gSoundRes.PurgeCache();
gSysRes.PrecacheSounds();
gSoundRes.PrecacheSounds();
if (MusicRestartsOnLoadToggle)
if (mus_restartonload)
sndTryPlaySpecialMusic(MUS_LOADING);
PreloadTiles();
ClockTicks clock = totalclock;

View file

@ -71,7 +71,7 @@ int32_t JoystickAnalogueSaturate[MAXJOYAXES];
uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
int32_t scripthandle;
int32_t setupread;
int32_t MusicRestartsOnLoadToggle;
int32_t mus_restartonload;
int32_t configversion;
int32_t CheckForUpdates;
int32_t LastUpdateCheck;
@ -96,7 +96,6 @@ int32_t gMessageTime;
int32_t gMessageFont;
int32_t gbAdultContent;
char gzAdultPassword[9];
int32_t gDoppler;
int32_t gShowWeapon;
int32_t gMouseSensitivity;
int32_t gMouseAiming;
@ -284,20 +283,6 @@ void CONFIG_SetDefaults(void)
gSetup.bpp = 8;
#endif
#if defined(_WIN32)
MixRate = 44100;
#elif defined __ANDROID__
MixRate = droidinfo.audio_sample_rate;
#else
MixRate = 48000;
#endif
#if defined GEKKO || defined __OPENDINGUX__
NumVoices = 32;
#else
NumVoices = 64;
#endif
#ifdef GEKKO
gSetup.usejoystick = 1;
#else
@ -309,25 +294,15 @@ void CONFIG_SetDefaults(void)
gSetup.fullscreen = 1;
gSetup.usemouse = 1;
//ud.config.AmbienceToggle = 1;
//snd_ambience = 1;
//ud.config.AutoAim = 1;
CheckForUpdates = 1;
FXVolume = 255;
MouseBias = 0;
MouseDeadZone = 0;
MusicToggle = 1;
MusicRestartsOnLoadToggle = 0;
MusicVolume = 195;
NumBits = 16;
NumChannels = 2;
ReverseStereo = 0;
gBrightness = 8;
//ud.config.ShowWeapons = 0;
SmoothInput = 1;
SoundToggle = 1;
CDAudioToggle = 0;
MusicDevice = 0;
//ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
useprecache = 1;
configversion = 0;
//ud.crosshair = 1;
@ -387,7 +362,6 @@ void CONFIG_SetDefaults(void)
gMessageTime = 5;
gMessageFont = 0;
gbAdultContent = 0;
gDoppler = 1;
gShowWeapon = 0;
gzAdultPassword[0] = 0;

View file

@ -53,7 +53,7 @@ extern int32_t JoystickAnalogueSaturate[MAXJOYAXES];
extern uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
extern int32_t scripthandle;
extern int32_t setupread;
extern int32_t MusicRestartsOnLoadToggle;
extern int32_t mus_restartonload;
extern int32_t configversion;
extern int32_t CheckForUpdates;
extern int32_t LastUpdateCheck;
@ -77,7 +77,6 @@ extern int32_t gMessageTime;
extern int32_t gMessageFont;
extern int32_t gbAdultContent;
extern char gzAdultPassword[9];
extern int32_t gDoppler;
extern int32_t gShowWeapon;
extern int32_t gMouseSensitivity;
extern int32_t gMouseAiming;

View file

@ -238,13 +238,13 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
nScale = divscale16(200, nHeight);
if (nWav)
sndStartWavID(nWav, FXVolume);
sndStartWavID(nWav, snd_fxvolume);
else
{
auto nHandleWAV = credKOpen4Load(pzWAV);
if (nHandleWAV.isOpen())
{
sndStartWavDisk(pzWAV, FXVolume);
sndStartWavDisk(pzWAV, snd_fxvolume);
}
}

View file

@ -115,7 +115,6 @@ void CEndGameMgr::Finish(void)
{
levelSetupOptions(gGameOptions.nEpisode, gNextLevel);
gInitialNetPlayers = numplayers;
//if (FXDevice != -1)
FX_StopAllSounds();
sndKillAllSounds();
gStartNewGame = 1;

View file

@ -400,7 +400,7 @@ int levelGetMusicIdx(const char *str)
bool levelTryPlayMusic(int nEpisode, int nLevel, bool bSetLevelSong)
{
char buffer[BMAX_PATH];
if (CDAudioToggle && gEpisodeInfo[nEpisode].at28[nLevel].ate0 > 0)
if (mus_redbook && gEpisodeInfo[nEpisode].at28[nLevel].ate0 > 0)
snprintf(buffer, BMAX_PATH, "blood%02i.ogg", gEpisodeInfo[nEpisode].at28[nLevel].ate0);
else
strncpy(buffer, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH);

View file

@ -170,7 +170,7 @@ void LoadSave::LoadGame(char *pzFile)
gGameStarted = 1;
bVanilla = false;
if (MusicRestartsOnLoadToggle
if (mus_restartonload
|| demoWasPlayed
|| (gMusicPrevLoadedEpisode != gGameOptions.nEpisode || gMusicPrevLoadedLevel != gGameOptions.nLevel))
{

View file

@ -223,10 +223,10 @@ CGameMenuItemTitle itemOptionsOldTitle("OPTIONS", 1, 160, 20, 2038);
CGameMenuItemChain itemOption1("CONTROLS...", 3, 0, 40, 320, 1, &menuControls, -1, NULL, 0);
CGameMenuItemSlider sliderDetail("DETAIL:", 3, 66, 50, 180, gDetail, 0, 4, 1, SetDetail, -1, -1);
CGameMenuItemSlider sliderGamma("GAMMA:", 3, 66, 60, 180, gGamma, 0, 15, 2, SetGamma, -1, -1);
CGameMenuItemSlider sliderMusic("MUSIC:", 3, 66, 70, 180, MusicVolume, 0, 256, 48, SetMusicVol, -1, -1);
CGameMenuItemSlider sliderSound("SOUND:", 3, 66, 80, 180, FXVolume, 0, 256, 48, SetSoundVol, -1, -1);
CGameMenuItemSlider sliderMusic("MUSIC:", 3, 66, 70, 180, mus_volume, 0, 256, 48, SetMusicVol, -1, -1);
CGameMenuItemSlider sliderSound("SOUND:", 3, 66, 80, 180, snd_fxvolume, 0, 256, 48, SetSoundVol, -1, -1);
CGameMenuItemSlider sliderCDAudio("CD AUDIO:", 3, 66, 90, 180, CDVolume, 0, 256, 48, SetCDVol, -1, -1);
CGameMenuItemZBool bool3DAudio("3D AUDIO:", 3, 66, 100, 180, gDoppler, SetDoppler, NULL, NULL);
CGameMenuItemZBool bool3DAudio("3D AUDIO:", 3, 66, 100, 180, snd_doppler, SetDoppler, NULL, NULL);
CGameMenuItemZBool boolCrosshair("CROSSHAIR:", 3, 66, 110, 180, cl_crosshair, SetCrosshair, NULL, NULL);
CGameMenuItemZBool boolShowWeapons("SHOW WEAPONS:", 3, 66, 120, 180, gShowWeapon, SetShowWeapons, NULL, NULL);
CGameMenuItemZBool boolSlopeTilting("SLOPE TILTING:", 3, 66, 130, 180, gSlopeTilting, SetSlopeTilting, NULL, NULL);
@ -299,10 +299,10 @@ CGameMenuItemChain itemNetStart12("START GAME", 1, 66, 175, 280, 0, 0, -1, Start
CGameMenuItemText itemLoadingText("LOADING...", 1, 160, 100, 1);
CGameMenuItemTitle itemSoundsTitle("SOUNDS", 1, 160, 20, 2038);
CGameMenuItemSlider itemSoundsMusic("MUSIC:", 3, 40, 60, 180, MusicVolume, 0, 256, 48, SetMusicVol, -1, -1);
CGameMenuItemSlider itemSoundsSound("SOUND:", 3, 40, 70, 180, FXVolume, 0, 256, 48, SetSoundVol, -1, -1);
CGameMenuItemSlider itemSoundsMusic("MUSIC:", 3, 40, 60, 180, mus_volume, 0, 256, 48, SetMusicVol, -1, -1);
CGameMenuItemSlider itemSoundsSound("SOUND:", 3, 40, 70, 180, snd_fxvolume, 0, 256, 48, SetSoundVol, -1, -1);
CGameMenuItemSlider itemSoundsCDAudio("CD AUDIO:", 3, 40, 80, 180, CDVolume, 0, 256, 48, SetCDVol, -1, -1);
CGameMenuItemZBool itemSounds3DAudio("3D SOUND:", 3, 40, 90, 180, gDoppler, SetDoppler, NULL, NULL);
CGameMenuItemZBool itemSounds3DAudio("3D SOUND:", 3, 40, 90, 180, snd_doppler, SetDoppler, NULL, NULL);
CGameMenuItemTitle itemQuitTitle("QUIT", 1, 160, 20, 2038);
CGameMenuItemText itemQuitText1("Do you really want to quit?", 0, 160, 100, 1);
@ -583,10 +583,10 @@ CGameMenuItemTitle itemOptionsSoundTitle("SOUND SETUP", 1, 160, 20, 2038);
CGameMenuItemZBool itemOptionsSoundSoundToggle("SOUND:", 3, 66, 60, 180, false, UpdateSoundToggle, NULL, NULL);
CGameMenuItemZBool itemOptionsSoundMusicToggle("MUSIC:", 3, 66, 70, 180, false, UpdateMusicToggle, NULL, NULL);
CGameMenuItemZBool itemOptionsSound3DToggle("3D AUDIO:", 3, 66, 80, 180, false, Update3DToggle, NULL, NULL);
CGameMenuItemSlider itemOptionsSoundSoundVolume("SOUND VOLUME:", 3, 66, 90, 180, &FXVolume, 0, 256, 48, UpdateSoundVolume, -1, -1, kMenuSliderPercent);
CGameMenuItemSlider itemOptionsSoundMusicVolume("MUSIC VOLUME:", 3, 66, 100, 180, &MusicVolume, 0, 256, 48, UpdateMusicVolume, -1, -1, kMenuSliderPercent);
CGameMenuItemSlider itemOptionsSoundSoundVolume("SOUND VOLUME:", 3, 66, 90, 180, &snd_fxvolume.Value, 0, 256, 48, UpdateSoundVolume, -1, -1, kMenuSliderPercent);
CGameMenuItemSlider itemOptionsSoundMusicVolume("MUSIC VOLUME:", 3, 66, 100, 180, &mus_volume.Value, 0, 256, 48, UpdateMusicVolume, -1, -1, kMenuSliderPercent);
CGameMenuItemZCycle itemOptionsSoundSampleRate("SAMPLE RATE:", 3, 66, 110, 180, 0, UpdateSoundRate, pzSoundRateStrings, 3, 0);
CGameMenuItemSlider itemOptionsSoundNumVoices("VOICES:", 3, 66, 120, 180, NumVoices, 16, 256, 16, UpdateNumVoices, -1, -1, kMenuSliderValue);
CGameMenuItemSlider itemOptionsSoundNumVoices("VOICES:", 3, 66, 120, 180, snd_numvoices, 16, 256, 16, UpdateNumVoices, -1, -1, kMenuSliderValue);
CGameMenuItemZBool itemOptionsSoundCDToggle("REDBOOK AUDIO:", 3, 66, 130, 180, false, UpdateCDToggle, NULL, NULL);
CGameMenuItemZCycle itemOptionsSoundMusicDevice("MUSIC DEVICE:", 3, 66, 140, 180, 0, UpdateMusicDevice, pzMusicDeviceStrings, 2, 0);
CGameMenuItemChain itemOptionsSoundApplyChanges("APPLY CHANGES", 3, 66, 150, 180, 0, NULL, 0, SetSound, 0);
@ -748,9 +748,9 @@ void SetupOptionsOldMenu(void)
{
sliderDetail.nValue = ClipRange(gDetail, sliderDetail.nRangeLow, sliderDetail.nRangeHigh);
sliderGamma.nValue = ClipRange(gGamma, sliderGamma.nRangeLow, sliderGamma.nRangeHigh);
sliderMusic.nValue = ClipRange(MusicVolume, sliderMusic.nRangeLow, sliderMusic.nRangeHigh);
sliderSound.nValue = ClipRange(FXVolume, sliderSound.nRangeLow, sliderSound.nRangeHigh);
bool3DAudio.at20 = gDoppler;
sliderMusic.nValue = ClipRange(mus_volume, sliderMusic.nRangeLow, sliderMusic.nRangeHigh);
sliderSound.nValue = ClipRange(snd_fxvolume, sliderSound.nRangeLow, sliderSound.nRangeHigh);
bool3DAudio.at20 = snd_doppler;
boolCrosshair.at20 = cl_crosshair;
boolShowWeapons.at20 = gShowWeapon;
boolSlopeTilting.at20 = gSlopeTilting;
@ -1006,8 +1006,8 @@ void SetupLoadGameMenu(void)
void SetupSoundsMenu(void)
{
itemSoundsMusic.nValue = ClipRange(MusicVolume, itemSoundsMusic.nRangeLow, itemSoundsMusic.nRangeHigh);
itemSoundsSound.nValue = ClipRange(FXVolume, itemSoundsSound.nRangeLow, itemSoundsSound.nRangeHigh);
itemSoundsMusic.nValue = ClipRange(mus_volume, itemSoundsMusic.nRangeLow, itemSoundsMusic.nRangeHigh);
itemSoundsSound.nValue = ClipRange(snd_fxvolume, itemSoundsSound.nRangeLow, itemSoundsSound.nRangeHigh);
menuSounds.Add(&itemSoundsTitle, false);
menuSounds.Add(&itemSoundsMusic, true);
menuSounds.Add(&itemSoundsSound, false);
@ -1366,7 +1366,7 @@ void UpdateNetworkMenus(void)
void SetDoppler(CGameMenuItemZBool *pItem)
{
gDoppler = pItem->at20;
snd_doppler = pItem->at20;
}
void SetCrosshair(CGameMenuItemZBool *pItem)
@ -1793,15 +1793,15 @@ void PreDrawDisplayPolymost(CGameMenuItem *pItem)
void UpdateSoundToggle(CGameMenuItemZBool *pItem)
{
SoundToggle = pItem->at20;
if (!SoundToggle)
snd_enabled = pItem->at20;
if (!snd_enabled)
FX_StopAllSounds();
}
void UpdateMusicToggle(CGameMenuItemZBool *pItem)
{
MusicToggle = pItem->at20;
if (!MusicToggle)
mus_enabled = pItem->at20;
if (!mus_enabled)
sndStopSong();
else
{
@ -1812,12 +1812,12 @@ void UpdateMusicToggle(CGameMenuItemZBool *pItem)
void Update3DToggle(CGameMenuItemZBool *pItem)
{
gDoppler = pItem->at20;
snd_doppler = pItem->at20;
}
void UpdateCDToggle(CGameMenuItemZBool *pItem)
{
CDAudioToggle = pItem->at20;
mus_redbook = pItem->at20;
if (gGameStarted || gDemo.at1)
levelTryPlayMusicOrNothing(gGameOptions.nEpisode, gGameOptions.nLevel);
}
@ -1850,8 +1850,8 @@ void UpdateMusicDevice(CGameMenuItemZCycle *pItem)
void SetSound(CGameMenuItemChain *pItem)
{
UNREFERENCED_PARAMETER(pItem);
MixRate = nSoundRateValues[itemOptionsSoundSampleRate.m_nFocus];
NumVoices = itemOptionsSoundNumVoices.nValue;
snd_mixrate = nSoundRateValues[itemOptionsSoundSampleRate.m_nFocus];
snd_numvoices = itemOptionsSoundNumVoices.nValue;
MusicDevice = itemOptionsSoundMusicDevice.m_nFocus;
sfxTerm();
sndTerm();
@ -1859,7 +1859,7 @@ void SetSound(CGameMenuItemChain *pItem)
sndInit();
sfxInit();
if (MusicToggle && (gGameStarted || gDemo.at1))
if (mus_enabled && (gGameStarted || gDemo.at1))
sndPlaySong(gGameOptions.zLevelSong, true);
}
@ -1871,20 +1871,20 @@ void PreDrawSound(CGameMenuItem *pItem)
void SetupOptionsSound(CGameMenuItemChain *pItem)
{
UNREFERENCED_PARAMETER(pItem);
itemOptionsSoundSoundToggle.at20 = SoundToggle;
itemOptionsSoundMusicToggle.at20 = MusicToggle;
itemOptionsSound3DToggle.at20 = gDoppler;
itemOptionsSoundCDToggle.at20 = CDAudioToggle;
itemOptionsSoundSoundToggle.at20 = snd_enabled;
itemOptionsSoundMusicToggle.at20 = mus_enabled;
itemOptionsSound3DToggle.at20 = snd_doppler;
itemOptionsSoundCDToggle.at20 = mus_redbook;
itemOptionsSoundSampleRate.m_nFocus = 0;
for (int i = 0; i < 3; i++)
{
if (nSoundRateValues[i] == MixRate)
if (nSoundRateValues[i] == snd_mixrate)
{
itemOptionsSoundSampleRate.m_nFocus = i;
break;
}
}
itemOptionsSoundNumVoices.nValue = NumVoices;
itemOptionsSoundNumVoices.nValue = snd_numvoices;
itemOptionsSoundMusicDevice.m_nFocus = MusicDevice;
}

View file

@ -1142,18 +1142,18 @@ static MenuEntry_t *ME_SAVE;
static MenuEntry_t **MEL_SAVE;
static int32_t soundrate, soundvoices;
static MenuOption_t MEO_SOUND = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.config.SoundToggle );
static MenuOption_t MEO_SOUND = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &snd_enabled.Value );
static MenuEntry_t ME_SOUND = MAKE_MENUENTRY( "Sound:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND, Option );
static MenuOption_t MEO_SOUND_MUSIC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.config.MusicToggle );
static MenuOption_t MEO_SOUND_MUSIC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, mus_enabled.Value );
static MenuEntry_t ME_SOUND_MUSIC = MAKE_MENUENTRY( "Music:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND_MUSIC, Option );
static char const s_Volume[] = "Volume:";
static MenuRangeInt32_t MEO_SOUND_VOLUME_FX = MAKE_MENURANGE( &ud.config.FXVolume, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_FX = MAKE_MENURANGE( &snd_fxvolume.Value, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuEntry_t ME_SOUND_VOLUME_FX = MAKE_MENUENTRY( s_Volume, &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SOUND_VOLUME_FX, RangeInt32 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_MUSIC = MAKE_MENURANGE( &ud.config.MusicVolume, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_MUSIC = MAKE_MENURANGE( &mus_volume.Value, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuEntry_t ME_SOUND_VOLUME_MUSIC = MAKE_MENUENTRY( s_Volume, &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SOUND_VOLUME_MUSIC, RangeInt32 );
#ifndef EDUKE32_STANDALONE
@ -2105,15 +2105,15 @@ static void Menu_Pre(MenuID_t cm)
case MENU_SOUND:
case MENU_SOUND_INGAME:
case MENU_ADVSOUND:
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_FX, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_MUSIC, !ud.config.MusicToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_DUKETALK, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_SAMPLINGRATE, !ud.config.SoundToggle && !ud.config.MusicToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_FX, !snd_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_MUSIC, !mus_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_DUKETALK, !snd_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_SAMPLINGRATE, !snd_enabled && !mus_enabled);
#ifndef EDUKE32_SIMPLE_MENU
MenuEntry_DisableOnCondition(&ME_SOUND_NUMVOICES, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_NUMVOICES, !snd_enabled);
#endif
MenuEntry_DisableOnCondition(&ME_SOUND_RESTART, soundrate == ud.config.MixRate &&
soundvoices == ud.config.NumVoices);
MenuEntry_DisableOnCondition(&ME_SOUND_RESTART, soundrate == snd_mixrate &&
soundvoices == snd_numvoices);
break;
case MENU_SAVESETUP:
@ -3219,8 +3219,8 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
}
else if (entry == &ME_SOUND_RESTART)
{
ud.config.MixRate = soundrate;
ud.config.NumVoices = soundvoices;
snd_mixrate = soundrate;
snd_numvoices = soundvoices;
S_SoundShutdown();
S_MusicShutdown();
@ -3231,7 +3231,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
FX_StopAllSounds();
S_ClearSoundLocks();
if (ud.config.MusicToggle)
if (mus_enabled)
S_RestartMusic();
}
else if (entry == &ME_SAVESETUP_CLEANUP)
@ -3297,7 +3297,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
}
else if (entry == &ME_SOUND_MUSIC)
{
ud.config.MusicToggle = newOption;
mus_enabled = newOption;
if (newOption == 0)
S_PauseMusic(true);
@ -3308,7 +3308,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
}
}
else if (entry == &ME_SOUND_DUKETALK)
ud.config.VoiceToggle = (ud.config.VoiceToggle&~1) | newOption;
snd_speech = (snd_speech&~1) | newOption;
else if (entry == &ME_MOUSESETUP_SMOOTH)
CONTROL_SmoothMouse = ud.config.SmoothInput;
else if (entry == &ME_JOYSTICK_ENABLE)
@ -3606,7 +3606,7 @@ static int32_t Menu_EntryOptionSource(MenuEntry_t *entry, int32_t currentValue)
if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP)
return (ud.weaponswitch & 1) ? ((ud.weaponswitch & 4) ? 2 : 1) : 0;
else if (entry == &ME_SOUND_DUKETALK)
return ud.config.VoiceToggle & 1;
return snd_speech & 1;
else if (entry == &ME_NETOPTIONS_MONSTERS)
return (ud.m_monsters_off ? g_skillCnt : ud.m_player_skill);
@ -4249,8 +4249,8 @@ static void Menu_AboutToStartDisplaying(Menu_t * m)
break;
case MENU_ADVSOUND:
soundrate = ud.config.MixRate;
soundvoices = ud.config.NumVoices;
soundrate = snd_mixrate;
soundvoices = snd_numvoices;
break;
default:

View file

@ -237,7 +237,7 @@ static int osdcmd_music(osdcmdptr_t parm)
if (!levelTryPlayMusic(nEpisode, nLevel))
{
if (CDAudioToggle)
if (mus_redbook)
snprintf(buffer, sizeof(buffer), "Playing %i track", gEpisodeInfo[nEpisode].at28[nLevel].ate0);
else
snprintf(buffer, sizeof(buffer), "Playing %s", gEpisodeInfo[nEpisode].at28[nLevel].atd0);
@ -431,7 +431,7 @@ static int osdcmd_restartsound(osdcmdptr_t UNUSED(parm))
sndInit();
sfxInit();
if (MusicToggle && (gGameStarted || gDemo.at1))
if (mus_enabled && (gGameStarted || gDemo.at1))
sndPlaySong(gGameOptions.zLevelSong, true);
return OSDCMD_OK;

View file

@ -119,7 +119,7 @@ void Calc3DValues(BONKLE *pBonkle)
void sfxPlay3DSound(int x, int y, int z, int soundId, int nSector)
{
if (!SoundToggle || soundId < 0) return;
if (!snd_enabled || soundId < 0) return;
DICTNODE *hRes = gSoundRes.Lookup(soundId, "SFX");
if (!hRes)return;
@ -153,7 +153,7 @@ void sfxPlay3DSound(int x, int y, int z, int soundId, int nSector)
priority = lVol;
if (priority < rVol)
priority = rVol;
if (gDoppler)
if (snd_doppler)
{
MV_Lock();
pBonkle->at0 = FX_PlayRaw(pData + lPhase, size - lPhase, lPitch, 0, lVol, lVol, 0, priority, 1.f, (intptr_t)&pBonkle->at0);
@ -169,7 +169,7 @@ void sfxPlay3DSound(int x, int y, int z, int soundId, int nSector)
void sfxPlay3DSound(spritetype *pSprite, int soundId, int a3, int a4)
{
if (!SoundToggle)
if (!snd_enabled)
return;
if (!pSprite)
return;
@ -252,7 +252,7 @@ void sfxPlay3DSound(spritetype *pSprite, int soundId, int a3, int a4)
char *pData = (char*)gSoundRes.Lock(hRes);
if (loopStart >= 0)
{
if (gDoppler)
if (snd_doppler)
{
pBonkle->at0 = FX_PlayLoopedRaw(pData + lPhase, size - lPhase, pData + loopStart, pData + loopEnd, lPitch, 0, lVol, lVol, 0, priority, 1.f, (intptr_t)&pBonkle->at0);
pBonkle->at4 = FX_PlayLoopedRaw(pData + rPhase, size - rPhase, pData + loopStart, pData + loopEnd, rPitch, 0, rVol, 0, rVol, priority, 1.f, (intptr_t)&pBonkle->at4);
@ -266,7 +266,7 @@ void sfxPlay3DSound(spritetype *pSprite, int soundId, int a3, int a4)
else
{
pData = (char*)gSoundRes.Lock(pBonkle->at8);
if (gDoppler)
if (snd_doppler)
{
pBonkle->at0 = FX_PlayRaw(pData + lPhase, size - lPhase, lPitch, 0, lVol, lVol, 0, priority, 1.f, (intptr_t)&pBonkle->at0);
pBonkle->at4 = FX_PlayRaw(pData + rPhase, size - rPhase, rPitch, 0, rVol, 0, rVol, priority, 1.f, (intptr_t)&pBonkle->at4);
@ -283,7 +283,7 @@ void sfxPlay3DSound(spritetype *pSprite, int soundId, int a3, int a4)
// By NoOne: same as previous, but allows to set custom pitch for sound AND volume. Used by SFX gen now.
void sfxPlay3DSoundCP(spritetype* pSprite, int soundId, int a3, int a4, int pitch, int volume)
{
if (!SoundToggle || !pSprite || soundId < 0) return;
if (!snd_enabled || !pSprite || soundId < 0) return;
DICTNODE* hRes = gSoundRes.Lookup(soundId, "SFX");
if (!hRes) return;
@ -363,7 +363,7 @@ void sfxPlay3DSoundCP(spritetype* pSprite, int soundId, int a3, int a4, int pitc
char* pData = (char*)gSoundRes.Lock(hRes);
if (loopStart >= 0)
{
if (gDoppler)
if (snd_doppler)
{
pBonkle->at0 = FX_PlayLoopedRaw(pData + lPhase, size - lPhase, pData + loopStart, pData + loopEnd, lPitch, 0, lVol, lVol, 0, priority, 1.f, (intptr_t)& pBonkle->at0);
pBonkle->at4 = FX_PlayLoopedRaw(pData + rPhase, size - rPhase, pData + loopStart, pData + loopEnd, rPitch, 0, rVol, 0, rVol, priority, 1.f, (intptr_t)& pBonkle->at4);
@ -377,7 +377,7 @@ void sfxPlay3DSoundCP(spritetype* pSprite, int soundId, int a3, int a4, int pitc
else
{
pData = (char*)gSoundRes.Lock(pBonkle->at8);
if (gDoppler)
if (snd_doppler)
{
pBonkle->at0 = FX_PlayRaw(pData + lPhase, size - lPhase, lPitch, 0, lVol, lVol, 0, priority, 1.f, (intptr_t)& pBonkle->at0);
pBonkle->at4 = FX_PlayRaw(pData + rPhase, size - rPhase, rPitch, 0, rVol, 0, rVol, priority, 1.f, (intptr_t)& pBonkle->at4);

View file

@ -35,19 +35,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
int32_t SoundToggle;
int32_t MusicToggle;
int32_t CDAudioToggle;
int32_t FXVolume;
int32_t MusicVolume;
int32_t CDVolume;
int32_t NumVoices;
int32_t NumChannels;
int32_t NumBits;
int32_t MixRate;
int32_t ReverseStereo;
int32_t MusicDevice;
Resource gSoundRes;
int soundRates[13] = {
@ -93,7 +80,7 @@ int nWaveMusicHandle;
int sndPlaySong(const char *songName, bool bLoop)
{
if (!MusicToggle)
if (!mus_enabled)
return 0;
if (!songName || strlen(songName) == 0)
return 1;
@ -110,7 +97,7 @@ int sndPlaySong(const char *songName, bool bLoop)
int nNewSongSize = hSong->size;
char *pNewSongPtr = (char *)Xaligned_alloc(16, nNewSongSize);
gSoundRes.Load(hSong, pNewSongPtr);
MUSIC_SetVolume(MusicVolume);
MUSIC_SetVolume(mus_volume);
int32_t retval = MUSIC_PlaySong(pNewSongPtr, nNewSongSize, bLoop);
if (retval != MUSIC_Ok)
@ -174,7 +161,7 @@ int sndPlaySong(const char *songName, bool bLoop)
}
else
{
int nNewWaveMusicHandle = FX_Play(pNewSongPtr, bLoop ? nNewSongSize : -1, 0, 0, 0, MusicVolume, MusicVolume, MusicVolume,
int nNewWaveMusicHandle = FX_Play(pNewSongPtr, bLoop ? nNewSongSize : -1, 0, 0, 0, mus_volume, mus_volume, mus_volume,
FX_MUSIC_PRIORITY, 1.f, (intptr_t)&nWaveMusicHandle);
if (nNewWaveMusicHandle <= FX_Ok)
@ -207,12 +194,7 @@ bool sndIsSongPlaying(void)
void sndFadeSong(int nTime)
{
UNREFERENCED_PARAMETER(nTime);
// NUKE-TODO:
//if (MusicDevice == -1)
// return;
//if (gEightyTwoFifty && sndMultiPlayer)
// return;
//MUSIC_FadeVolume(0, nTime);
if (bWaveMusic && nWaveMusicHandle >= 0)
{
FX_StopSound(nWaveMusicHandle);
@ -225,7 +207,7 @@ void sndFadeSong(int nTime)
void sndSetMusicVolume(int nVolume)
{
MusicVolume = nVolume;
mus_volume = nVolume;
if (bWaveMusic && nWaveMusicHandle >= 0)
FX_SetPan(nWaveMusicHandle, nVolume, nVolume, nVolume);
MUSIC_SetVolume(nVolume);
@ -233,7 +215,7 @@ void sndSetMusicVolume(int nVolume)
void sndSetFXVolume(int nVolume)
{
FXVolume = nVolume;
snd_fxvolume = nVolume;
FX_SetVolume(nVolume);
}
@ -262,7 +244,7 @@ void sndKillSound(SAMPLE2D *pChannel);
void sndStartSample(const char *pzSound, int nVolume, int nChannel)
{
if (!SoundToggle)
if (!snd_enabled)
return;
if (!strlen(pzSound))
return;
@ -284,7 +266,7 @@ void sndStartSample(const char *pzSound, int nVolume, int nChannel)
void sndStartSample(unsigned int nSound, int nVolume, int nChannel, bool bLoop)
{
if (!SoundToggle)
if (!snd_enabled)
return;
dassert(nChannel >= -1 && nChannel < kMaxChannels);
DICTNODE *hSfx = gSoundRes.Lookup(nSound, "SFX");
@ -328,7 +310,7 @@ void sndStartSample(unsigned int nSound, int nVolume, int nChannel, bool bLoop)
void sndStartWavID(unsigned int nSound, int nVolume, int nChannel)
{
if (!SoundToggle)
if (!snd_enabled)
return;
dassert(nChannel >= -1 && nChannel < kMaxChannels);
SAMPLE2D *pChannel;
@ -435,15 +417,14 @@ void InitSoundDevice(void)
void *initdata = NULL;
#endif
int nStatus;
nStatus = FX_Init(NumVoices, NumChannels, MixRate, initdata);
nStatus = FX_Init(snd_numvoices, snd_numchannels, snd_mixrate, initdata);
if (nStatus != 0)
{
initprintf("InitSoundDevice: %s\n", FX_ErrorString(nStatus));
return;
}
if (ReverseStereo == 1)
FX_SetReverseStereo(!FX_GetReverseStereo());
FX_SetVolume(FXVolume);
snd_reversestereo.Callback();
snd_fxvolume.Callback();
FX_SetCallBack(SoundCallback);
}
@ -462,7 +443,7 @@ void InitMusicDevice(void)
initprintf("InitMusicDevice: %s\n", MUSIC_ErrorString(nStatus));
return;
}
MUSIC_SetVolume(MusicVolume);
MUSIC_SetVolume(mus_volume);
}
void DeinitMusicDevice(void)

View file

@ -43,19 +43,6 @@ struct SFX
char rawName[9];
};
extern int32_t SoundToggle;
extern int32_t MusicToggle;
extern int32_t CDAudioToggle;
extern int32_t FXVolume;
extern int32_t MusicVolume;
extern int32_t CDVolume;
extern int32_t NumVoices;
extern int32_t NumChannels;
extern int32_t NumBits;
extern int32_t MixRate;
extern int32_t ReverseStereo;
extern int32_t MusicDevice;
int sndGetRate(int format);
int sndPlaySong(const char *songName, bool bLoop);
bool sndIsSongPlaying(void);

View file

@ -1,5 +1,6 @@
#include "c_cvars.h"
#include "common.h"
#include "fx_man.h"
/* Notes
@ -35,16 +36,13 @@ CUSTOM_CVARD(Int, cl_autovote, 0, CVAR_ARCHIVE, "enable/disable automatic voting
if (self < 0 || self > 2) self = 0;
}
bool G_CheckAutorun(bool button)
{
if (cl_runmode) return button || cl_autorun;
else return button ^ !!cl_autorun;
}
// Demos
CVARD_NAMED(Bool, demorec_diffcompress, demorec_diffcompress_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "Compression for diffs")
CVARD_NAMED(Bool, demorec_synccompress, demorec_synccompress_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "Compression for input")
@ -55,6 +53,57 @@ CVARD_NAMED(Int, demorec_difftics, demorec_difftics_cvar, 60, CVAR_ARCHIVE|CVAR_
CVARD(Bool, demoplay_diffs, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable application of diffs in demo playback")
CVARD(Bool, demoplay_showsync, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable display of sync status")
// Sound
CVARD(Bool, snd_ambience, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disables ambient sounds") // Not implemented for Blood
CVARD(Bool, snd_enabled, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disables sound effects")
CVARD(Bool, snd_tryformats, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disables automatic discovery of replacement sounds and music in .flac and .ogg formats")
CVARD(Bool, snd_doppler, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable 3d sound")
CVARD(Bool, mus_enabled, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disables music")
CVARD(Bool, mus_restartonload, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "restart the music when loading a saved game with the same map or not") // only implemented for Blood - todo: generalize
CVARD(Bool, mus_redbook, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disables redbook audio (Blood only!)") // only Blood has assets for this.
CUSTOM_CVARD(Bool, snd_reversestereo, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL, "reverses the stereo channels")
{
FX_SetReverseStereo(self);
}
CUSTOM_CVARD(Int, snd_fxvolume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls volume for sound effects")
{
if (self < 0) self = 0;
if (self > 255) self = 255;
}
CUSTOM_CVARD(Int, snd_mixrate, 44100, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "sound mixing rate")
{
if (self < 11025) self = 11025;
else if (self > 48000) self = 48000;
}
CUSTOM_CVARD(Int, snd_numchannels, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "the number of sound channels")
{
if (self < 1) self = 1;
else if (self > 2) self = 2;
}
CUSTOM_CVARD(Int, snd_numvoices, 64, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "the number of concurrent sounds")
{
if (self < 8) self = 8;
else if (self > 128) self = 128;
}
CUSTOM_CVARD(Int, snd_speech, 5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disables player speech")
{
if (self < 8) self = 0;
else if (self > 5) self = 5;
}
CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls music volume")
{
if (self < 0) self = 0;
if (self > 255) self = 255;
}
#if 0
@ -100,8 +149,6 @@ CVARD(Bool, demoplay_showsync, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/dis
{ "in_mousemode", "toggles vertical mouse view", (void *)&g_myAimMode, CVAR_BOOL, 0, 1 },
{ "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&ud.config.SmoothInput, CVAR_BOOL, 0, 1 },
{ "mus_volume", "controls music volume", (void *)&ud.config.MusicVolume, CVAR_INT, 0, 255 },
{ "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 },
{ "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
{ "r_showfps", "show the frame rate counter", (void *)&ud.showfps, CVAR_INT, 0, 3 },
@ -120,15 +167,6 @@ CVARD(Bool, demoplay_showsync, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/dis
{ "skill","changes the game skill setting", (void *)&ud.m_player_skill, CVAR_INT|CVAR_FUNCPTR|CVAR_NOSAVE/*|CVAR_NOMULTI*/, 0, 5 },
{ "snd_ambience", "enables/disables ambient sounds", (void *)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 1 },
{ "snd_enabled", "enables/disables sound effects", (void *)&ud.config.SoundToggle, CVAR_BOOL, 0, 1 },
{ "snd_fxvolume", "controls volume for sound effects", (void *)&ud.config.FXVolume, CVAR_INT, 0, 255 },
{ "snd_mixrate", "sound mixing rate", (void *)&ud.config.MixRate, CVAR_INT, 0, 48000 },
{ "snd_numchannels", "the number of sound channels", (void *)&ud.config.NumChannels, CVAR_INT, 0, 2 },
{ "snd_numvoices", "the number of concurrent sounds", (void *)&ud.config.NumVoices, CVAR_INT, 1, 128 },
{ "snd_reversestereo", "reverses the stereo channels", (void *)&ud.config.ReverseStereo, CVAR_BOOL, 0, 1 },
{ "snd_speech", "enables/disables player speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 },
{ "snd_tryformats", "enables/disables automatic discovery of replacement sounds and music in .flac and .ogg formats", (void *)&g_maybeUpgradeSoundFormats, CVAR_BOOL, 0, 1 },
{ "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 },
{ "vid_gamma","adjusts gamma component of gamma ramp",(void *)&g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
@ -195,9 +233,6 @@ CVARD(Bool, demoplay_showsync, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/dis
{ "in_mousemode", "toggles vertical mouse view", (void *)&g_myAimMode, CVAR_BOOL, 0, 1 },
{ "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&ud.config.SmoothInput, CVAR_BOOL, 0, 1 },
{ "mus_enabled", "enables/disables music", (void *)&ud.config.MusicToggle, CVAR_BOOL, 0, 1 },
{ "mus_volume", "controls music volume", (void *)&ud.config.MusicVolume, CVAR_INT, 0, 255 },
{ "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 },
{ "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
{ "r_showfps", "show the frame rate counter", (void *)&ud.showfps, CVAR_INT, 0, 3 },
@ -216,15 +251,6 @@ CVARD(Bool, demoplay_showsync, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/dis
{ "skill","changes the game skill setting", (void *)&ud.m_player_skill, CVAR_INT|CVAR_FUNCPTR|CVAR_NOSAVE/*|CVAR_NOMULTI*/, 0, 5 },
{ "snd_ambience", "enables/disables ambient sounds", (void *)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 1 },
{ "snd_enabled", "enables/disables sound effects", (void *)&ud.config.SoundToggle, CVAR_BOOL, 0, 1 },
{ "snd_fxvolume", "controls volume for sound effects", (void *)&ud.config.FXVolume, CVAR_INT, 0, 255 },
{ "snd_mixrate", "sound mixing rate", (void *)&ud.config.MixRate, CVAR_INT, 0, 48000 },
{ "snd_numchannels", "the number of sound channels", (void *)&ud.config.NumChannels, CVAR_INT, 0, 2 },
{ "snd_numvoices", "the number of concurrent sounds", (void *)&ud.config.NumVoices, CVAR_INT, 1, 128 },
{ "snd_reversestereo", "reverses the stereo channels", (void *)&ud.config.ReverseStereo, CVAR_BOOL, 0, 1 },
{ "snd_speech", "enables/disables player speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 },
{ "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 },
{ "vid_gamma","adjusts gamma component of gamma ramp",(void *)&g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
@ -303,12 +329,6 @@ int32_t registerosdcommands(void)
{ "in_mousemode", "toggles vertical mouse view", (void *)&gMouseAim, CVAR_BOOL, 0, 1 },
{ "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&SmoothInput, CVAR_BOOL, 0, 1 },
//
{ "mus_enabled", "enables/disables music", (void *)&MusicToggle, CVAR_BOOL, 0, 1 },
{ "mus_restartonload", "restart the music when loading a saved game with the same map or not", (void *)&MusicRestartsOnLoadToggle, CVAR_BOOL, 0, 1 },
{ "mus_volume", "controls music volume", (void *)&MusicVolume, CVAR_INT, 0, 255 },
{ "mus_device", "music device", (void *)&MusicDevice, CVAR_INT, 0, 1 },
{ "mus_redbook", "enables/disables redbook audio", (void *)&CDAudioToggle, CVAR_BOOL, 0, 1 },
// { "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 },
// { "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
{ "r_showfps", "show the frame rate counter", (void *)&gShowFps, CVAR_INT, 0, 3 },
@ -327,16 +347,6 @@ int32_t registerosdcommands(void)
//
// { "skill","changes the game skill setting", (void *)&ud.m_player_skill, CVAR_INT|CVAR_FUNCPTR|CVAR_NOSAVE/*|CVAR_NOMULTI*/, 0, 5 },
//
// { "snd_ambience", "enables/disables ambient sounds", (void *)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 1 },
{ "snd_enabled", "enables/disables sound effects", (void *)&SoundToggle, CVAR_BOOL, 0, 1 },
{ "snd_fxvolume", "controls volume for sound effects", (void *)&FXVolume, CVAR_INT, 0, 255 },
{ "snd_mixrate", "sound mixing rate", (void *)&MixRate, CVAR_INT, 0, 48000 },
{ "snd_numchannels", "the number of sound channels", (void *)&NumChannels, CVAR_INT, 0, 2 },
{ "snd_numvoices", "the number of concurrent sounds", (void *)&NumVoices, CVAR_INT, 1, 128 },
{ "snd_reversestereo", "reverses the stereo channels", (void *)&ReverseStereo, CVAR_BOOL, 0, 1 },
{ "snd_doppler", "enable/disable 3d sound", (void *)&gDoppler, CVAR_BOOL, 0, 1 },
// { "snd_speech", "enables/disables player speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 },
// { "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 },
{ "vid_gamma","adjusts gamma component of gamma ramp",(void *)&g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
{ "vid_contrast","adjusts contrast component of gamma ramp",(void *)&g_videoContrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },

View file

@ -25,4 +25,19 @@ EXTERN_CVAR(Bool, demorec_diffs_cvar)
EXTERN_CVAR(Bool, demorec_force_cvar)
EXTERN_CVAR(Int, demorec_difftics_cvar)
EXTERN_CVAR(Bool, snd_ambience)
EXTERN_CVAR(Bool, snd_enabled)
EXTERN_CVAR(Bool, snd_tryformats)
EXTERN_CVAR(Bool, snd_doppler)
EXTERN_CVAR(Bool, mus_enabled)
EXTERN_CVAR(Bool, mus_restartonload)
EXTERN_CVAR(Bool, mus_redbook)
EXTERN_CVAR(Bool, snd_reversestereo)
EXTERN_CVAR(Int, snd_fxvolume)
EXTERN_CVAR(Int, snd_mixrate)
EXTERN_CVAR(Int, snd_numchannels)
EXTERN_CVAR(Int, snd_numvoices)
EXTERN_CVAR(Int, snd_speech)
EXTERN_CVAR(Int, mus_volume)
bool G_CheckAutorun(bool button);

View file

@ -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) != ud.config.SoundToggle)
if (T2(spriteNum) != snd_enabled)
{
// If sound playback was toggled, restart.
T2(spriteNum) = ud.config.SoundToggle;
T2(spriteNum) = snd_enabled;
T1(spriteNum) = 0;
}
@ -1490,7 +1490,7 @@ ACTOR_STATIC void G_MoveFX(void)
}
}
else if (pSprite->lotag < 999 && (unsigned)sector[pSprite->sectnum].lotag < 9 && // ST_9_SLIDING_ST_DOOR
ud.config.AmbienceToggle && sector[SECT(spriteNum)].floorz != sector[SECT(spriteNum)].ceilingz)
snd_ambience && sector[SECT(spriteNum)].floorz != sector[SECT(spriteNum)].ceilingz)
{
if (g_sounds[pSprite->lotag].m & SF_MSFX)
{
@ -1510,7 +1510,7 @@ ACTOR_STATIC void G_MoveFX(void)
// Start playing an ambience sound.
char om = g_sounds[pSprite->lotag].m;
if (g_numEnvSoundsPlaying == ud.config.NumVoices)
if (g_numEnvSoundsPlaying == snd_numvoices)
{
int32_t j;

View file

@ -1050,7 +1050,6 @@ void G_LoadLookups(void)
//////////
#ifdef FORMAT_UPGRADE_ELIGIBLE
int g_maybeUpgradeSoundFormats = 1;
static FileReader S_TryFormats(char * const testfn, char * const fn_suffix, char const searchfirst)
{
@ -1108,6 +1107,8 @@ static FileReader S_TryExtensionReplacements(char * const testfn, char const sea
FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic)
{
auto origfp = kopenFileReader(fn, searchfirst);
if (!snd_tryformats) return origfp;
char const* const origparent = origfp.isOpen() ? kfileparent(origfp) : NULL;
uint32_t const parentlength = origparent != NULL ? Bstrlen(origparent) : 0;

View file

@ -138,7 +138,6 @@ extern void G_LoadLookups(void);
//////////
# define FORMAT_UPGRADE_ELIGIBLE
extern int g_maybeUpgradeSoundFormats;
extern FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t ismusic);
void G_AddGroup(const char* buffer);

View file

@ -224,19 +224,9 @@ void CONFIG_SetDefaults(void)
ud.setup.bpp = 8;
#endif
#if defined(_WIN32)
ud.config.MixRate = 44100;
#elif defined __ANDROID__
ud.config.MixRate = droidinfo.audio_sample_rate;
#else
ud.config.MixRate = 48000;
#endif
#if defined GEKKO || defined __OPENDINGUX__
ud.config.NumVoices = 32;
ud.camera_time = 11;
#else
ud.config.NumVoices = 64;
ud.camera_time = 4;
#endif
@ -257,20 +247,11 @@ void CONFIG_SetDefaults(void)
ud.brightness = 8;
ud.camerasprite = -1;
ud.color = 0;
ud.config.AmbienceToggle = 1;
ud.config.CheckForUpdates = 1;
ud.config.FXVolume = 255;
ud.config.MouseBias = 0;
ud.config.MouseDeadZone = 0;
ud.config.MusicToggle = 1;
ud.config.MusicVolume = 195;
ud.config.NumBits = 16;
ud.config.NumChannels = 2;
ud.config.ReverseStereo = 0;
ud.config.ShowWeapons = 0;
ud.config.SmoothInput = 1;
ud.config.SoundToggle = 1;
ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
ud.config.useprecache = 1;
ud.configversion = 0;
ud.crosshairscale = 50;

View file

@ -63,12 +63,13 @@ static void Demo_RestoreModes(int32_t menu)
g_player[myconnectindex].ps->gm |= MODE_DEMO;
}
// This is utterly gross. Global configuration should not be manipulated like this.
void Demo_PrepareWarp(void)
{
if (!g_demo_paused)
{
g_demo_soundToggle = ud.config.SoundToggle;
ud.config.SoundToggle = 0;
g_demo_soundToggle = snd_enabled;
snd_enabled = 0;
}
FX_StopAllSounds();
@ -401,8 +402,8 @@ static void Demo_SetupProfile(void)
{
g_demo_profile *= -1; // now >0: profile for real
g_demo_soundToggle = ud.config.SoundToggle;
ud.config.SoundToggle = 0; // restored by Demo_FinishProfile()
g_demo_soundToggle = snd_enabled;
snd_enabled = 0; // restored by Demo_FinishProfile()
Bmemset(&g_prof, 0, sizeof(g_prof));
@ -418,7 +419,7 @@ static void Demo_FinishProfile(void)
double gms=g_prof.totalgamems;
double dms1=g_prof.totalroomsdrawms, dms2=g_prof.totalrestdrawms;
ud.config.SoundToggle = g_demo_soundToggle;
snd_enabled = g_demo_soundToggle;
if (nt > 0)
{
@ -687,7 +688,7 @@ nextdemo_nomenu:
if (g_demo_goalCnt>0)
{
g_demo_goalCnt=0;
ud.config.SoundToggle = g_demo_soundToggle;
snd_enabled = g_demo_soundToggle;
}
if (Demo_IsProfiling()) // don't reset g_demo_profile if it's < 0
@ -729,10 +730,10 @@ nextdemo_nomenu:
}
else
{
int32_t k = ud.config.SoundToggle;
ud.config.SoundToggle = 0;
int32_t k = snd_enabled;
snd_enabled = 0;
G_DoMoveThings();
ud.config.SoundToggle = k;
snd_enabled = k;
}
ototalclock += TICSPERFRAME;
@ -747,7 +748,7 @@ nextdemo_nomenu:
if (g_demo_cnt>=g_demo_goalCnt)
{
g_demo_goalCnt = 0;
ud.config.SoundToggle = g_demo_soundToggle;
snd_enabled = g_demo_soundToggle;
}
}
}

View file

@ -4499,8 +4499,8 @@ static int32_t g_RTSPlaying;
// Returns: started playing?
extern int G_StartRTS(int lumpNum, int localPlayer)
{
if (!ud.lockout && ud.config.SoundToggle &&
RTS_IsInitialized() && g_RTSPlaying == 0 && (ud.config.VoiceToggle & (localPlayer ? 1 : 4)))
if (!ud.lockout && snd_enabled &&
RTS_IsInitialized() && g_RTSPlaying == 0 && (snd_speech & (localPlayer ? 1 : 4)))
{
char *const pData = (char *)RTS_GetSound(lumpNum - 1);
@ -4900,7 +4900,7 @@ FAKE_F3:
Menu_Change(MENU_SOUND_INGAME);
}
if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicToggle)
if (KB_UnBoundKeyPressed(sc_F5) && mus_enabled)
{
map_t *const pMapInfo = &g_mapInfo[g_musicIndex];
char *const musicString = apStrings[QUOTE_MUSIC];
@ -6056,8 +6056,9 @@ static void G_Startup(void)
#endif
if (g_netServer || ud.multimode > 1) G_CheckGametype();
if (g_noSound) ud.config.SoundToggle = 0;
if (g_noMusic) ud.config.MusicToggle = 0;
//errr... what??? Why does this clobber the user setting? Well, it needs to be redone anyway, preferably at a lower level.
//if (g_noSound) snd_enabled = 0;
//if (g_noMusic) mus_enabled = 0;
if (CommandName)
{

View file

@ -241,24 +241,6 @@ typedef struct {
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
//
// Sound variables
//
int32_t FXVolume;
int32_t MusicVolume;
int32_t SoundToggle;
int32_t MusicToggle;
int32_t VoiceToggle;
int32_t AmbienceToggle;
int32_t NumVoices;
int32_t NumChannels;
int32_t NumBits;
int32_t MixRate;
int32_t ReverseStereo;
int32_t scripthandle;
int32_t setupread;

View file

@ -1475,7 +1475,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2)
case USERDEFS_M_ORIGIN_X: labelNum = ud.returnvar[0]; break;
case USERDEFS_M_ORIGIN_Y: labelNum = ud.returnvar[1]; break;
case USERDEFS_PLAYERBEST: labelNum = ud.playerbest; break;
case USERDEFS_MUSICTOGGLE: labelNum = ud.config.MusicToggle; break;
case USERDEFS_MUSICTOGGLE: labelNum = mus_enabled; break;
case USERDEFS_USEVOXELS: labelNum = usevoxels; break;
case USERDEFS_USEHIGHTILE:
#ifdef USE_OPENGL
@ -1494,7 +1494,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 = ud.config.SoundToggle; break;
case USERDEFS_SOUNDTOGGLE: labelNum = snd_enabled; 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;

View file

@ -1141,18 +1141,18 @@ static MenuEntry_t *ME_SAVE;
static MenuEntry_t **MEL_SAVE;
static int32_t soundrate, soundvoices;
static MenuOption_t MEO_SOUND = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.config.SoundToggle );
static MenuOption_t MEO_SOUND = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &snd_enabled.Value );
static MenuEntry_t ME_SOUND = MAKE_MENUENTRY( "Sound:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND, Option );
static MenuOption_t MEO_SOUND_MUSIC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.config.MusicToggle );
static MenuOption_t MEO_SOUND_MUSIC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, mus_enabled.Value );
static MenuEntry_t ME_SOUND_MUSIC = MAKE_MENUENTRY( "Music:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND_MUSIC, Option );
static char const s_Volume[] = "Volume:";
static MenuRangeInt32_t MEO_SOUND_VOLUME_FX = MAKE_MENURANGE( &ud.config.FXVolume, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_FX = MAKE_MENURANGE( &snd_fxvolume.Value, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuEntry_t ME_SOUND_VOLUME_FX = MAKE_MENUENTRY( s_Volume, &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SOUND_VOLUME_FX, RangeInt32 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_MUSIC = MAKE_MENURANGE( &ud.config.MusicVolume, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_MUSIC = MAKE_MENURANGE( &mus_volume.Value, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuEntry_t ME_SOUND_VOLUME_MUSIC = MAKE_MENUENTRY( s_Volume, &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SOUND_VOLUME_MUSIC, RangeInt32 );
#ifndef EDUKE32_STANDALONE
@ -2119,15 +2119,15 @@ static void Menu_Pre(MenuID_t cm)
case MENU_SOUND:
case MENU_SOUND_INGAME:
case MENU_ADVSOUND:
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_FX, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_MUSIC, !ud.config.MusicToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_DUKETALK, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_SAMPLINGRATE, !ud.config.SoundToggle && !ud.config.MusicToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_FX, !snd_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_MUSIC, !mus_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_DUKETALK, !snd_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_SAMPLINGRATE, !snd_enabled && !mus_enabled);
#ifndef EDUKE32_SIMPLE_MENU
MenuEntry_DisableOnCondition(&ME_SOUND_NUMVOICES, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_NUMVOICES, !snd_enabled);
#endif
MenuEntry_DisableOnCondition(&ME_SOUND_RESTART, soundrate == ud.config.MixRate &&
soundvoices == ud.config.NumVoices);
MenuEntry_DisableOnCondition(&ME_SOUND_RESTART, soundrate == snd_mixrate &&
soundvoices == snd_numvoices);
break;
case MENU_SAVESETUP:
@ -3233,8 +3233,8 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
}
else if (entry == &ME_SOUND_RESTART)
{
ud.config.MixRate = soundrate;
ud.config.NumVoices = soundvoices;
snd_mixrate = soundrate;
snd_numvoices = soundvoices;
S_SoundShutdown();
S_MusicShutdown();
@ -3245,7 +3245,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
FX_StopAllSounds();
S_ClearSoundLocks();
if (ud.config.MusicToggle)
if (mus_enabled)
S_RestartMusic();
}
else if (entry == &ME_SAVESETUP_CLEANUP)
@ -3311,7 +3311,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
}
else if (entry == &ME_SOUND_MUSIC)
{
ud.config.MusicToggle = newOption;
mus_enabled = newOption;
if (newOption == 0)
S_PauseMusic(true);
@ -3322,7 +3322,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
}
}
else if (entry == &ME_SOUND_DUKETALK)
ud.config.VoiceToggle = (ud.config.VoiceToggle&~1) | newOption;
snd_speech = (snd_speech&~1) | newOption;
else if (entry == &ME_MOUSESETUP_SMOOTH)
CONTROL_SmoothMouse = ud.config.SmoothInput;
else if (entry == &ME_JOYSTICK_ENABLE)
@ -3620,7 +3620,7 @@ static int32_t Menu_EntryOptionSource(MenuEntry_t *entry, int32_t currentValue)
if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP)
return (ud.weaponswitch & 1) ? ((ud.weaponswitch & 4) ? 2 : 1) : 0;
else if (entry == &ME_SOUND_DUKETALK)
return ud.config.VoiceToggle & 1;
return snd_speech & 1;
else if (entry == &ME_NETOPTIONS_MONSTERS)
return (ud.m_monsters_off ? g_skillCnt : ud.m_player_skill);
@ -4263,8 +4263,8 @@ static void Menu_AboutToStartDisplaying(Menu_t * m)
break;
case MENU_ADVSOUND:
soundrate = ud.config.MixRate;
soundvoices = ud.config.NumVoices;
soundrate = snd_mixrate;
soundvoices = snd_numvoices;
break;
default:

View file

@ -381,7 +381,7 @@ static int osdcmd_restartsound(osdcmdptr_t UNUSED(parm))
FX_StopAllSounds();
S_ClearSoundLocks();
if (ud.config.MusicToggle)
if (mus_enabled)
S_RestartMusic();
return OSDCMD_OK;

View file

@ -1319,7 +1319,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
gameHandleEvents();
if (ud.skill_voice > 0 && ud.config.SoundToggle)
if (ud.skill_voice > 0 && snd_enabled)
{
while (FX_SoundActive(ud.skill_voice))
gameHandleEvents();

View file

@ -2450,7 +2450,7 @@ static void postloadplayer(int32_t savegamep)
else
S_ContinueLevelMusic();
if (ud.config.MusicToggle)
if (mus_enabled)
S_PauseMusic(false);
g_player[myconnectindex].ps->gm = MODE_GAME;
@ -2470,7 +2470,7 @@ static void postloadplayer(int32_t savegamep)
for (SPRITES_OF(STAT_FX, i))
if (sprite[i].picnum == MUSICANDSFX)
{
T2(i) = ud.config.SoundToggle;
T2(i) = snd_enabled;
T1(i) = 0;
}

View file

@ -2203,7 +2203,7 @@ void G_BonusScreen(int32_t bonusonly)
videoClearScreen(0);
G_DisplayMPResultsScreen();
if (ud.config.MusicToggle)
if (mus_enabled)
S_PlaySound(BONUSMUSIC);
videoNextPage();
@ -2244,7 +2244,7 @@ void G_BonusScreen(int32_t bonusonly)
gametext_center_shade(192, "Press any key or button to continue", quotepulseshade);
if (ud.config.MusicToggle)
if (mus_enabled)
S_PlaySound(BONUSMUSIC);
videoNextPage();

View file

@ -2605,7 +2605,7 @@ void P_HandleSharedKeys(int playerNum)
}
else
{
if (ud.config.MusicToggle) S_PauseMusic(false);
if (mus_enabled) S_PauseMusic(false);
S_PauseSounds(false);

View file

@ -66,14 +66,14 @@ void S_SoundStartup(void)
initprintf("Initializing sound... ");
if (FX_Init(ud.config.NumVoices, ud.config.NumChannels, ud.config.MixRate, initdata) != FX_Ok)
if (FX_Init(snd_numvoices, snd_numchannels, snd_mixrate, initdata) != FX_Ok)
{
initprintf("failed! %s\n", FX_ErrorString(FX_Error));
return;
}
initprintf("%d voices, %d channels, %d-bit %d Hz\n", ud.config.NumVoices, ud.config.NumChannels,
ud.config.NumBits, ud.config.MixRate);
initprintf("%d voices, %d channels, 16-bit %d Hz\n", snd_numvoices, snd_numchannels,
snd_mixrate);
for (int i = 0; i <= g_highestSoundIdx; ++i)
{
@ -90,10 +90,10 @@ void S_SoundStartup(void)
cacheAllSounds();
FX_SetVolume(ud.config.FXVolume);
S_MusicVolume(ud.config.MusicVolume);
snd_fxvolume.Callback();
S_MusicVolume(mus_volume);
FX_SetReverseStereo(ud.config.ReverseStereo);
snd_reversestereo.Callback();
FX_SetCallBack(S_Callback);
FX_SetPrintf(OSD_Printf);
mutex_init(&m_callback);
@ -117,7 +117,7 @@ void S_MusicStartup(void)
if (MUSIC_Init(0, 0) == MUSIC_Ok || MUSIC_Init(1, 0) == MUSIC_Ok)
{
MUSIC_SetVolume(ud.config.MusicVolume);
MUSIC_SetVolume(mus_volume);
return;
}
@ -206,7 +206,7 @@ void S_MenuSound(void)
static int S_PlayMusic(const char *fn)
{
if (!ud.config.MusicToggle)
if (!mus_enabled)
return 0;
if (fn == NULL)
@ -261,7 +261,7 @@ static int S_PlayMusic(const char *fn)
}
else
{
int MyMusicVoice = FX_Play(MyMusicPtr, MusicLen, 0, 0, 0, ud.config.MusicVolume, ud.config.MusicVolume, ud.config.MusicVolume,
int MyMusicVoice = FX_Play(MyMusicPtr, MusicLen, 0, 0, 0, mus_volume, mus_volume, mus_volume,
FX_MUSIC_PRIORITY, 1.f, MUSIC_ID);
if (MyMusicVoice <= FX_Ok)
@ -640,7 +640,7 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos)
{
int32_t j = VM_OnEventWithReturn(EVENT_SOUND, spriteNum, screenpeek, num);
if ((j == -1 && num != -1) || !ud.config.SoundToggle) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn)
if ((j == -1 && num != -1) || !snd_enabled) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn)
return -1;
int const sndNum = j;
@ -663,10 +663,10 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos)
{
if ((g_netServer || ud.multimode > 1) && PN(spriteNum) == APLAYER && P_Get(spriteNum) != screenpeek) // other player sound
{
if ((ud.config.VoiceToggle & 4) != 4)
if ((snd_speech & 4) != 4)
return -1;
}
else if ((ud.config.VoiceToggle & 1) != 1)
else if ((snd_speech & 1) != 1)
return -1;
// don't play if any Duke talk sounds are already playing
@ -780,7 +780,7 @@ int S_PlaySound(int num)
{
int sndnum = VM_OnEventWithReturn(EVENT_SOUND, g_player[screenpeek].ps->i, screenpeek, num);
if ((sndnum == -1 && num != -1) || !ud.config.SoundToggle) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn)
if ((sndnum == -1 && num != -1) || !snd_enabled) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn)
return -1;
num = sndnum;
@ -793,7 +793,7 @@ int S_PlaySound(int num)
return -1;
}
if ((!(ud.config.VoiceToggle & 1) && (snd.m & SF_TALK)) || ((snd.m & SF_ADULT) && ud.lockout) || !FX_VoiceAvailable(snd.pr))
if ((!(snd_speech & 1) && (snd.m & SF_TALK)) || ((snd.m & SF_ADULT) && ud.lockout) || !FX_VoiceAvailable(snd.pr))
return -1;
int const pitch = S_GetPitch(num);

View file

@ -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) != ud.config.SoundToggle)
if (T2(spriteNum) != snd_enabled)
{
// If sound playback was toggled, restart.
T2(spriteNum) = ud.config.SoundToggle;
T2(spriteNum) = snd_enabled;
T1(spriteNum) = 0;
}
@ -1357,7 +1357,7 @@ ACTOR_STATIC void G_MoveFX(void)
}
}
else if (pSprite->lotag < 999 && (unsigned)sector[pSprite->sectnum].lotag < 9 && // ST_9_SLIDING_ST_DOOR
ud.config.AmbienceToggle && sector[SECT(spriteNum)].floorz != sector[SECT(spriteNum)].ceilingz)
snd_ambience && sector[SECT(spriteNum)].floorz != sector[SECT(spriteNum)].ceilingz)
{
if (g_sounds[pSprite->lotag].m & SF_MSFX)
{
@ -1377,7 +1377,7 @@ ACTOR_STATIC void G_MoveFX(void)
// Start playing an ambience sound.
char om = g_sounds[pSprite->lotag].m;
if (g_numEnvSoundsPlaying == ud.config.NumVoices)
if (g_numEnvSoundsPlaying == snd_numvoices)
{
int32_t j;

View file

@ -212,31 +212,11 @@ void CONFIG_SetDefaults(void)
ud.setup.bpp = 8;
#endif
ud.config.useprecache = 1;
ud.config.AmbienceToggle = 1;
ud.config.FXVolume = 255;
#if defined(_WIN32)
ud.config.MixRate = 44100;
#elif defined __ANDROID__
ud.config.MixRate = droidinfo.audio_sample_rate;
#else
ud.config.MixRate = 48000;
#endif
ud.config.MouseBias = 0;
ud.config.MouseDeadZone = 0;
ud.config.MusicToggle = 1;
ud.config.MusicVolume = 195;
g_myAimMode = g_player[0].ps->aim_mode = 1;
ud.config.NumBits = 16;
ud.config.NumChannels = 2;
#if defined GEKKO || defined __OPENDINGUX__
ud.config.NumVoices = 32;
#else
ud.config.NumVoices = 64;
#endif
ud.config.ReverseStereo = 0;
ud.config.ShowOpponentWeapons = 0;
ud.config.SmoothInput = 1;
ud.config.SoundToggle = 1;
ud.althud = 1;
ud.automsg = 0;
ud.brightness = 8;
@ -286,7 +266,7 @@ void CONFIG_SetDefaults(void)
ud.setup.fullscreen = 1;
ud.setup.usemouse = 1;
ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
snd_speech = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
ud.display_bonus_screen = 1;
ud.show_level_text = 1;
ud.configversion = 0;

View file

@ -71,8 +71,8 @@ void Demo_PrepareWarp(void)
{
if (!g_demo_paused)
{
g_demo_soundToggle = ud.config.SoundToggle;
ud.config.SoundToggle = 0;
g_demo_soundToggle = snd_enabled;
snd_enabled = 0;
}
FX_StopAllSounds();
@ -405,8 +405,8 @@ static void Demo_SetupProfile(void)
{
g_demo_profile *= -1; // now >0: profile for real
g_demo_soundToggle = ud.config.SoundToggle;
ud.config.SoundToggle = 0; // restored by Demo_FinishProfile()
g_demo_soundToggle = snd_enabled;
snd_enabled = 0; // restored by Demo_FinishProfile()
Bmemset(&g_prof, 0, sizeof(g_prof));
@ -422,7 +422,7 @@ static void Demo_FinishProfile(void)
double gms=g_prof.totalgamems;
double dms1=g_prof.totalroomsdrawms, dms2=g_prof.totalrestdrawms;
ud.config.SoundToggle = g_demo_soundToggle;
snd_enabled = g_demo_soundToggle;
if (nt > 0)
{
@ -691,7 +691,7 @@ nextdemo_nomenu:
if (g_demo_goalCnt>0)
{
g_demo_goalCnt=0;
ud.config.SoundToggle = g_demo_soundToggle;
snd_enabled = g_demo_soundToggle;
}
if (Demo_IsProfiling()) // don't reset g_demo_profile if it's < 0
@ -735,10 +735,10 @@ nextdemo_nomenu:
}
else
{
int32_t k = ud.config.SoundToggle;
ud.config.SoundToggle = 0;
int32_t k = snd_enabled;
snd_enabled = 0;
G_DoMoveThings();
ud.config.SoundToggle = k;
snd_enabled = k;
}
ototalclock += TICSPERFRAME;
@ -753,7 +753,7 @@ nextdemo_nomenu:
if (g_demo_cnt>=g_demo_goalCnt)
{
g_demo_goalCnt = 0;
ud.config.SoundToggle = g_demo_soundToggle;
snd_enabled = g_demo_soundToggle;
}
}
}

View file

@ -6010,8 +6010,8 @@ static int32_t g_RTSPlaying;
// Returns: started playing?
extern int G_StartRTS(int lumpNum, int localPlayer)
{
if (!ud.lockout && ud.config.SoundToggle &&
RTS_IsInitialized() && g_RTSPlaying == 0 && (ud.config.VoiceToggle & (localPlayer ? 1 : 4)))
if (!ud.lockout && snd_enabled &&
RTS_IsInitialized() && g_RTSPlaying == 0 && (snd_speech & (localPlayer ? 1 : 4)))
{
char *const pData = (char *)RTS_GetSound(lumpNum - 1);
@ -6411,7 +6411,7 @@ FAKE_F3:
Menu_Change(MENU_SOUND_INGAME);
}
if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicToggle)
if (KB_UnBoundKeyPressed(sc_F5) && mus_enabled)
{
map_t *const pMapInfo = &g_mapInfo[g_musicIndex];
char *const musicString = apStrings[QUOTE_MUSIC];
@ -7447,8 +7447,9 @@ static void G_Startup(void)
G_PostCreateGameState();
if (g_netServer || ud.multimode > 1) G_CheckGametype();
if (g_noSound) ud.config.SoundToggle = 0;
if (g_noMusic) ud.config.MusicToggle = 0;
//errr... what??? Why does this clobber the user setting? Well, it needs to be redone anyway, preferably at a lower level.
//if (g_noSound) snd_enabled = 0;
//if (g_noMusic) mus_enabled = 0;
if (CommandName)
{

View file

@ -215,24 +215,6 @@ typedef struct {
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
//
// Sound variables
//
int32_t FXVolume;
int32_t MusicVolume;
int32_t SoundToggle;
int32_t MusicToggle;
int32_t VoiceToggle;
int32_t AmbienceToggle;
int32_t NumVoices;
int32_t NumChannels;
int32_t NumBits;
int32_t MixRate;
int32_t ReverseStereo;
int32_t scripthandle;
int32_t setupread;

View file

@ -1099,19 +1099,19 @@ static MenuEntry_t *ME_SAVE;
static MenuEntry_t **MEL_SAVE;
static int32_t soundrate, soundvoices;
static MenuOption_t MEO_SOUND = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.config.SoundToggle );
static MenuOption_t MEO_SOUND = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &snd_enabled.Value );
static MenuEntry_t ME_SOUND = MAKE_MENUENTRY( "Sound:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND, Option );
static MenuOption_t MEO_SOUND_MUSIC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.config.MusicToggle );
static MenuOption_t MEO_SOUND_MUSIC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, mus_enabled.Value );
static MenuEntry_t ME_SOUND_MUSIC = MAKE_MENUENTRY( "Music:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND_MUSIC, Option );
static MenuLink_t MEO_SOUND_CDPLAYER = { MENU_CDPLAYER, MA_Advance, };
static MenuEntry_t ME_SOUND_CDPLAYER = MAKE_MENUENTRY( "8 Track Player", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND_CDPLAYER, Link );
static MenuRangeInt32_t MEO_SOUND_VOLUME_FX = MAKE_MENURANGE( &ud.config.FXVolume, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_FX = MAKE_MENURANGE( &snd_fxvolume.Value, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuEntry_t ME_SOUND_VOLUME_FX = MAKE_MENUENTRY( "Volume:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND_VOLUME_FX, RangeInt32 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_MUSIC = MAKE_MENURANGE( &ud.config.MusicVolume, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuRangeInt32_t MEO_SOUND_VOLUME_MUSIC = MAKE_MENURANGE( &mus_volume.Value, &MF_Redfont, 0, 255, 0, 33, 2 );
static MenuEntry_t ME_SOUND_VOLUME_MUSIC = MAKE_MENUENTRY( "Music:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SOUND_VOLUME_MUSIC, RangeInt32 );
static MenuOption_t MEO_SOUND_DUKETALK = MAKE_MENUOPTION(&MF_Redfont, &MEOS_NoYes, NULL);
@ -2055,15 +2055,15 @@ static void Menu_Pre(MenuID_t cm)
case MENU_SOUND:
case MENU_SOUND_INGAME:
case MENU_ADVSOUND:
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_FX, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_MUSIC, !ud.config.MusicToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_DUKETALK, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_SAMPLINGRATE, !ud.config.SoundToggle && !ud.config.MusicToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_FX, !snd_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_VOLUME_MUSIC, !mus_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_DUKETALK, !snd_enabled);
MenuEntry_DisableOnCondition(&ME_SOUND_SAMPLINGRATE, !snd_enabled && !mus_enabled);
#ifndef EDUKE32_SIMPLE_MENU
MenuEntry_DisableOnCondition(&ME_SOUND_NUMVOICES, !ud.config.SoundToggle);
MenuEntry_DisableOnCondition(&ME_SOUND_NUMVOICES, !snd_enabled);
#endif
MenuEntry_DisableOnCondition(&ME_SOUND_RESTART, soundrate == ud.config.MixRate &&
soundvoices == ud.config.NumVoices);
MenuEntry_DisableOnCondition(&ME_SOUND_RESTART, soundrate == snd_mixrate &&
soundvoices == snd_numvoices);
break;
case MENU_SAVESETUP:
@ -3625,8 +3625,8 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
}
else if (entry == &ME_SOUND_RESTART)
{
ud.config.MixRate = soundrate;
ud.config.NumVoices = soundvoices;
snd_mixrate = soundrate;
snd_numvoices = soundvoices;
S_SoundShutdown();
S_MusicShutdown();
@ -3637,7 +3637,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
FX_StopAllSounds();
S_ClearSoundLocks();
if (ud.config.MusicToggle)
if (mus_enabled)
S_RestartMusic();
}
else if (entry == &ME_SAVESETUP_CLEANUP)
@ -3714,7 +3714,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
}
else if (entry == &ME_SOUND_MUSIC || entry == &ME_CDPLAYER_TRACK)
{
ud.config.MusicToggle = newOption;
mus_enabled = newOption;
if (newOption == 0)
S_PauseMusic(true);
@ -3725,7 +3725,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
}
}
else if (entry == &ME_SOUND_DUKETALK)
ud.config.VoiceToggle = (ud.config.VoiceToggle&~1) | newOption;
snd_speech = (snd_speech&~1) | newOption;
else if (entry == &ME_MOUSESETUP_SMOOTH)
CONTROL_SmoothMouse = ud.config.SmoothInput;
else if (entry == &ME_JOYSTICKAXIS_ANALOG)
@ -4018,7 +4018,7 @@ static int32_t Menu_EntryOptionSource(MenuEntry_t *entry, int32_t currentValue)
if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP)
return (ud.weaponswitch & 1) ? ((ud.weaponswitch & 4) ? 2 : 1) : 0;
else if (entry == &ME_SOUND_DUKETALK)
return ud.config.VoiceToggle & 1;
return snd_speech & 1;
else if (entry == &ME_NETOPTIONS_MONSTERS)
return (ud.m_monsters_off ? g_skillCnt : ud.m_player_skill);
@ -4596,8 +4596,8 @@ static void Menu_AboutToStartDisplaying(Menu_t * m)
break;
case MENU_ADVSOUND:
soundrate = ud.config.MixRate;
soundvoices = ud.config.NumVoices;
soundrate = snd_mixrate;
soundvoices = snd_numvoices;
break;
default:
@ -5794,7 +5794,7 @@ static void M_RunMenu_CdPlayer(Menu_t *cm, MenuMenu_t *menu, const vec2_t origin
const int32_t mousex = origin.x+(x<<15)-(4<<16);
const int32_t mousey = origin.y+(y<<16)-(4<<16);
if (e == menu->currentEntry && ud.config.MusicToggle)
if (e == menu->currentEntry && mus_enabled)
rotatesprite_fs(origin.x+(x<<15), origin.y+(y<<16), 32768, 0, CDPLAYER+1, 16, 0, 10);
@ -5806,7 +5806,7 @@ static void M_RunMenu_CdPlayer(Menu_t *cm, MenuMenu_t *menu, const vec2_t origin
S_PlaySound(RR ? 341 : PISTOL_BODYHIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -5839,9 +5839,9 @@ static void M_RunMenu_CdPlayer(Menu_t *cm, MenuMenu_t *menu, const vec2_t origin
{
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED)
{
ud.config.MusicToggle = !ud.config.MusicToggle;
mus_enabled = !mus_enabled;
if (ud.config.MusicToggle == 0)
if (mus_enabled == 0)
S_PauseMusic(true);
else
{
@ -5853,7 +5853,7 @@ static void M_RunMenu_CdPlayer(Menu_t *cm, MenuMenu_t *menu, const vec2_t origin
}
}
if (ud.config.MusicToggle)
if (mus_enabled)
rotatesprite_fs(origin.x+((MENU_MARGIN_CENTER-60)<<16), origin.y+(113<<16), 32768, 0, CDPLAYER+3, 16, 0, 10);
else
rotatesprite_fs(origin.x+((MENU_MARGIN_CENTER-60)<<16), origin.y+(113<<16), 32768, 0, CDPLAYER+2, 16, 0, 10);
@ -7109,9 +7109,9 @@ static void Menu_RunInput(Menu_t *cm)
{
I_AdvanceTriggerClear();
ud.config.MusicToggle = !ud.config.MusicToggle;
mus_enabled = !mus_enabled;
if (ud.config.MusicToggle == 0)
if (mus_enabled == 0)
S_PauseMusic(true);
else
{
@ -7142,7 +7142,7 @@ static void Menu_RunInput(Menu_t *cm)
currentry = Menu_RunInput_Menu_Movement(menu, MM_Up);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7157,7 +7157,7 @@ static void Menu_RunInput(Menu_t *cm)
currentry = Menu_RunInput_Menu_Movement(menu, MM_Down);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7169,7 +7169,7 @@ static void Menu_RunInput(Menu_t *cm)
menu->currentEntry = 0;
S_PlaySound(RR ? 335 : KICK_HIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7181,7 +7181,7 @@ static void Menu_RunInput(Menu_t *cm)
menu->currentEntry = 1;
S_PlaySound(RR ? 335 : KICK_HIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7193,7 +7193,7 @@ static void Menu_RunInput(Menu_t *cm)
menu->currentEntry = 2;
S_PlaySound(RR ? 335 : KICK_HIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7205,7 +7205,7 @@ static void Menu_RunInput(Menu_t *cm)
menu->currentEntry = 3;
S_PlaySound(RR ? 335 : KICK_HIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7217,7 +7217,7 @@ static void Menu_RunInput(Menu_t *cm)
menu->currentEntry = 4;
S_PlaySound(RR ? 335 : KICK_HIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7229,7 +7229,7 @@ static void Menu_RunInput(Menu_t *cm)
menu->currentEntry = 5;
S_PlaySound(RR ? 335 : KICK_HIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7241,7 +7241,7 @@ static void Menu_RunInput(Menu_t *cm)
menu->currentEntry = 6;
S_PlaySound(RR ? 335 : KICK_HIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);
@ -7253,7 +7253,7 @@ static void Menu_RunInput(Menu_t *cm)
menu->currentEntry = 7;
S_PlaySound(RR ? 335 : KICK_HIT);
if (ud.config.MusicToggle)
if (mus_enabled)
{
S_StopMusic();
S_PlayRRMusic(2+menu->currentEntry);

View file

@ -376,7 +376,7 @@ static int osdcmd_restartsound(osdcmdptr_t UNUSED(parm))
FX_StopAllSounds();
S_ClearSoundLocks();
if (ud.config.MusicToggle)
if (mus_enabled)
S_RestartMusic();
return OSDCMD_OK;

View file

@ -1870,7 +1870,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
G_HandleAsync();
if (g_skillSoundVoice >= 0 && ud.config.SoundToggle)
if (g_skillSoundVoice >= 0 && snd_enabled)
{
while (FX_SoundActive(g_skillSoundVoice))
G_HandleAsync();

View file

@ -1881,7 +1881,7 @@ static void postloadplayer(int32_t savegamep)
S_PlayLevelMusicOrNothing(musicIdx);
}
if (ud.config.MusicToggle)
if (mus_enabled)
S_PauseMusic(false);
g_player[myconnectindex].ps->gm = MODE_GAME;
@ -1901,7 +1901,7 @@ static void postloadplayer(int32_t savegamep)
for (SPRITES_OF(STAT_FX, i))
if (sprite[i].picnum == MUSICANDSFX)
{
T2(i) = ud.config.SoundToggle;
T2(i) = snd_enabled;
T1(i) = 0;
}

View file

@ -2228,7 +2228,7 @@ void G_BonusScreen(int32_t bonusonly)
videoClearScreen(0);
G_DisplayMPResultsScreen();
if (ud.config.MusicToggle)
if (mus_enabled)
S_PlaySound(BONUSMUSIC);
videoNextPage();
@ -2272,7 +2272,7 @@ void G_BonusScreen(int32_t bonusonly)
gametext_center_shade(192, "Press any key or button to continue", quotepulseshade);
if (ud.config.MusicToggle)
if (mus_enabled)
S_PlaySound(BONUSMUSIC);
}
else
@ -2822,7 +2822,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
videoClearScreen(0);
G_DisplayMPResultsScreen();
if (ud.config.MusicToggle)
if (mus_enabled)
S_PlaySound(BONUSMUSIC);
videoNextPage();

View file

@ -3653,7 +3653,7 @@ void P_HandleSharedKeys(int playerNum)
}
else
{
if (ud.config.MusicToggle) S_PauseMusic(false);
if (mus_enabled) S_PauseMusic(false);
S_PauseSounds(false);

View file

@ -52,14 +52,14 @@ void S_SoundStartup(void)
initprintf("Initializing sound... ");
if (FX_Init(ud.config.NumVoices, ud.config.NumChannels, ud.config.MixRate, initdata) != FX_Ok)
if (FX_Init(snd_numvoices, snd_numchannels, snd_mixrate, initdata) != FX_Ok)
{
initprintf("failed! %s\n", FX_ErrorString(FX_Error));
return;
}
initprintf("%d voices, %d channels, %d-bit %d Hz\n", ud.config.NumVoices, ud.config.NumChannels,
ud.config.NumBits, ud.config.MixRate);
initprintf("%d voices, %d channels, 16-bit %d Hz\n", snd_numvoices, snd_numchannels,
snd_mixrate);
for (int i = 0; i <= g_highestSoundIdx; ++i)
{
@ -75,10 +75,10 @@ void S_SoundStartup(void)
S_PrecacheSounds();
FX_SetVolume(ud.config.FXVolume);
S_MusicVolume(ud.config.MusicVolume);
snd_fxvolume.Callback();
S_MusicVolume(mus_volume);
FX_SetReverseStereo(ud.config.ReverseStereo);
snd_reversestereo.Callback();
FX_SetCallBack(S_Callback);
FX_SetPrintf(initprintf);
}
@ -101,7 +101,7 @@ void S_MusicStartup(void)
if (MUSIC_Init(0, 0) == MUSIC_Ok || MUSIC_Init(1, 0) == MUSIC_Ok)
{
MUSIC_SetVolume(ud.config.MusicVolume);
MUSIC_SetVolume(mus_volume);
return;
}
@ -187,7 +187,7 @@ void S_MenuSound(void)
static int S_PlayMusic(const char *fn, int loop)
{
if (!ud.config.MusicToggle)
if (!mus_enabled)
return 0;
if (fn == NULL)
@ -242,7 +242,7 @@ static int S_PlayMusic(const char *fn, int loop)
}
else
{
int MyMusicVoice = FX_Play(MyMusicPtr, MusicLen, 0, 0, 0, ud.config.MusicVolume, ud.config.MusicVolume, ud.config.MusicVolume,
int MyMusicVoice = FX_Play(MyMusicPtr, MusicLen, 0, 0, 0, mus_volume, mus_volume, mus_volume,
FX_MUSIC_PRIORITY, 1.f, MUSIC_ID);
if (MyMusicVoice <= FX_Ok)
@ -603,7 +603,7 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos)
{
int32_t j;
if (!ud.config.SoundToggle) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn)
if (!snd_enabled) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn)
return -1;
int const sndNum = num;
@ -626,10 +626,10 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos)
{
if ((g_netServer || ud.multimode > 1) && PN(spriteNum) == APLAYER && P_Get(spriteNum) != screenpeek) // other player sound
{
if ((ud.config.VoiceToggle & 4) != 4)
if ((snd_speech & 4) != 4)
return -1;
}
else if ((ud.config.VoiceToggle & 1) != 1)
else if ((snd_speech & 1) != 1)
return -1;
// don't play if any Duke talk sounds are already playing
@ -742,7 +742,7 @@ int S_PlaySound(int num)
{
int sndnum;
if (!ud.config.SoundToggle) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn)
if (!snd_enabled) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn)
return -1;
sound_t & snd = g_sounds[num];
@ -753,7 +753,7 @@ int S_PlaySound(int num)
return -1;
}
if ((!(ud.config.VoiceToggle & 1) && (snd.m & SF_TALK)) || ((snd.m & SF_ADULT) && ud.lockout) || !FX_VoiceAvailable(snd.pr))
if ((!(snd_speech & 1) && (snd.m & SF_TALK)) || ((snd.m & SF_ADULT) && ud.lockout) || !FX_VoiceAvailable(snd.pr))
return -1;
int const pitch = S_GetPitch(num);

View file

@ -66,12 +66,7 @@ int32_t NumberPlayers,CommPort,PortSpeed,IrqNumber,UartAddress;
//
// Sound variables
//
int32_t FXDevice = 0;
int32_t MusicDevice = 0;
int32_t NumVoices = 32;
int32_t NumChannels = 2;
int32_t NumBits = 16;
int32_t MixRate = 44100;
int32_t UseMouse = 1, UseJoystick = 0;
@ -231,12 +226,6 @@ void CONFIG_SetDefaults(void)
}
ScreenBPP = 32;
FXDevice = 0;
MusicDevice = 0;
NumVoices = 32;
NumChannels = 2;
NumBits = 16;
MixRate = 44100;
memcpy(&gs, &gs_defaults, sizeof(gs));
Bstrcpy(RTSName, DEFAULTRTSFILE);
@ -591,46 +580,7 @@ int32_t CONFIG_ReadSetup(void)
if (scripthandle < 0) return -1;
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenMode",&ScreenMode);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenWidth",&ScreenWidth);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenHeight",&ScreenHeight);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenBPP", &ScreenBPP);
if (ScreenBPP < 8) ScreenBPP = 8;
#ifdef RENDERTYPEWIN
SCRIPT_GetNumber(scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
#endif
SCRIPT_GetNumber(scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy);
//SCRIPT_GetNumber(scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "FXDevice",&FXDevice);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "MusicDevice",&MusicDevice);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "FXVolume",&dummy);
gs.SoundVolume = dummy;
SCRIPT_GetNumber(scripthandle, "Sound Setup", "MusicVolume",&dummy);
gs.MusicVolume = dummy;
SCRIPT_GetNumber(scripthandle, "Sound Setup", "NumVoices",&NumVoices);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "NumChannels",&NumChannels);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "NumBits",&NumBits);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "MixRate",&MixRate);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "ReverseStereo",&dummy);
gs.FlipStereo = dummy;
if (gs.FlipStereo) gs.FlipStereo = 1;
SCRIPT_GetString(scripthandle, "Sound Setup", "WaveformTrackName", waveformtrackname);
if (waveformtrackname[0] != '\0')
memcpy(gs.WaveformTrackName, waveformtrackname, MAXWAVEFORMTRACKLENGTH);
SCRIPT_GetNumber(scripthandle, "Setup", "ForceSetup",&ForceSetup);
SCRIPT_GetNumber(scripthandle, "Controls","UseMouse",&UseMouse);
SCRIPT_GetNumber(scripthandle, "Controls","UseJoystick",&UseJoystick);
SCRIPT_GetString(scripthandle, "Comm Setup", "RTSName",RTSName);
SCRIPT_GetString(scripthandle, "Comm Setup","PlayerName",CommPlayerName);
// What was here is no longer needed with a globally stored config that's being read automatically.
ReadGameSetup(scripthandle);
CONFIG_ReadKeys(scripthandle);
@ -661,33 +611,8 @@ void CONFIG_WriteSetup(void)
if (scripthandle < 0)
scripthandle = SCRIPT_Init(setupfilename);
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenWidth", ScreenWidth,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenHeight",ScreenHeight,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenMode",ScreenMode,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenBPP",ScreenBPP,FALSE,FALSE);
#ifdef RENDERTYPEWIN
SCRIPT_PutNumber(scripthandle, "Screen Setup", "MaxRefreshFreq",maxrefreshfreq,FALSE,FALSE);
#endif
SCRIPT_PutNumber(scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,FALSE,FALSE);
//SCRIPT_PutNumber(scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,FALSE,FALSE);
// What was here is no longer needed with a globally stored config that's being written automatically.
SCRIPT_PutNumber(scripthandle, "Sound Setup", "FXDevice", FXDevice, FALSE, FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "MusicDevice", MusicDevice, FALSE, FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "NumVoices", NumVoices, FALSE, FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "NumChannels", NumChannels, FALSE, FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "NumBits", NumBits, FALSE, FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "MixRate", MixRate, FALSE, FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "FXVolume",gs.SoundVolume,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "MusicVolume",gs.MusicVolume,FALSE,FALSE);
dummy = gs.FlipStereo;
SCRIPT_PutNumber(scripthandle, "Sound Setup", "ReverseStereo",dummy,FALSE,FALSE);
SCRIPT_PutString(scripthandle, "Sound Setup", "WaveformTrackName", gs.WaveformTrackName);
SCRIPT_PutNumber(scripthandle, "Setup", "ForceSetup",ForceSetup,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Controls","UseMouse",UseMouse,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Controls","UseJoystick",UseJoystick,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Controls","MouseSensitivity",gs.MouseSpeed,FALSE,FALSE);
WriteGameSetup(scripthandle);

View file

@ -46,17 +46,6 @@ extern int32_t ScreenBufferMode;
extern int32_t VesaBufferMode;
extern int32_t ForceSetup;
// sound externs
extern int32_t FXDevice; // Sound FX Card number
extern int32_t MusicDevice; // Music Card number
extern int32_t FXVolume; // FX Volume
extern int32_t MusicVolume; // Music Volume
extern int32_t NumVoices; // Number of voices
extern int32_t NumChannels; // Number of channels
extern int32_t NumBits; // Number of bits
extern int32_t MixRate; // Mixing rate
extern int32_t MidiPort; // Midi Port
extern int32_t ReverseStereo; // Reverse Stereo Channels
// comm externs
extern int32_t ComPort;

View file

@ -2113,7 +2113,7 @@ MenuLevel(void)
DSPRINTF(ds,"MenuLevel...");
MONO_PRINT(ds);
if (gs.MusicOn)
if (mus_enabled)
{
PlaySong(NULL, RedBookSong[0], TRUE, FALSE);
}
@ -2527,7 +2527,7 @@ BonusScreen(PLAYERp pp)
totalclock = ototalclock = 0;
limit = synctics;
if (gs.MusicOn)
if (mus_enabled)
{
PlaySong(voc[DIGI_ENDLEV].name, 3, TRUE, TRUE);
}
@ -2845,7 +2845,7 @@ StatScreen(PLAYERp mpp)
KEY_PRESSED(KEYSC_SPACE) = 0;
KEY_PRESSED(KEYSC_ENTER) = 0;
if (gs.MusicOn)
if (mus_enabled)
{
PlaySong(voc[DIGI_ENDLEV].name, 3, TRUE, TRUE);
}
@ -3075,7 +3075,7 @@ void InitRunLevel(void)
extern int PlayClock;
LoadGameOutsideMoveLoop = FALSE;
// contains what is needed from calls below
if (gs.Ambient)
if (snd_ambience)
StartAmbientSound();
SetCrosshair();
PlaySong(LevelSong, -1, TRUE, TRUE);
@ -3145,8 +3145,10 @@ void InitRunLevel(void)
SetRedrawScreen(Player + myconnectindex);
snd_reversestereo.Callback();
snd_fxvolume.Callback();
FX_SetVolume(gs.SoundVolume); // Turn volume back up
if (gs.Ambient)
if (snd_ambience)
StartAmbientSound();
}
@ -3157,7 +3159,7 @@ RunLevel(void)
InitRunLevel();
FX_SetVolume(gs.SoundVolume);
SetSongVolume(gs.MusicVolume);
SetSongVolume(mus_volume);
#if 0
waitforeverybody();

View file

@ -2196,7 +2196,7 @@ MNU_InitMenus(void)
slidersettings[sldr_mouse] = gs.MouseSpeed/(MOUSE_SENS_MAX_VALUE/SLDR_MOUSESENSEMAX);
slidersettings[sldr_sndfxvolume] = gs.SoundVolume / (FX_VOL_MAX_VALUE/SLDR_SNDFXVOLMAX);
slidersettings[sldr_musicvolume] = gs.MusicVolume / (MUSIC_VOL_MAX_VALUE/SLDR_MUSICVOLMAX);
slidersettings[sldr_musicvolume] = mus_volume / (MUSIC_VOL_MAX_VALUE/SLDR_MUSICVOLMAX);
slidersettings[sldr_scrsize] = gs.BorderNum;
slidersettings[sldr_brightness] = gs.Brightness;
slidersettings[sldr_bordertile] = gs.BorderTile;
@ -2227,14 +2227,14 @@ MNU_InitMenus(void)
buttonsettings[btn_mouse_aim] = gs.MouseAimingType;
buttonsettings[btn_mouse_invert] = gs.MouseInvert;
buttonsettings[btn_sound] = gs.FxOn;
buttonsettings[btn_music] = gs.MusicOn;
buttonsettings[btn_talking] = gs.Talking;
buttonsettings[btn_sound] = snd_enabled;
buttonsettings[btn_music] = mus_enabled;
buttonsettings[btn_talking] = snd_speech;
buttonsettings[btn_voxels] = gs.Voxels;
buttonsettings[btn_ambience] = gs.Ambient;
buttonsettings[btn_ambience] = snd_ambience;
buttonsettings[btn_playcd] = gs.PlayCD;
buttonsettings[btn_flipstereo] = gs.FlipStereo;
buttonsettings[btn_flipstereo] = snd_reversestereo;
buttonsettings[btn_stats] = gs.Stats;
slidersettings[sldr_gametype] = gs.NetGameType;
@ -3285,62 +3285,22 @@ MNU_TryMusicInit(void)
SWBOOL
MNU_MusicCheck(MenuItem *item)
{
if (SW_SHAREWARE)
{
if (MusicDevice < 0 || !MusicInitialized)
{
SET(item->flags, mf_disabled);
}
else
{
RESET(item->flags, mf_disabled);
}
}
else
{
// Redbook audio stuff
//JBF
//if (!cdvalid)
// {
// SET(item->flags, mf_disabled); // Just don't let CD Redbook ever be invalid!
// }
//else
{
RESET(item->flags, mf_disabled);
}
}
return TRUE;
}
SWBOOL
MNU_FxCheck(MenuItem *item)
{
if (FXDevice < 0 || !FxInitialized)
{
SET(item->flags, mf_disabled);
}
else
{
RESET(item->flags, mf_disabled);
}
return TRUE;
}
SWBOOL
MNU_MusicFxCheck(MenuItem *item)
{
if (FXDevice < 0 && MusicDevice < 0)
{
SET(item->flags, mf_disabled);
}
else
{
RESET(item->flags, mf_disabled);
}
return TRUE;
}
@ -3432,22 +3392,22 @@ MNU_DoButton(MenuItem_p item, SWBOOL draw)
if (!FxInitialized)
break;
last_value = gs.FxOn;
gs.FxOn = state = buttonsettings[item->button];
if (gs.FxOn != last_value)
last_value = snd_enabled;
snd_enabled = state = buttonsettings[item->button];
if (snd_enabled != last_value)
{
if (!gs.FxOn)
if (!snd_enabled)
StopFX();
}
break;
case btn_music:
last_value = gs.MusicOn;
gs.MusicOn = state = buttonsettings[item->button];
if (gs.MusicOn != last_value)
last_value = mus_enabled;
mus_enabled = state = buttonsettings[item->button];
if (mus_enabled != last_value)
{
SWBOOL bak;
if (gs.MusicOn)
if (mus_enabled)
{
bak = DemoMode;
PlaySong(LevelSong, RedBookSong[Level], TRUE, TRUE);
@ -3471,20 +3431,20 @@ MNU_DoButton(MenuItem_p item, SWBOOL draw)
}
break;
case btn_talking:
gs.Talking = state = buttonsettings[item->button];
snd_speech = state = buttonsettings[item->button];
break;
case btn_playcd:
last_value = gs.PlayCD;
gs.PlayCD = state = buttonsettings[item->button];
break;
case btn_ambience:
last_value = gs.Ambient;
gs.Ambient = state = buttonsettings[item->button];
if (gs.Ambient != last_value)
last_value = snd_ambience;
snd_ambience = state = buttonsettings[item->button];
if (snd_ambience != last_value)
{
if (!InMenuLevel)
{
if (gs.Ambient)
if (snd_ambience)
StartAmbientSound();
else
StopAmbientSound();
@ -3492,10 +3452,8 @@ MNU_DoButton(MenuItem_p item, SWBOOL draw)
}
break;
case btn_flipstereo:
last_value = gs.FlipStereo;
gs.FlipStereo = state = buttonsettings[item->button];
if (gs.FlipStereo != last_value)
FlipStereo();
last_value = snd_reversestereo;
snd_reversestereo = state = buttonsettings[item->button];
break;
case btn_shadows:
gs.Shadows = state = buttonsettings[item->button];
@ -3685,8 +3643,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
offset = min(offset, short(SLDR_MUSICVOLMAX-1));
slidersettings[sldr_musicvolume] = offset;
gs.MusicVolume = MUSIC_MIN + (offset * VOL_MUL);
SetSongVolume(gs.MusicVolume);
mus_volume = MUSIC_MIN + (offset * VOL_MUL);
SetSongVolume(mus_volume);
break;
case sldr_scrsize:

View file

@ -1168,20 +1168,7 @@ int LoadGame(short save_num)
MREAD(palette,sizeof(palette),1,fil);
MREAD(palette_data,sizeof(palette_data),1,fil);
{
SWBOOL AmbBak = gs.Ambient;
SWBOOL MusicBak = gs.MusicOn;
SWBOOL FxBak = gs.FxOn;
short SndVolBak = gs.SoundVolume;
short MusVolBak = gs.MusicVolume;
MREAD(&gs,sizeof(gs),1,fil);
gs.MusicOn = MusicBak;
gs.FxOn = FxBak;
gs.Ambient = AmbBak;
gs.SoundVolume = SndVolBak;
gs.MusicVolume = MusVolBak;
}
//COVERsetbrightness(gs.Brightness,(char *)palette_data);
@ -1292,10 +1279,10 @@ int LoadGame(short save_num)
PlayingLevel = Level;
PlaySong(LevelSong, RedBookSong[Level], TRUE, TRUE);
if (gs.Ambient)
if (snd_ambience)
StartAmbientSound();
FX_SetVolume(gs.SoundVolume);
SetSongVolume(gs.MusicVolume);
SetSongVolume(mus_volume);
TRAVERSE_CONNECT(i)
{

View file

@ -818,7 +818,7 @@ int DoDeathSpecial(short SpriteNum)
DoMatchEverything(NULL, sp->lotag, ON);
if (!SW_SHAREWARE && gs.MusicOn && !alreadydid)
if (!SW_SHAREWARE && mus_enabled && !alreadydid)
{
PlaySong(0, RedBookSong[Level], TRUE, TRUE);
alreadydid = TRUE;

View file

@ -32,7 +32,7 @@ BEGIN_SW_NS
typedef struct
{
int MouseSpeed;
int MusicVolume;
int mus_volume;
int SoundVolume;
int8_t BorderNum;
int8_t Brightness;
@ -47,11 +47,6 @@ typedef struct
SWBOOL Crosshair;
SWBOOL AutoAim;
SWBOOL Messages;
SWBOOL FxOn;
SWBOOL MusicOn;
SWBOOL Talking;
SWBOOL Ambient;
SWBOOL FlipStereo;
// Net Options from Menus
uint8_t NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn]
uint8_t NetLevel; // 1-28

View file

@ -410,7 +410,7 @@ extern short Level;
SWBOOL
PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart)
{
if (!gs.MusicOn)
if (!mus_enabled)
{
return FALSE;
}
@ -553,7 +553,7 @@ StopSong(void)
void
PauseSong(SWBOOL pauseon)
{
if (!gs.MusicOn) return;
if (!mus_enabled) return;
if (SongType == SongTypeWave && SongVoice >= 0)
{
@ -818,7 +818,7 @@ PlaySound(int num, int *x, int *y, int *z, Voc3D_Flags flags)
if (Prediction)
return -1;
if (!gs.FxOn)
if (!snd_enabled)
return -1;
PRODUCTION_ASSERT(num >= 0 && num < DIGI_MAX);
@ -833,7 +833,7 @@ PlaySound(int num, int *x, int *y, int *z, Voc3D_Flags flags)
sp = &sprite[SoundSpriteNum];
}
if (gs.Ambient && TEST(flags,v3df_ambient) && !TEST(flags,v3df_nolookup)) // Look for invalid ambient numbers
if (snd_ambience && TEST(flags,v3df_ambient) && !TEST(flags,v3df_nolookup)) // Look for invalid ambient numbers
{
if (num < 0 || num > MAX_AMBIENT_SOUNDS)
{
@ -856,7 +856,7 @@ PlaySound(int num, int *x, int *y, int *z, Voc3D_Flags flags)
v3p->priority = 0;
v3p->FX_Ok = FALSE; // Hasn't played yet
if (gs.Ambient && TEST(flags,v3df_ambient) && !TEST(flags,v3df_nolookup))
if (snd_ambience && TEST(flags,v3df_ambient) && !TEST(flags,v3df_nolookup))
{
v3p->maxtics = STD_RANDOM_RANGE(ambarray[num].maxtics);
flags |= ambarray[num].ambient_flags; // Add to flags if any
@ -949,7 +949,7 @@ PlaySound(int num, int *x, int *y, int *z, Voc3D_Flags flags)
}
// Assign ambient priorities based on distance
if (gs.Ambient && TEST(flags, v3df_ambient))
if (snd_ambience && TEST(flags, v3df_ambient))
{
v3p->priority = v3p->vp->priority - (sound_dist / 26);
priority = v3p->priority;
@ -1047,7 +1047,7 @@ void PlaySoundRTS(int rts_num)
char *rtsptr;
int voice=-1;
if (!RTS_IsInitialized() || !gs.FxOn)
if (!RTS_IsInitialized() || !snd_enabled)
return;
rtsptr = (char *)RTS_GetSound(rts_num - 1);
@ -1117,39 +1117,25 @@ LoadSong(const char *filename)
return TRUE;
}
void FlipStereo(void)
{
FX_SetReverseStereo(gs.FlipStereo);
}
void
SoundStartup(void)
{
int32_t status;
void *initdata = 0;
// if they chose None lets return
if (FXDevice < 0)
{
gs.FxOn = FALSE;
return;
}
#ifdef MIXERTYPEWIN
initdata = (void *) win_gethwnd();
#endif
//gs.FxOn = TRUE;
//snd_enabled = TRUE;
status = FX_Init(NumVoices, NumChannels, MixRate, initdata);
status = FX_Init(snd_numvoices, snd_numchannels, snd_mixrate, initdata);
if (status == FX_Ok)
{
FxInitialized = TRUE;
FX_SetVolume(gs.SoundVolume);
if (gs.FlipStereo)
FX_SetReverseStereo(!FX_GetReverseStereo());
snd_fxvolume.Callback();
snd_reversestereo.Callback();
}
if (status != FX_Ok)
{
@ -1172,12 +1158,6 @@ SoundShutdown(void)
{
int32_t status;
// if they chose None lets return
if (FXDevice < 0)
{
return;
}
if (!FxInitialized)
return;
@ -1216,21 +1196,16 @@ void loadtmb(void)
void MusicStartup(void)
{
// if they chose None lets return
if (MusicDevice < 0)
{
gs.MusicOn = FALSE;
return;
}
if (MUSIC_Init(0, 0) == MUSIC_Ok || MUSIC_Init(1, 0) == MUSIC_Ok)
{
MusicInitialized = TRUE;
MUSIC_SetVolume(gs.MusicVolume);
MUSIC_SetVolume(mus_volume);
}
else
{
buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_ErrorCode));
gs.MusicOn = FALSE;
mus_enabled = FALSE;
}
#if 0
@ -1257,13 +1232,6 @@ MusicShutdown(void)
{
int32_t status;
// if they chose None lets return
if (MusicDevice < 0)
return;
if (!MusicInitialized)
return;
StopSong();
status = MUSIC_Shutdown();
@ -1580,7 +1548,7 @@ DoTimedSound(VOC3D_INFOp p)
// Sound was bumped from active sounds list, try to play again.
// Don't bother if voices are already maxed out.
if (FX_SoundsPlaying() < NumVoices)
if (FX_SoundsPlaying() < snd_numvoices)
{
if (p->flags & v3df_follow)
{
@ -1831,10 +1799,10 @@ DoUpdateSounds3D(void)
// again.
// Don't bother if voices are already maxed out.
// Sort looping vocs in order of priority and distance
//if (FX_SoundsPlaying() < NumVoices && dist <= 255)
//if (FX_SoundsPlaying() < snd_numvoices && dist <= 255)
if (dist <= 255)
{
for (i=0; i<min((int)SIZ(TmpVocArray), NumVoices); i++)
for (i=0; i<min((int)SIZ(TmpVocArray), snd_numvoices); i++)
{
if (p->priority >= TmpVocArray[i].priority)
{
@ -1862,13 +1830,13 @@ DoUpdateSounds3D(void)
// Only update these sounds 5x per second! Woo hoo!, aren't we optimized now?
//if(MoveSkip8==0)
// {
for (i=0; i<min((int)SIZ(TmpVocArray), NumVoices); i++)
for (i=0; i<min((int)SIZ(TmpVocArray), snd_numvoices); i++)
{
int handle;
p = TmpVocArray[i].p;
//if (FX_SoundsPlaying() >= NumVoices || !p) break;
//if (FX_SoundsPlaying() >= snd_numvoices || !p) break;
if (!p) break;
ASSERT(p->num >= 0 && p->num < DIGI_MAX);

View file

@ -86,7 +86,6 @@ void UnInitSound(void);
void InitFX(void);
void InitMusic(void);
void StopFX(void);
void FlipStereo(void);
void StopSong(void);
void PauseSong(SWBOOL pauseon);
void StopSound(void);

View file

@ -802,7 +802,7 @@ int DoSumoDeathMelt(short SpriteNum)
u->ID = 0;
DoMatchEverything(NULL, sp->lotag, ON);
if (!SW_SHAREWARE && gs.MusicOn && !alreadydid)
if (!SW_SHAREWARE && mus_enabled && !alreadydid)
{
PlaySong(0, RedBookSong[Level], TRUE, TRUE);
alreadydid = TRUE;
@ -881,7 +881,7 @@ BossHealthMeter(void)
if (i == 0 && !serpwasseen)
{
serpwasseen = TRUE;
if (!SW_SHAREWARE && gs.MusicOn)
if (!SW_SHAREWARE && mus_enabled)
{
PlaySong(0, 13, TRUE, TRUE);
}
@ -889,7 +889,7 @@ BossHealthMeter(void)
else if (i == 1 && !sumowasseen)
{
sumowasseen = TRUE;
if (!SW_SHAREWARE && gs.MusicOn)
if (!SW_SHAREWARE && mus_enabled)
{
PlaySong(0, 13, TRUE, TRUE);
}
@ -897,7 +897,7 @@ BossHealthMeter(void)
else if (i == 2 && !zillawasseen)
{
zillawasseen = TRUE;
if (!SW_SHAREWARE && gs.MusicOn)
if (!SW_SHAREWARE && mus_enabled)
{
PlaySong(0, 13, TRUE, TRUE);
}

View file

@ -166,19 +166,19 @@ void ReadGameSetup(int32_t scripthandle)
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "Talking",&dummy);
if (dummy != -1) gs.Talking = dummy;
if (dummy != -1) snd_speech = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "Ambient",&dummy);
if (dummy != -1) gs.Ambient = dummy;
if (dummy != -1) snd_ambience = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "FxOn",&dummy);
if (dummy != -1) gs.FxOn = dummy;
if (dummy != -1) snd_enabled = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "MusicOn",&dummy);
if (dummy != -1) gs.MusicOn = dummy;
if (dummy != -1) mus_enabled = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Controls", "MouseAiming",&dummy);
@ -296,16 +296,16 @@ void WriteGameSetup(int32_t scripthandle)
SCRIPT_PutNumber(scripthandle, "Options", "AutoAim",dummy,FALSE,FALSE);
dummy = gs.Messages;
SCRIPT_PutNumber(scripthandle, "Options", "Messages",dummy,FALSE,FALSE);
dummy = gs.Talking;
dummy = snd_speech;
SCRIPT_PutNumber(scripthandle, "Options", "Talking",dummy,FALSE,FALSE);
dummy = gs.Ambient;
dummy = snd_ambience;
SCRIPT_PutNumber(scripthandle, "Options", "Ambient",dummy,FALSE,FALSE);
dummy = gs.FxOn;
dummy = snd_enabled;
SCRIPT_PutNumber(scripthandle, "Options", "FxOn",dummy,FALSE,FALSE);
dummy = gs.MouseAimingType;
SCRIPT_PutNumber(scripthandle, "Controls", "MouseAiming",dummy,FALSE,FALSE);
dummy = gs.MusicOn;
dummy = mus_enabled;
SCRIPT_PutNumber(scripthandle, "Options", "MusicOn",dummy,FALSE,FALSE);
dummy = gs.NetGameType;

View file

@ -777,7 +777,7 @@ int DoZillaDeathMelt(short SpriteNum)
RESET(u->Flags, SPR_JUMPING|SPR_FALLING|SPR_MOVED);
//DoMatchEverything(NULL, sp->lotag, ON);
if (!SW_SHAREWARE && gs.MusicOn && !alreadydid)
if (!SW_SHAREWARE && mus_enabled && !alreadydid)
{
PlaySong(0, RedBookSong[Level], TRUE, TRUE);
alreadydid = TRUE;