summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-22 21:40:29 +0000
committerrubidium <rubidium@openttd.org>2009-12-22 21:40:29 +0000
commita8d6d18b227facafcdf4b769beec3d09ee788a17 (patch)
tree59b37ea9c3e4f725854376a70dc7a428918c5141 /src/settings_gui.cpp
parentb30e56850cc77ef3de16e2bc721b7e704d1a12fb (diff)
downloadopenttd-a8d6d18b227facafcdf4b769beec3d09ee788a17.tar.xz
(svn r18608) -Change: add the concept of music sets
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp80
1 files changed, 64 insertions, 16 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 82c45a53d..8f6f8a0e6 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -104,21 +104,24 @@ static int GetCurRes()
/** Widgets of the game options menu */
enum GameOptionsWidgets {
- GOW_BACKGROUND, ///< Background of the window
- GOW_CURRENCY_DROPDOWN, ///< Currency dropdown
- GOW_DISTANCE_DROPDOWN, ///< Measuring unit dropdown
- GOW_ROADSIDE_DROPDOWN, ///< Dropdown to select the road side (to set the right side ;))
- GOW_TOWNNAME_DROPDOWN, ///< Town name dropdown
- GOW_AUTOSAVE_DROPDOWN, ///< Dropdown to say how often to autosave
- GOW_LANG_DROPDOWN, ///< Language dropdown
- GOW_RESOLUTION_DROPDOWN, ///< Dropdown for the resolution
- GOW_FULLSCREEN_BUTTON, ///< Toggle fullscreen
- GOW_SCREENSHOT_DROPDOWN, ///< Select the screenshot type... please use PNG!
- GOW_BASE_GRF_DROPDOWN, ///< Use to select a base GRF
- GOW_BASE_GRF_STATUS, ///< Info about missing files etc.
- GOW_BASE_GRF_DESCRIPTION,///< Description of selected base GRF
- GOW_BASE_SFX_DROPDOWN, ///< Use to select a base SFX
- GOW_BASE_SFX_DESCRIPTION,///< Description of selected base SFX
+ GOW_BACKGROUND, ///< Background of the window
+ GOW_CURRENCY_DROPDOWN, ///< Currency dropdown
+ GOW_DISTANCE_DROPDOWN, ///< Measuring unit dropdown
+ GOW_ROADSIDE_DROPDOWN, ///< Dropdown to select the road side (to set the right side ;))
+ GOW_TOWNNAME_DROPDOWN, ///< Town name dropdown
+ GOW_AUTOSAVE_DROPDOWN, ///< Dropdown to say how often to autosave
+ GOW_LANG_DROPDOWN, ///< Language dropdown
+ GOW_RESOLUTION_DROPDOWN, ///< Dropdown for the resolution
+ GOW_FULLSCREEN_BUTTON, ///< Toggle fullscreen
+ GOW_SCREENSHOT_DROPDOWN, ///< Select the screenshot type... please use PNG!
+ GOW_BASE_GRF_DROPDOWN, ///< Use to select a base GRF
+ GOW_BASE_GRF_STATUS, ///< Info about missing files etc.
+ GOW_BASE_GRF_DESCRIPTION, ///< Description of selected base GRF
+ GOW_BASE_SFX_DROPDOWN, ///< Use to select a base SFX
+ GOW_BASE_SFX_DESCRIPTION, ///< Description of selected base SFX
+ GOW_BASE_MUSIC_DROPDOWN, ///< Use to select a base music set
+ GOW_BASE_MUSIC_STATUS, ///< Info about corrupted files etc.
+ GOW_BASE_MUSIC_DESCRIPTION, ///< Description of selected base music set
};
/**
@@ -194,6 +197,8 @@ struct GameOptionsWindow : Window {
case GOW_BASE_GRF_DROPDOWN: SetDParamStr(0, BaseGraphics::GetUsedSet()->name); break;
case GOW_BASE_GRF_STATUS: SetDParam(0, BaseGraphics::GetUsedSet()->GetNumInvalid()); break;
case GOW_BASE_SFX_DROPDOWN: SetDParamStr(0, BaseSounds::GetUsedSet()->name); break;
+ case GOW_BASE_MUSIC_DROPDOWN: SetDParamStr(0, BaseMusic::GetUsedSet()->name); break;
+ case GOW_BASE_MUSIC_STATUS: SetDParam(0, BaseMusic::GetUsedSet()->GetNumInvalid()); break;
}
}
@@ -214,6 +219,11 @@ struct GameOptionsWindow : Window {
SetDParamStr(0, BaseSounds::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode()));
DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING);
break;
+
+ case GOW_BASE_MUSIC_DESCRIPTION:
+ SetDParamStr(0, BaseMusic::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode()));
+ DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING);
+ break;
}
}
@@ -246,6 +256,25 @@ struct GameOptionsWindow : Window {
size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width));
}
break;
+
+ case GOW_BASE_MUSIC_DESCRIPTION:
+ /* Find the biggest description for the default size. */
+ for (int i = 0; i < BaseMusic::GetNumSets(); i++) {
+ SetDParamStr(0, BaseMusic::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode()));
+ size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width));
+ }
+ break;
+
+ case GOW_BASE_MUSIC_STATUS:
+ /* Find the biggest description for the default size. */
+ for (int i = 0; i < BaseMusic::GetNumSets(); i++) {
+ uint invalid_files = BaseMusic::GetSet(i)->GetNumInvalid();
+ if (invalid_files == 0) continue;
+
+ SetDParam(0, invalid_files);
+ *size = maxdim(*size, GetStringBoundingBox(STR_GAME_OPTIONS_BASE_MUSIC_STATUS));
+ }
+ break;
}
}
@@ -320,6 +349,10 @@ struct GameOptionsWindow : Window {
case GOW_BASE_SFX_DROPDOWN:
ShowSetMenu<BaseSounds>(this, GOW_BASE_SFX_DROPDOWN);
break;
+
+ case GOW_BASE_MUSIC_DROPDOWN:
+ ShowSetMenu<BaseMusic>(this, GOW_BASE_MUSIC_DROPDOWN);
+ break;
}
}
@@ -403,6 +436,10 @@ struct GameOptionsWindow : Window {
case GOW_BASE_SFX_DROPDOWN:
this->SetMediaSet<BaseSounds>(index);
break;
+
+ case GOW_BASE_MUSIC_DROPDOWN:
+ this->SetMediaSet<BaseMusic>(index);
+ break;
}
}
@@ -412,6 +449,9 @@ struct GameOptionsWindow : Window {
bool missing_files = BaseGraphics::GetUsedSet()->GetNumMissing() == 0;
this->GetWidget<NWidgetCore>(GOW_BASE_GRF_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_GRF_STATUS, STR_NULL);
+
+ missing_files = BaseMusic::GetUsedSet()->GetNumInvalid() == 0;
+ this->GetWidget<NWidgetCore>(GOW_BASE_MUSIC_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_MUSIC_STATUS, STR_NULL);
}
};
@@ -459,7 +499,7 @@ static const NWidgetPart _nested_game_options_widgets[] = {
EndContainer(),
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_GRF, STR_NULL), SetPadding(0, 10, 0, 10),
- NWidget(NWID_HORIZONTAL), SetPIP(00, 30, 0),
+ NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0),
NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_BASE_GRF_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_GRF_TOOLTIP),
NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_GRF_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0),
EndContainer(),
@@ -473,6 +513,14 @@ static const NWidgetPart _nested_game_options_widgets[] = {
EndContainer(),
NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_SFX_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 0, 0),
EndContainer(),
+
+ NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_MUSIC, STR_NULL), SetPadding(0, 10, 0, 10),
+ NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_BASE_MUSIC_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP),
+ NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_MUSIC_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0),
+ EndContainer(),
+ NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_MUSIC_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 0, 0),
+ EndContainer(),
EndContainer(),
};