mirror of
https://github.com/ENSL/NS.git
synced 2024-11-22 12:41:33 +00:00
Scale ambient and music volumes to game volume
-cl_musicvolume changed to scalar -cl_ambientsound changed back to scalar
This commit is contained in:
parent
79d3e270a6
commit
91daecffdb
4 changed files with 19 additions and 15 deletions
|
@ -1628,7 +1628,7 @@ void InitInput (void)
|
|||
cl_autohelp = gEngfuncs.pfnRegisterVariable ( kvAutoHelp, "1.0", FCVAR_ARCHIVE );
|
||||
cl_centerentityid = gEngfuncs.pfnRegisterVariable ( kvCenterEntityID, "0.0", FCVAR_ARCHIVE );
|
||||
cl_musicenabled = gEngfuncs.pfnRegisterVariable ( kvMusicEnabled, "0", FCVAR_ARCHIVE );
|
||||
cl_musicvolume = gEngfuncs.pfnRegisterVariable ( kvMusicVolume, "155", FCVAR_ARCHIVE );
|
||||
cl_musicvolume = gEngfuncs.pfnRegisterVariable ( kvMusicVolume, "1", FCVAR_ARCHIVE );
|
||||
cl_musicdir = gEngfuncs.pfnRegisterVariable ( kvMusicDirectory, "", FCVAR_ARCHIVE);
|
||||
cl_musicdelay = gEngfuncs.pfnRegisterVariable ( kvMusicDelay, "90", FCVAR_ARCHIVE);
|
||||
cl_dynamiclights = gEngfuncs.pfnRegisterVariable ( kvDynamicLights, "1", FCVAR_ARCHIVE );
|
||||
|
|
|
@ -100,11 +100,10 @@ void AvHAmbientSound::UpdateVolume(const Vector& inListenerPosition)
|
|||
{
|
||||
theVolume = this->mVolume - this->mVolume*(theDistance/(float)this->mFadeDistance);
|
||||
}
|
||||
|
||||
float ambientscale = CVAR_GET_FLOAT("cl_ambientsound") * 0.01f;
|
||||
ambientscale = min(max(0, ambientscale), 1);
|
||||
theVolume = min(max(0, theVolume), 255);
|
||||
theVolume *= ambientscale;
|
||||
//cl_ambientsound 1 is original NS3.2 volume, now changable as well as scaled by the master volume.
|
||||
float ambientscale = CVAR_GET_FLOAT("cl_ambientsound") * CVAR_GET_FLOAT("volume");
|
||||
ambientscale = min(max(0, ambientscale), 2);
|
||||
theVolume = min(max(0, theVolume * ambientscale), 255);
|
||||
|
||||
FMOD_INSTANCE* theFMOD = gHUD.GetFMOD();
|
||||
|
||||
|
|
|
@ -468,7 +468,9 @@ void UIHud::PlayRandomSong(void)
|
|||
// // Set volume to half way. TODO: This should use a real music volume variable
|
||||
// FSOUND_SetPan(this->mCurrentChannel, FSOUND_STEREOPAN);
|
||||
//
|
||||
int theVolume = (int)(cl_musicvolume->value);
|
||||
//2023 - Making "volume" cvar a master volume. Multiplying by 155 as it was the original default value on the previous 0-255 cvar range.
|
||||
int theVolume = min(max(0, cl_musicvolume->value * CVAR_GET_FLOAT("volume") * 155), 255);
|
||||
|
||||
// this->mBytesInCurrentSong = FSOUND_Stream_GetLength(this->mCurrentSongStream);
|
||||
|
||||
if(this->PlaySong(theRelativeSongName, theVolume, false, this->mCurrentSongStream, this->mCurrentChannel, this->mBytesInCurrentSong))
|
||||
|
@ -660,11 +662,14 @@ void UIHud::UpdateMusic(float inCurrentTime)
|
|||
this->StopMusic();
|
||||
}
|
||||
|
||||
if(this->mSongIsPlaying && ((int)(cl_musicvolume->value) != this->mCurrentVolume))
|
||||
//2023 - Making "volume" cvar a master volume. Multiplying by 155 as it was the original default value on the previous 0-255 cvar range.
|
||||
int musicVol = min(max(0, cl_musicvolume->value * CVAR_GET_FLOAT("volume") * 155), 255);;
|
||||
|
||||
if (this->mSongIsPlaying && (musicVol != this->mCurrentVolume))
|
||||
{
|
||||
this->mCurrentVolume = (int)(cl_musicvolume->value);
|
||||
this->mCurrentVolume = min(max(0, this->mCurrentVolume), 255);
|
||||
cl_musicvolume->value = this->mCurrentVolume;
|
||||
this->mCurrentVolume = musicVol;
|
||||
//this->mCurrentVolume = min(max(0, this->mCurrentVolume), 255);
|
||||
//cl_musicvolume->value = this->mCurrentVolume;
|
||||
mFMOD->FSOUND_SetVolume(this->mCurrentChannel, this->mCurrentVolume);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ DESCRIPTION INFO_OPTIONS
|
|||
|
||||
"cl_ambientsound"
|
||||
{
|
||||
"Ambient sound volume (0 to 100)"
|
||||
"Ambient sound volume (0 to 1)"
|
||||
{ NUMBER 0.000000 1.000000 }
|
||||
{ "0.000000" }
|
||||
}
|
||||
|
@ -448,9 +448,9 @@ DESCRIPTION INFO_OPTIONS
|
|||
|
||||
"cl_musicvolume"
|
||||
{
|
||||
"Music volume (0-255)"
|
||||
{ NUMBER 0.000000 255.000000 }
|
||||
{ "100.000000" }
|
||||
"Music volume (0-2)"
|
||||
{ NUMBER 0.000000 2.000000 }
|
||||
{ "1.000000" }
|
||||
}
|
||||
|
||||
"cl_musicdirectory"
|
||||
|
|
Loading…
Reference in a new issue