Sound effects volume bug
This commit is contained in:
@@ -96,7 +96,7 @@ PyObject* sndSetMusicVolume(PyObject* poSelf, PyObject* poArgs)
|
|||||||
return Py_BuildNone();
|
return Py_BuildNone();
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* sndSetSoundVolumef(PyObject* poSelf, PyObject* poArgs)
|
PyObject* sndSetSoundVolume(PyObject* poSelf, PyObject* poArgs)
|
||||||
{
|
{
|
||||||
float fVolume;
|
float fVolume;
|
||||||
if (!PyTuple_GetFloat(poArgs, 0, &fVolume))
|
if (!PyTuple_GetFloat(poArgs, 0, &fVolume))
|
||||||
@@ -106,16 +106,6 @@ PyObject* sndSetSoundVolumef(PyObject* poSelf, PyObject* poArgs)
|
|||||||
return Py_BuildNone();
|
return Py_BuildNone();
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* sndSetSoundVolume(PyObject* poSelf, PyObject* poArgs)
|
|
||||||
{
|
|
||||||
float volume;
|
|
||||||
if (!PyTuple_GetFloat(poArgs, 0, &volume))
|
|
||||||
return Py_BuildException();
|
|
||||||
|
|
||||||
SoundEngine::Instance().SetSoundVolume(volume / 100.0f);
|
|
||||||
return Py_BuildNone();
|
|
||||||
}
|
|
||||||
|
|
||||||
void initsnd()
|
void initsnd()
|
||||||
{
|
{
|
||||||
static PyMethodDef s_methods[] =
|
static PyMethodDef s_methods[] =
|
||||||
@@ -130,7 +120,6 @@ void initsnd()
|
|||||||
|
|
||||||
{ "SetMasterVolume", sndSetMasterVolume, METH_VARARGS },
|
{ "SetMasterVolume", sndSetMasterVolume, METH_VARARGS },
|
||||||
{ "SetMusicVolume", sndSetMusicVolume, METH_VARARGS },
|
{ "SetMusicVolume", sndSetMusicVolume, METH_VARARGS },
|
||||||
{ "SetSoundVolumef", sndSetSoundVolumef, METH_VARARGS },
|
|
||||||
{ "SetSoundVolume", sndSetSoundVolume, METH_VARARGS },
|
{ "SetSoundVolume", sndSetSoundVolume, METH_VARARGS },
|
||||||
{ NULL, NULL, NULL },
|
{ NULL, NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ float CPythonSystem::GetMusicVolume()
|
|||||||
return m_Config.music_volume;
|
return m_Config.music_volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPythonSystem::GetSoundVolume()
|
float CPythonSystem::GetSoundVolume()
|
||||||
{
|
{
|
||||||
return m_Config.voice_volume;
|
return m_Config.voice_volume;
|
||||||
}
|
}
|
||||||
@@ -223,9 +223,9 @@ void CPythonSystem::SetMusicVolume(float fVolume)
|
|||||||
m_Config.music_volume = fVolume;
|
m_Config.music_volume = fVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPythonSystem::SetSoundVolumef(float fVolume)
|
void CPythonSystem::SetSoundVolume(float fVolume)
|
||||||
{
|
{
|
||||||
m_Config.voice_volume = int(5 * fVolume);
|
m_Config.voice_volume = fVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPythonSystem::GetDistance()
|
int CPythonSystem::GetDistance()
|
||||||
@@ -294,7 +294,7 @@ void CPythonSystem::SetDefaultConfig()
|
|||||||
|
|
||||||
m_Config.gamma = 3;
|
m_Config.gamma = 3;
|
||||||
m_Config.music_volume = 1.0f;
|
m_Config.music_volume = 1.0f;
|
||||||
m_Config.voice_volume = 5;
|
m_Config.voice_volume = 1.0f;
|
||||||
|
|
||||||
m_Config.bDecompressDDS = 0;
|
m_Config.bDecompressDDS = 0;
|
||||||
m_Config.bSoftwareTiling = 0;
|
m_Config.bSoftwareTiling = 0;
|
||||||
@@ -409,15 +409,10 @@ bool CPythonSystem::LoadConfig()
|
|||||||
m_Config.is_object_culling = atoi(value) ? true : false;
|
m_Config.is_object_culling = atoi(value) ? true : false;
|
||||||
else if (!stricmp(command, "VISIBILITY"))
|
else if (!stricmp(command, "VISIBILITY"))
|
||||||
m_Config.iDistance = atoi(value);
|
m_Config.iDistance = atoi(value);
|
||||||
else if (!stricmp(command, "MUSIC_VOLUME")) {
|
else if (!stricmp(command, "MUSIC_VOLUME"))
|
||||||
if(strchr(value, '.') == 0) { // Old compatiability
|
m_Config.music_volume = atof(value);
|
||||||
m_Config.music_volume = pow(10.0f, (-1.0f + (((float) atoi(value)) / 5.0f)));
|
else if (!stricmp(command, "VOICE_VOLUME"))
|
||||||
if(atoi(value) == 0)
|
m_Config.voice_volume = atof(value);
|
||||||
m_Config.music_volume = 0.0f;
|
|
||||||
} else
|
|
||||||
m_Config.music_volume = atof(value);
|
|
||||||
} else if (!stricmp(command, "VOICE_VOLUME"))
|
|
||||||
m_Config.voice_volume = (char) atoi(value);
|
|
||||||
else if (!stricmp(command, "GAMMA"))
|
else if (!stricmp(command, "GAMMA"))
|
||||||
m_Config.gamma = atoi(value);
|
m_Config.gamma = atoi(value);
|
||||||
else if (!stricmp(command, "IS_SAVE_ID"))
|
else if (!stricmp(command, "IS_SAVE_ID"))
|
||||||
@@ -503,7 +498,7 @@ bool CPythonSystem::SaveConfig()
|
|||||||
"OBJECT_CULLING %d\n"
|
"OBJECT_CULLING %d\n"
|
||||||
"VISIBILITY %d\n"
|
"VISIBILITY %d\n"
|
||||||
"MUSIC_VOLUME %.3f\n"
|
"MUSIC_VOLUME %.3f\n"
|
||||||
"VOICE_VOLUME %d\n"
|
"VOICE_VOLUME %.3f\n"
|
||||||
"GAMMA %d\n"
|
"GAMMA %d\n"
|
||||||
"IS_SAVE_ID %d\n"
|
"IS_SAVE_ID %d\n"
|
||||||
"SAVE_ID %s\n"
|
"SAVE_ID %s\n"
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class CPythonSystem : public CSingleton<CPythonSystem>
|
|||||||
int iShadowLevel;
|
int iShadowLevel;
|
||||||
|
|
||||||
FLOAT music_volume;
|
FLOAT music_volume;
|
||||||
BYTE voice_volume;
|
FLOAT voice_volume;
|
||||||
|
|
||||||
int gamma;
|
int gamma;
|
||||||
|
|
||||||
@@ -141,9 +141,9 @@ class CPythonSystem : public CSingleton<CPythonSystem>
|
|||||||
|
|
||||||
// Sound
|
// Sound
|
||||||
float GetMusicVolume();
|
float GetMusicVolume();
|
||||||
int GetSoundVolume();
|
float GetSoundVolume();
|
||||||
void SetMusicVolume(float fVolume);
|
void SetMusicVolume(float fVolume);
|
||||||
void SetSoundVolumef(float fVolume);
|
void SetSoundVolume(float fVolume);
|
||||||
|
|
||||||
int GetDistance();
|
int GetDistance();
|
||||||
int GetShadowLevel();
|
int GetShadowLevel();
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ PyObject * systemGetMusicVolume(PyObject * poSelf, PyObject * poArgs)
|
|||||||
|
|
||||||
PyObject * systemGetSoundVolume(PyObject * poSelf, PyObject * poArgs)
|
PyObject * systemGetSoundVolume(PyObject * poSelf, PyObject * poArgs)
|
||||||
{
|
{
|
||||||
return Py_BuildValue("i", CPythonSystem::Instance().GetSoundVolume());
|
return Py_BuildValue("f", CPythonSystem::Instance().GetSoundVolume());
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject * systemSetMusicVolume(PyObject * poSelf, PyObject * poArgs)
|
PyObject * systemSetMusicVolume(PyObject * poSelf, PyObject * poArgs)
|
||||||
@@ -147,13 +147,13 @@ PyObject * systemSetMusicVolume(PyObject * poSelf, PyObject * poArgs)
|
|||||||
return Py_BuildNone();
|
return Py_BuildNone();
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject * systemSetSoundVolumef(PyObject * poSelf, PyObject * poArgs)
|
PyObject * systemSetSoundVolume(PyObject * poSelf, PyObject * poArgs)
|
||||||
{
|
{
|
||||||
float fVolume;
|
float fVolume;
|
||||||
if (!PyTuple_GetFloat(poArgs, 0, &fVolume))
|
if (!PyTuple_GetFloat(poArgs, 0, &fVolume))
|
||||||
return Py_BuildException();
|
return Py_BuildException();
|
||||||
|
|
||||||
CPythonSystem::Instance().SetSoundVolumef(fVolume);
|
CPythonSystem::Instance().SetSoundVolume(fVolume);
|
||||||
return Py_BuildNone();
|
return Py_BuildNone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ void initsystem()
|
|||||||
{ "GetSoundVolume", systemGetSoundVolume, METH_VARARGS },
|
{ "GetSoundVolume", systemGetSoundVolume, METH_VARARGS },
|
||||||
|
|
||||||
{ "SetMusicVolume", systemSetMusicVolume, METH_VARARGS },
|
{ "SetMusicVolume", systemSetMusicVolume, METH_VARARGS },
|
||||||
{ "SetSoundVolumef", systemSetSoundVolumef, METH_VARARGS },
|
{ "SetSoundVolume", systemSetSoundVolume, METH_VARARGS },
|
||||||
{ "IsSoftwareCursor", systemIsSoftwareCursor, METH_VARARGS },
|
{ "IsSoftwareCursor", systemIsSoftwareCursor, METH_VARARGS },
|
||||||
|
|
||||||
{ "SetViewChatFlag", systemSetViewChatFlag, METH_VARARGS },
|
{ "SetViewChatFlag", systemSetViewChatFlag, METH_VARARGS },
|
||||||
|
|||||||
Reference in New Issue
Block a user