Skip to content

Commit 136c635

Browse files
authored
Failsafe is no longer added to INGAME_RES list automatically (#20)
1 parent e735883 commit 136c635

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

src/GameSettings.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <wx/display.h>
3434
#include "wxCheckRadioBox.hpp"
3535

36+
#define MAX_RESOLUTIONS 6
37+
3638
wxString supported_boolean_code[] = {
3739
_T("OFF"),
3840
_T("ON"),
@@ -118,11 +120,11 @@ wxString supported_languages_text[] = {
118120

119121
wxString tooltips_eng[] = {
120122
_T(""),
121-
_T("Select up to four resolutions. Original resolutions are 320x200 and 640x400; Select the native resolution of your monitor, or something with the same aspect ratio. Switch between selected resolutions by pressing Alt+R during the game."),//1
122-
_T("Here you can type your own resolution. Use \"WIDTHxHEIGHTxCOLOUR\" scheme. Replace last \"x\" with \"w\" for windowed mode. You can select max. 4 resolutions."),//2
123+
_T("Select up to six resolutions. Original resolutions are 320x200 and 640x400; Select the native resolution of your monitor, or something with the same aspect ratio. Switch between selected resolutions by pressing Alt+R during the game."),//1
124+
_T("Here you can type your own resolution. Use \"WIDTHxHEIGHTxCOLOUR\" scheme. Replace last \"x\" with \"w\" for windowed mode. You can select max. 6 resolutions."),//2
123125
_T("Screen resolution at which movies (ie. intro) will be played. It is highly recommended to keep this the same as your ingame resolution."),
124126
_T("Screen resolution at which game menu is displayed. It is highly recommended to keep this the same as your ingame resolution."),
125-
_T("Resolution used in case of screen setup failure. If the game cannot enter one of the selected resolutions (ie. in-game resolution), it will try to fall back into this resolution. 1366x768w32 is recommended."),
127+
_T("Resolution used in case of screen setup failure. If the game cannot enter one of the selected resolutions (ie. in-game resolution), it will try to fall back into this resolution."),
126128
_T("Here you can select your language translation. This will affect the in-game messages, but also speeches during the game. Note that some campaigns may not support your language; in this case default one will be used."),
127129
_T("Enabling censorship will make only evil creatures to have blood, and will restrict death effect with exploding flesh. Originally, this was enabled in german language version."),
128130
_T("Increasing sensitivity will speed up the mouse in the game. This may also make the mouse less accurate, so be careful! Default value is 100; you can increase or decrease it at your will. Set it to 0 to disable the setting and use windows mouse speed instead."),
@@ -407,7 +409,6 @@ GameSettings::~GameSettings()
407409

408410
void GameSettings::ChangeResolutionOptions(int scr_ctrl)
409411
{
410-
#define MAX_RESOLUTIONS 5
411412
{
412413
// Get previous values
413414
wxString resolutions[MAX_RESOLUTIONS];
@@ -449,9 +450,8 @@ void GameSettings::ChangeResolutionOptions(int scr_ctrl)
449450
resIngameBox->ClearOptionCheckboxes();
450451
resIngameBox->CreateOptionCheckboxes(arr_ptr, arr_ptr, arr_size, 3);
451452
// Select resolution values
452-
resIngameBox->SetSelected(4, resolutions, res_num);
453+
resIngameBox->SetSelected(MAX_RESOLUTIONS, resolutions, res_num);
453454
}
454-
#undef MAX_RESOLUTIONS
455455

456456
{
457457
wxString * arr_ptr;
@@ -685,24 +685,19 @@ void GameSettings::readConfiguration()
685685

686686
value = conf->Read(wxT("INGAME_RES"), wxT("640x480x32 1024x768x32"));
687687
{
688-
wxString selected_resolutions[5];
688+
wxString selected_resolutions[MAX_RESOLUTIONS];
689689
size_t selected_num;
690-
wxString disabled_resolution;
691690
wxStringTokenizer tokenz(value, wxT(" \t\r\n"));
692-
disabled_resolution = resFailCombo->GetValue();
693691
selected_num=0;
694-
while ( tokenz.HasMoreTokens() && (selected_num < 5) )
692+
while ( tokenz.HasMoreTokens() && (selected_num < MAX_RESOLUTIONS) )
695693
{
696694
wxString param = tokenz.GetNextToken();
697695
if (param.rfind('w') != wxString::npos)
698696
res_wind_num++;
699697
else
700698
res_full_num++;
701-
if (param.CmpNoCase(disabled_resolution) != 0)
702-
{
703-
selected_resolutions[selected_num] = param;
704-
selected_num++;
705-
}
699+
selected_resolutions[selected_num] = param;
700+
selected_num++;
706701
}
707702
// Now we have the amount of fullscreen and windowed resolutions ready
708703
if ((res_wind_num > 0) && (res_full_num > 0))
@@ -716,7 +711,7 @@ void GameSettings::readConfiguration()
716711
ChangeResolutionOptions(index);
717712
Layout();
718713
// Set in-game resolutions
719-
resIngameBox->SetSelected(4, selected_resolutions, selected_num);
714+
resIngameBox->SetSelected(MAX_RESOLUTIONS, selected_resolutions, selected_num);
720715

721716
}
722717

@@ -748,7 +743,6 @@ int GameSettings::verifyConfiguration()
748743

749744
void GameSettings::writeConfiguration()
750745
{
751-
#define MAX_RESOLUTIONS 5
752746
wxString resolutions[MAX_RESOLUTIONS];
753747
size_t res_num,i;
754748
wxString strValue;
@@ -761,8 +755,11 @@ void GameSettings::writeConfiguration()
761755
conf->Write(wxT("FRONTEND_RES"), strValue);
762756
res_num = MAX_RESOLUTIONS;
763757
resIngameBox->GetSelected(resolutions, res_num);
764-
strValue = resFailCombo->GetValue();
765-
for (i=0; i < res_num; i++) {
758+
if (res_num == 0)
759+
strValue = resFailCombo->GetValue();
760+
else
761+
strValue = resolutions[0];
762+
for (i=1; i < res_num; i++) {
766763
strValue.Append(" ");
767764
strValue.Append(resolutions[i]);
768765
}
@@ -774,7 +771,6 @@ void GameSettings::writeConfiguration()
774771
conf->Write(wxT("ATMOS_FREQUENCY"), lowmedhigh_code[atmosFrequencyRadio->GetSelection()]);
775772
conf->Write(wxT("ATMOS_VOLUME"), lowmedhigh_code[atmosVolumeRadio->GetSelection()]);
776773
//conf->Save(); -- saving is automatic when the object is destroyed
777-
#undef MAX_RESOLUTIONS
778774
}
779775

780776

0 commit comments

Comments
 (0)