* Changed Ret to Get methods in sound module
* Added video settings to profile * Resolution change is now posibble but restart is requireddev-ui
parent
1fa5f7a96f
commit
c793d2d4c6
|
@ -325,9 +325,6 @@ bool CApplication::Create()
|
||||||
|
|
||||||
GetLogger()->Debug("Testing gettext translation: '%s'\n", gettext("Colobot rules!"));
|
GetLogger()->Debug("Testing gettext translation: '%s'\n", gettext("Colobot rules!"));
|
||||||
|
|
||||||
// Temporarily -- only in windowed mode
|
|
||||||
m_deviceConfig.fullScreen = false;
|
|
||||||
|
|
||||||
//Create the sound instance.
|
//Create the sound instance.
|
||||||
if (!GetProfile().InitCurrentDirectory()) {
|
if (!GetProfile().InitCurrentDirectory()) {
|
||||||
GetLogger()->Warn("Config not found. Default values will be used!\n");
|
GetLogger()->Warn("Config not found. Default values will be used!\n");
|
||||||
|
@ -384,6 +381,19 @@ bool CApplication::Create()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load settings from profile
|
||||||
|
int iValue;
|
||||||
|
if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) ) {
|
||||||
|
std::vector<Math::IntPoint> modes;
|
||||||
|
GetVideoResolutionList(modes, true, true);
|
||||||
|
if (static_cast<unsigned int>(iValue) < modes.size())
|
||||||
|
m_deviceConfig.size = modes.at(iValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) ) {
|
||||||
|
m_deviceConfig.fullScreen = (iValue == 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (! CreateVideoSurface())
|
if (! CreateVideoSurface())
|
||||||
return false; // dialog is in function
|
return false; // dialog is in function
|
||||||
|
|
||||||
|
@ -404,7 +414,6 @@ bool CApplication::Create()
|
||||||
// Don't generate joystick events
|
// Don't generate joystick events
|
||||||
SDL_JoystickEventState(SDL_IGNORE);
|
SDL_JoystickEventState(SDL_IGNORE);
|
||||||
|
|
||||||
|
|
||||||
// The video is ready, we can create and initalize the graphics device
|
// The video is ready, we can create and initalize the graphics device
|
||||||
m_device = new Gfx::CGLDevice(m_deviceConfig);
|
m_device = new Gfx::CGLDevice(m_deviceConfig);
|
||||||
if (! m_device->Create() )
|
if (! m_device->Create() )
|
||||||
|
|
|
@ -86,14 +86,14 @@ void ALSound::SetSound3D(bool bMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ALSound::RetSound3D()
|
bool ALSound::GetSound3D()
|
||||||
{
|
{
|
||||||
// TODO stub! need to be implemented
|
// TODO stub! need to be implemented
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ALSound::RetSound3DCap()
|
bool ALSound::GetSound3DCap()
|
||||||
{
|
{
|
||||||
// TODO stub! need to be implemented
|
// TODO stub! need to be implemented
|
||||||
return true;
|
return true;
|
||||||
|
@ -113,7 +113,7 @@ void ALSound::SetAudioVolume(int volume)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ALSound::RetAudioVolume()
|
int ALSound::GetAudioVolume()
|
||||||
{
|
{
|
||||||
float volume;
|
float volume;
|
||||||
if ( !mEnabled )
|
if ( !mEnabled )
|
||||||
|
@ -130,7 +130,7 @@ void ALSound::SetMusicVolume(int volume)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ALSound::RetMusicVolume()
|
int ALSound::GetMusicVolume()
|
||||||
{
|
{
|
||||||
// TODO stub! Add music support
|
// TODO stub! Add music support
|
||||||
if ( !mEnabled )
|
if ( !mEnabled )
|
||||||
|
@ -151,7 +151,7 @@ bool ALSound::Cache(Sound sound, std::string filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ALSound::RetPriority(Sound sound)
|
int ALSound::GetPriority(Sound sound)
|
||||||
{
|
{
|
||||||
if ( sound == SOUND_FLYh ||
|
if ( sound == SOUND_FLYh ||
|
||||||
sound == SOUND_FLY ||
|
sound == SOUND_FLY ||
|
||||||
|
@ -202,7 +202,7 @@ int ALSound::RetPriority(Sound sound)
|
||||||
|
|
||||||
bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
|
bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
|
||||||
{
|
{
|
||||||
int priority = RetPriority(sound);
|
int priority = GetPriority(sound);
|
||||||
|
|
||||||
// Seeks a channel used which sound is stopped.
|
// Seeks a channel used which sound is stopped.
|
||||||
for (auto it : mChannels) {
|
for (auto it : mChannels) {
|
||||||
|
|
|
@ -45,13 +45,13 @@ class ALSound : public CSoundInterface
|
||||||
bool RetEnable();
|
bool RetEnable();
|
||||||
|
|
||||||
void SetSound3D(bool bMode);
|
void SetSound3D(bool bMode);
|
||||||
bool RetSound3D();
|
bool GetSound3D();
|
||||||
bool RetSound3DCap();
|
bool GetSound3DCap();
|
||||||
|
|
||||||
void SetAudioVolume(int volume);
|
void SetAudioVolume(int volume);
|
||||||
int RetAudioVolume();
|
int GetAudioVolume();
|
||||||
void SetMusicVolume(int volume);
|
void SetMusicVolume(int volume);
|
||||||
int RetMusicVolume();
|
int GetMusicVolume();
|
||||||
|
|
||||||
void SetListener(Math::Vector eye, Math::Vector lookat);
|
void SetListener(Math::Vector eye, Math::Vector lookat);
|
||||||
void FrameMove(float rTime);
|
void FrameMove(float rTime);
|
||||||
|
@ -80,7 +80,7 @@ class ALSound : public CSoundInterface
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
int RetPriority(Sound);
|
int GetPriority(Sound);
|
||||||
bool SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded);
|
bool SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded);
|
||||||
|
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
|
|
|
@ -1164,43 +1164,22 @@ pb->SetState(STATE_SHADOW);
|
||||||
if ( m_phase == PHASE_SETUPd || // setup/display ?
|
if ( m_phase == PHASE_SETUPd || // setup/display ?
|
||||||
m_phase == PHASE_SETUPds )
|
m_phase == PHASE_SETUPds )
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO: device settings
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
pos.x = ox+sx*3;
|
pos.x = ox+sx*3;
|
||||||
pos.y = oy+sy*9;
|
pos.y = oy+sy*9;
|
||||||
ddim.x = dim.x*6;
|
ddim.x = dim.x*6;
|
||||||
ddim.y = dim.y*1;
|
ddim.y = dim.y*1;
|
||||||
GetResource(RES_TEXT, RT_SETUP_DEVICE, name);
|
|
||||||
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
|
|
||||||
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
|
||||||
|
|
||||||
pos.x = ox+sx*3;
|
|
||||||
pos.y = oy+sy*5.2f;
|
|
||||||
ddim.x = dim.x*6;
|
|
||||||
ddim.y = dim.y*4.5f;
|
|
||||||
pli = pw->CreateList(pos, ddim, 0, EVENT_LIST1);
|
|
||||||
pli->SetState(STATE_SHADOW);
|
|
||||||
UpdateDisplayDevice();
|
|
||||||
|
|
||||||
pos.x = ox+sx*10;
|
|
||||||
pos.y = oy+sy*9;
|
|
||||||
ddim.x = dim.x*6;
|
|
||||||
ddim.y = dim.y*1;
|
|
||||||
GetResource(RES_TEXT, RT_SETUP_MODE, name);
|
GetResource(RES_TEXT, RT_SETUP_MODE, name);
|
||||||
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
|
||||||
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
||||||
|
|
||||||
m_setupFull = m_app->GetVideoConfig().fullScreen;
|
m_setupFull = m_app->GetVideoConfig().fullScreen;
|
||||||
pos.x = ox+sx*10;
|
pos.x = ox+sx*3;
|
||||||
pos.y = oy+sy*5.2f;
|
pos.y = oy+sy*5.2f;
|
||||||
ddim.x = dim.x*6;
|
ddim.x = dim.x*6;
|
||||||
ddim.y = dim.y*4.5f;
|
ddim.y = dim.y*4.5f;
|
||||||
pli = pw->CreateList(pos, ddim, 0, EVENT_LIST2);
|
pli = pw->CreateList(pos, ddim, 0, EVENT_LIST2);
|
||||||
pli->SetState(STATE_SHADOW);
|
pli->SetState(STATE_SHADOW);
|
||||||
UpdateDisplayMode();
|
UpdateDisplayMode();
|
||||||
pli->SetState(STATE_ENABLE, m_setupFull);
|
|
||||||
|
|
||||||
ddim.x = dim.x*4;
|
ddim.x = dim.x*4;
|
||||||
ddim.y = dim.y*0.5f;
|
ddim.y = dim.y*0.5f;
|
||||||
|
@ -1209,7 +1188,6 @@ pb->SetState(STATE_SHADOW);
|
||||||
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_FULL);
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_FULL);
|
||||||
pc->SetState(STATE_SHADOW);
|
pc->SetState(STATE_SHADOW);
|
||||||
pc->SetState(STATE_CHECK, m_setupFull);
|
pc->SetState(STATE_CHECK, m_setupFull);
|
||||||
#endif
|
|
||||||
|
|
||||||
ddim.x = dim.x*6;
|
ddim.x = dim.x*6;
|
||||||
ddim.y = dim.y*1;
|
ddim.y = dim.y*1;
|
||||||
|
@ -2610,19 +2588,16 @@ bool CMainDialog::EventProcess(const Event &event)
|
||||||
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
||||||
if ( pw == 0 ) break;
|
if ( pw == 0 ) break;
|
||||||
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
|
||||||
if ( pc == 0 ) break;
|
if ( pc == 0 ) break;
|
||||||
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
|
|
||||||
if ( pl == 0 ) break;
|
if ( pc->TestState(STATE_CHECK) ) {
|
||||||
if ( pc->TestState(STATE_CHECK) )
|
m_setupFull = false;
|
||||||
{
|
pc->ClearState(STATE_CHECK);
|
||||||
pc->ClearState(STATE_CHECK); // window
|
} else {
|
||||||
pl->ClearState(STATE_ENABLE);
|
m_setupFull = true;
|
||||||
}
|
pc->SetState(STATE_CHECK);
|
||||||
else
|
}
|
||||||
{
|
|
||||||
pc->SetState(STATE_CHECK); // fullscreen
|
|
||||||
pl->SetState(STATE_ENABLE);
|
|
||||||
}
|
|
||||||
UpdateApply();
|
UpdateApply();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2633,7 +2608,8 @@ bool CMainDialog::EventProcess(const Event &event)
|
||||||
if ( pb == 0 ) break;
|
if ( pb == 0 ) break;
|
||||||
pb->ClearState(STATE_PRESS);
|
pb->ClearState(STATE_PRESS);
|
||||||
pb->ClearState(STATE_HILIGHT);
|
pb->ClearState(STATE_HILIGHT);
|
||||||
ChangeDisplay();
|
// TODO: uncomment when changing display is implemented
|
||||||
|
//ChangeDisplay();
|
||||||
UpdateApply();
|
UpdateApply();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2909,12 +2885,12 @@ bool CMainDialog::EventProcess(const Event &event)
|
||||||
|
|
||||||
case EVENT_INTERFACE_SILENT:
|
case EVENT_INTERFACE_SILENT:
|
||||||
m_sound->SetAudioVolume(0);
|
m_sound->SetAudioVolume(0);
|
||||||
//TODO: m_sound->SetMidiVolume(0);
|
m_sound->SetMusicVolume(0);
|
||||||
UpdateSetupButtons();
|
UpdateSetupButtons();
|
||||||
break;
|
break;
|
||||||
case EVENT_INTERFACE_NOISY:
|
case EVENT_INTERFACE_NOISY:
|
||||||
m_sound->SetAudioVolume(MAXVOLUME);
|
m_sound->SetAudioVolume(MAXVOLUME);
|
||||||
//TODO: m_sound->SetMidiVolume(MAXVOLUME*3/4);
|
m_sound->SetMusicVolume(MAXVOLUME*3/4);
|
||||||
UpdateSetupButtons();
|
UpdateSetupButtons();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -5076,9 +5052,6 @@ void CMainDialog::UpdateDisplayMode()
|
||||||
{
|
{
|
||||||
CWindow* pw;
|
CWindow* pw;
|
||||||
CList* pl;
|
CList* pl;
|
||||||
char bufDevices[1000];
|
|
||||||
char bufModes[5000];
|
|
||||||
int i, j, totalDevices, selectDevices, totalModes, selectModes;
|
|
||||||
|
|
||||||
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
||||||
if ( pw == 0 ) return;
|
if ( pw == 0 ) return;
|
||||||
|
@ -5086,25 +5059,18 @@ void CMainDialog::UpdateDisplayMode()
|
||||||
if ( pl == 0 ) return;
|
if ( pl == 0 ) return;
|
||||||
pl->Flush();
|
pl->Flush();
|
||||||
|
|
||||||
bufModes[0] = 0;
|
std::vector<Math::IntPoint> modes;
|
||||||
/* TODO: remove device choice
|
m_app->GetVideoResolutionList(modes, true, true);
|
||||||
m_engine->EnumDevices(bufDevices, 1000,
|
int i = 0;
|
||||||
bufModes, 5000,
|
std::stringstream mode_text;
|
||||||
totalDevices, selectDevices,
|
for (Math::IntPoint mode : modes) {
|
||||||
totalModes, selectModes);*/
|
mode_text.str("");
|
||||||
|
mode_text << mode.x << "x" << mode.y;
|
||||||
i = 0;
|
pl->SetName(i++, mode_text.str().c_str());
|
||||||
j = 0;
|
|
||||||
while ( bufModes[i] != 0 )
|
|
||||||
{
|
|
||||||
pl->SetName(j++, bufModes+i);
|
|
||||||
while ( bufModes[i++] != 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pl->SetSelect(selectModes);
|
pl->SetSelect(m_setupSelMode);
|
||||||
pl->ShowSelect(false);
|
pl->ShowSelect(false);
|
||||||
|
|
||||||
m_setupSelMode = selectModes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the graphics mode.
|
// Change the graphics mode.
|
||||||
|
@ -5392,9 +5358,8 @@ void CMainDialog::UpdateSetupButtons()
|
||||||
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_VOLMUSIC));
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_VOLMUSIC));
|
||||||
if ( ps != 0 )
|
if ( ps != 0 )
|
||||||
{
|
{
|
||||||
/* TODO: midi volume
|
value = static_cast<float>(m_sound->GetMusicVolume());
|
||||||
value = (float)m_sound->GetMidiVolume();
|
ps->SetVisibleValue(value);
|
||||||
ps->SetVisibleValue(value);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOUND3D));
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOUND3D));
|
||||||
|
@ -5474,10 +5439,6 @@ void CMainDialog::ChangeSetupButtons()
|
||||||
|
|
||||||
void CMainDialog::SetupMemorize()
|
void CMainDialog::SetupMemorize()
|
||||||
{
|
{
|
||||||
float fValue;
|
|
||||||
int iValue, i, j;
|
|
||||||
char num[10];
|
|
||||||
|
|
||||||
GetProfile().SetLocalProfileString("Directory", "scene", m_sceneDir);
|
GetProfile().SetLocalProfileString("Directory", "scene", m_sceneDir);
|
||||||
GetProfile().SetLocalProfileString("Directory", "savegame", m_savegameDir);
|
GetProfile().SetLocalProfileString("Directory", "savegame", m_savegameDir);
|
||||||
GetProfile().SetLocalProfileString("Directory", "public", m_publicDir);
|
GetProfile().SetLocalProfileString("Directory", "public", m_publicDir);
|
||||||
|
@ -5508,14 +5469,26 @@ void CMainDialog::SetupMemorize()
|
||||||
GetProfile().SetLocalProfileInt("Setup", "TextureQuality", m_engine->GetTextureQuality());
|
GetProfile().SetLocalProfileInt("Setup", "TextureQuality", m_engine->GetTextureQuality());
|
||||||
GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode());
|
GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode());
|
||||||
GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume());
|
GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume());
|
||||||
|
GetProfile().SetLocalProfileInt("Setup", "MusicVolume", m_sound->GetMusicVolume());
|
||||||
GetProfile().SetLocalProfileInt("Setup", "Sound3D", m_sound->GetSound3D());
|
GetProfile().SetLocalProfileInt("Setup", "Sound3D", m_sound->GetSound3D());
|
||||||
GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
|
GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
|
||||||
GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
|
GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
|
||||||
|
|
||||||
|
/* screen setup */
|
||||||
|
if (m_setupFull)
|
||||||
|
GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 1);
|
||||||
|
else
|
||||||
|
GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 0);
|
||||||
|
|
||||||
// GetProfile()->SetLocalProfileInt("Setup", "NiceMouse", m_engine->GetNiceMouse());
|
CList *pl;
|
||||||
// GetProfile()->SetLocalProfileInt("Setup", "UseJoystick", m_engine->GetJoystick());
|
CWindow *pw;
|
||||||
// GetProfile()->SetLocalProfileInt("Setup", "MidiVolume", m_sound->GetMidiVolume());
|
pw = static_cast<CWindow *>(m_interface->SearchControl(EVENT_WINDOW5));
|
||||||
|
if ( pw != 0 ) {
|
||||||
|
pl = static_cast<CList *>(pw->SearchControl(EVENT_LIST2));
|
||||||
|
if ( pl != 0 ) {
|
||||||
|
GetProfile().SetLocalProfileInt("Setup", "Resolution", pl->GetSelect());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::stringstream key;
|
std::stringstream key;
|
||||||
for (int i = 0; i < INPUT_SLOT_MAX; i++)
|
for (int i = 0; i < INPUT_SLOT_MAX; i++)
|
||||||
|
@ -5724,11 +5697,10 @@ void CMainDialog::SetupRecall()
|
||||||
m_sound->SetAudioVolume(iValue);
|
m_sound->SetAudioVolume(iValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
if ( GetProfile().GetLocalProfileInt("Setup", "MusicVolume", iValue) )
|
||||||
// if ( GetLocalProfileInt("Setup", "MidiVolume", iValue) )
|
{
|
||||||
// {
|
m_sound->SetMusicVolume(iValue);
|
||||||
// m_sound->SetMidiVolume(iValue);
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) )
|
if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) )
|
||||||
{
|
{
|
||||||
|
@ -5772,6 +5744,14 @@ void CMainDialog::SetupRecall()
|
||||||
{
|
{
|
||||||
m_bDeleteGamer = iValue;
|
m_bDeleteGamer = iValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) ) {
|
||||||
|
m_setupSelMode = iValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) ) {
|
||||||
|
m_setupFull = (iValue == 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue