|
|
|
@ -34,6 +34,7 @@
|
|
|
|
|
#include "ai/ai.hpp"
|
|
|
|
|
#include "blitter/factory.hpp"
|
|
|
|
|
#include "language.h"
|
|
|
|
|
#include "textfile_gui.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -118,6 +119,42 @@ static DropDownList *BuiltSetDropDownList(int *selected_index)
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Window for displaying the textfile of a BaseSet. */
|
|
|
|
|
template <class TBaseSet>
|
|
|
|
|
struct BaseSetTextfileWindow : public TextfileWindow {
|
|
|
|
|
const TBaseSet* baseset; ///< View the textfile of this BaseSet.
|
|
|
|
|
StringID content_type; ///< STR_CONTENT_TYPE_xxx for title.
|
|
|
|
|
|
|
|
|
|
BaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type) : TextfileWindow(file_type), baseset(baseset), content_type(content_type)
|
|
|
|
|
{
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_TF_CAPTION)->SetDataTip(STR_TEXTFILE_README_CAPTION + file_type, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS);
|
|
|
|
|
|
|
|
|
|
const char *textfile = this->baseset->GetTextfile(file_type);
|
|
|
|
|
this->LoadTextfile(textfile, BASESET_DIR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* virtual */ void SetStringParameters(int widget) const
|
|
|
|
|
{
|
|
|
|
|
if (widget == WID_TF_CAPTION) {
|
|
|
|
|
SetDParam(0, content_type);
|
|
|
|
|
SetDParamStr(1, this->baseset->name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Open the BaseSet version of the textfile window.
|
|
|
|
|
* @param file_type The type of textfile to display.
|
|
|
|
|
* @param baseset The BaseSet to use.
|
|
|
|
|
* @param content_type STR_CONTENT_TYPE_xxx for title.
|
|
|
|
|
*/
|
|
|
|
|
template <class TBaseSet>
|
|
|
|
|
void ShowBaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type)
|
|
|
|
|
{
|
|
|
|
|
DeleteWindowByClass(WC_TEXTFILE);
|
|
|
|
|
new BaseSetTextfileWindow<TBaseSet>(file_type, baseset, content_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct GameOptionsWindow : Window {
|
|
|
|
|
GameSettings *opt;
|
|
|
|
|
bool reload;
|
|
|
|
@ -395,6 +432,24 @@ struct GameOptionsWindow : Window {
|
|
|
|
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
|
|
{
|
|
|
|
|
if (widget >= WID_GO_BASE_GRF_TEXTFILE && widget < WID_GO_BASE_GRF_TEXTFILE + TFT_END) {
|
|
|
|
|
if (BaseGraphics::GetUsedSet() == NULL) return;
|
|
|
|
|
|
|
|
|
|
ShowBaseSetTextfileWindow((TextfileType)(widget - WID_GO_BASE_GRF_TEXTFILE), BaseGraphics::GetUsedSet(), STR_CONTENT_TYPE_BASE_GRAPHICS);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (widget >= WID_GO_BASE_SFX_TEXTFILE && widget < WID_GO_BASE_SFX_TEXTFILE + TFT_END) {
|
|
|
|
|
if (BaseSounds::GetUsedSet() == NULL) return;
|
|
|
|
|
|
|
|
|
|
ShowBaseSetTextfileWindow((TextfileType)(widget - WID_GO_BASE_SFX_TEXTFILE), BaseSounds::GetUsedSet(), STR_CONTENT_TYPE_BASE_SOUNDS);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (widget >= WID_GO_BASE_MUSIC_TEXTFILE && widget < WID_GO_BASE_MUSIC_TEXTFILE + TFT_END) {
|
|
|
|
|
if (BaseMusic::GetUsedSet() == NULL) return;
|
|
|
|
|
|
|
|
|
|
ShowBaseSetTextfileWindow((TextfileType)(widget - WID_GO_BASE_MUSIC_TEXTFILE), BaseMusic::GetUsedSet(), STR_CONTENT_TYPE_BASE_MUSIC);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
switch (widget) {
|
|
|
|
|
case WID_GO_FULLSCREEN_BUTTON: // Click fullscreen on/off
|
|
|
|
|
/* try to toggle full-screen on/off */
|
|
|
|
@ -517,6 +572,12 @@ struct GameOptionsWindow : Window {
|
|
|
|
|
bool missing_files = BaseGraphics::GetUsedSet()->GetNumMissing() == 0;
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_GO_BASE_GRF_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_GRF_STATUS, STR_NULL);
|
|
|
|
|
|
|
|
|
|
for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
|
|
|
|
|
this->SetWidgetDisabledState(WID_GO_BASE_GRF_TEXTFILE + tft, BaseGraphics::GetUsedSet() == NULL || BaseGraphics::GetUsedSet()->GetTextfile(tft) == NULL);
|
|
|
|
|
this->SetWidgetDisabledState(WID_GO_BASE_SFX_TEXTFILE + tft, BaseSounds::GetUsedSet() == NULL || BaseSounds::GetUsedSet()->GetTextfile(tft) == NULL);
|
|
|
|
|
this->SetWidgetDisabledState(WID_GO_BASE_MUSIC_TEXTFILE + tft, BaseMusic::GetUsedSet() == NULL || BaseMusic::GetUsedSet()->GetTextfile(tft) == NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
missing_files = BaseMusic::GetUsedSet()->GetNumInvalid() == 0;
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_GO_BASE_MUSIC_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_MUSIC_STATUS, STR_NULL);
|
|
|
|
|
}
|
|
|
|
@ -570,7 +631,12 @@ static const NWidgetPart _nested_game_options_widgets[] = {
|
|
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_GRF_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_GRF_TOOLTIP),
|
|
|
|
|
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_GRF_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_GRF_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 0, 0),
|
|
|
|
|
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_GRF_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0),
|
|
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
|
|
|
|
|
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_SFX, STR_NULL), SetPadding(0, 10, 0, 10),
|
|
|
|
@ -578,7 +644,12 @@ static const NWidgetPart _nested_game_options_widgets[] = {
|
|
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_SFX_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_SFX_TOOLTIP),
|
|
|
|
|
NWidget(NWID_SPACER), SetFill(1, 0),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_SFX_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 0, 0),
|
|
|
|
|
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_SFX_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0),
|
|
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
|
|
|
|
|
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_MUSIC, STR_NULL), SetPadding(0, 10, 0, 10),
|
|
|
|
@ -586,7 +657,12 @@ static const NWidgetPart _nested_game_options_widgets[] = {
|
|
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_MUSIC_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP),
|
|
|
|
|
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_MUSIC_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_MUSIC_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 0, 0),
|
|
|
|
|
NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_MUSIC_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0),
|
|
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
};
|
|
|
|
|