Skip to content

Instantly share code, notes, and snippets.

@Wolfolo Wolfolo/newgame_advancedui.patch Secret
Last active Aug 27, 2017

Embed
What would you like to do?
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 359709e..66d8bb4 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -173,6 +173,166 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
EndContainer(),
};
+static const NWidgetPart _nested_generate_advanced_landscape_widgets[] = {
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
+ NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_MAPGEN_WORLD_GENERATION_CAPTION, STR_NULL),
+ EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_BROWN),
+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
+ NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_GL_TAB_MAP), SetDataTip(STR_MAPGEN_TAB_MAP, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_GL_TAB_ADVANCED), SetDataTip(STR_MAPGEN_TAB_ADVANCED, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_GL_TAB_GAMEPLAY), SetDataTip(STR_MAPGEN_TAB_GAMEPLAY, STR_NULL), SetFill(1, 0),
+ EndContainer(),
+ NWidget(NWID_SPACER), SetMinimalSize(0, 10),
+
+ NWidget(NWID_SELECTION, COLOUR_BROWN, WID_GL_PANEL_MAP),
+ /* Map Panel */
+ NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
+ NWidget(NWID_VERTICAL),
+
+ /* Landscape selection. */
+ NWidget(NWID_HORIZONTAL),
+ NWidget(NWID_SPACER), SetFill(1, 0),
+ NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
+ NWidget(NWID_SPACER), SetFill(1, 0),
+ NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
+ NWidget(NWID_SPACER), SetFill(1, 0),
+ NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
+ NWidget(NWID_SPACER), SetFill(1, 0),
+ NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
+ NWidget(NWID_SPACER), SetFill(1, 0),
+ EndContainer(),
+
+ NWidget(NWID_SPACER), SetMinimalSize(0, 11),
+
+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(0, 3, 0),
+ /* Left column with labels. */
+ NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_MAPGEN_MAPSIZE_TOOLTIP), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetFill(1, 1),
+ EndContainer(),
+ /* Widgets at the right of the labels. */
+ NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
+ /* Mapsize X * Y. */
+ NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_MAPGEN_MAPSIZE_TOOLTIP), SetFill(1, 0),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_MAPGEN_MAPSIZE_TOOLTIP), SetFill(1, 0),
+ EndContainer(),
+ /* Starting date. */
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1),
+ EndContainer(),
+ EndContainer(),
+ EndContainer(),
+
+ EndContainer(),
+ EndContainer(),
+
+ /* Advanced Panel */
+ NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
+ NWidget(NWID_VERTICAL),
+
+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(0, 3, 0),
+ /* Left column with labels. */
+ NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_LAND_GENERATOR, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAX_HEIGHTLEVEL, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TERRAIN_TYPE, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_VARIETY, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SMOOTHNESS, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_SEA_LAKES, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BORDER_TYPE, STR_NULL), SetFill(1, 1),
+ EndContainer(),
+ /* Widgets at the right of the labels. */
+ NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_LANDSCAPE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ /* Max. heightlevel. */
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_MAX_HEIGHTLEVEL_DOWN), SetFill(0, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_MAX_HEIGHTLEVEL_UP), SetFill(0, 1),
+ EndContainer(),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TERRAIN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_VARIETY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_SMOOTHNESS_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_WATER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_BORDERS_RANDOM), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ EndContainer(),
+ EndContainer(),
+
+ NWidget(NWID_SPACER), SetMinimalSize(0, 4), SetFill(1,0),
+
+ /* Map borders buttons for each edge. */
+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10),
+ NWidget(NWID_HORIZONTAL), SetPIP(0, 0, 3),
+ NWidget(NWID_SPACER), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NORTHWEST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
+ EndContainer(),
+ NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_NW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHWEST), SetFill(1, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_NE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHEAST), SetFill(1, 1),
+ NWidget(NWID_HORIZONTAL), SetPIP(3, 0, 0),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NORTHEAST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
+ NWidget(NWID_SPACER), SetFill(1, 1),
+ EndContainer(),
+ EndContainer(),
+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10),
+ NWidget(NWID_HORIZONTAL), SetPIP(0, 0, 3),
+ NWidget(NWID_SPACER), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SOUTHWEST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
+ EndContainer(),
+ NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_SW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHWEST), SetFill(1, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_SE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHEAST), SetFill(1, 1),
+ NWidget(NWID_HORIZONTAL), SetPIP(3, 0, 0),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SOUTHEAST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
+ NWidget(NWID_SPACER), SetFill(1, 1),
+ EndContainer(),
+ EndContainer(),
+
+ EndContainer(),
+ EndContainer(),
+
+ /* Gameplay Panel */
+ NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
+ NWidget(NWID_VERTICAL),
+
+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(0, 3, 0),
+ NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_TOWNS, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_INDUSTRIES, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_RIVERS, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TREE_PLACER, STR_NULL), SetFill(1, 1),
+ EndContainer(),
+ NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ /* Snow line. */
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1),
+ EndContainer(),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
+ EndContainer(),
+ EndContainer(),
+
+ EndContainer(),
+ EndContainer(),
+ EndContainer(),
+
+ NWidget(NWID_SPACER), SetMinimalSize(0, 10),
+ NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_GL_GENERATE_BUTTON), SetMinimalSize(84, 20), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 1),
+ EndContainer(),
+ NWidget(NWID_SPACER), SetMinimalSize(0, 9), SetFill(1, 1),
+ EndContainer(),
+};
+
/** Widgets of GenerateLandscapeWindow when loading heightmap */
static const NWidgetPart _nested_heightmap_load_widgets[] = {
/* Window header. */
@@ -396,6 +556,11 @@ struct GenerateLandscapeWindow : public Window {
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
+
+ this->SetWidgetLoweredState(WID_GL_TAB_MAP, true);
+ this->GetWidget<NWidgetStacked>(WID_GL_PANEL_MAP)->SetDisplayedPlane(0);
+ this->ReInit();
+
/* Update the climate buttons */
this->SetWidgetLoweredState(WID_GL_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
this->SetWidgetLoweredState(WID_GL_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC);
@@ -700,6 +865,30 @@ struct GenerateLandscapeWindow : public Window {
_settings_newgame.game_creation.water_borders = (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? 0 : BORDERS_RANDOM;
this->InvalidateData();
break;
+
+ case WID_GL_TAB_MAP:
+ this->GetWidget<NWidgetStacked>(WID_GL_PANEL_MAP)->SetDisplayedPlane(0);
+ this->SetWidgetLoweredState(widget, true);
+ this->SetWidgetsLoweredState(false, WID_GL_TAB_ADVANCED, WID_GL_TAB_GAMEPLAY, WIDGET_LIST_END);
+ this->ReInit();
+ SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
+ break;
+
+ case WID_GL_TAB_ADVANCED:
+ this->GetWidget<NWidgetStacked>(WID_GL_PANEL_MAP)->SetDisplayedPlane(1);
+ this->SetWidgetLoweredState(widget, true);
+ this->SetWidgetsLoweredState(false, WID_GL_TAB_MAP, WID_GL_TAB_GAMEPLAY, WIDGET_LIST_END);
+ this->ReInit();
+ SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
+ break;
+
+ case WID_GL_TAB_GAMEPLAY:
+ this->GetWidget<NWidgetStacked>(WID_GL_PANEL_MAP)->SetDisplayedPlane(2);
+ this->SetWidgetLoweredState(widget, true);
+ this->SetWidgetsLoweredState(false, WID_GL_TAB_ADVANCED, WID_GL_TAB_MAP, WIDGET_LIST_END);
+ this->ReInit();
+ SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
+ break;
}
}
@@ -811,7 +1000,7 @@ static WindowDesc _generate_landscape_desc(
WDP_CENTER, NULL, 0, 0,
WC_GENERATE_LANDSCAPE, WC_NONE,
0,
- _nested_generate_landscape_widgets, lengthof(_nested_generate_landscape_widgets)
+ _nested_generate_advanced_landscape_widgets, lengthof(_nested_generate_advanced_landscape_widgets)
);
static WindowDesc _heightmap_load_desc(
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 0228f9c..b694b60 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2740,6 +2740,9 @@ STR_MAPGEN_QUANTITY_OF_RIVERS :{BLACK}Rivers:
STR_MAPGEN_SMOOTHNESS :{BLACK}Smoothness:
STR_MAPGEN_VARIETY :{BLACK}Variety distribution:
STR_MAPGEN_GENERATE :{WHITE}Generate
+STR_MAPGEN_TAB_MAP :{WHITE}Map
+STR_MAPGEN_TAB_ADVANCED :{WHITE}Advanced
+STR_MAPGEN_TAB_GAMEPLAY :{WHITE}Gameplay
# Strings for map borders at game generation
STR_MAPGEN_BORDER_TYPE :{BLACK}Map edges:
diff --git a/src/widgets/genworld_widget.h b/src/widgets/genworld_widget.h
index 877efbb..634f497 100644
--- a/src/widgets/genworld_widget.h
+++ b/src/widgets/genworld_widget.h
@@ -57,6 +57,14 @@ enum GenerateLandscapeWidgets {
WID_GL_WATER_NE, ///< NE 'Water'/'Freeform'.
WID_GL_WATER_SE, ///< SE 'Water'/'Freeform'.
WID_GL_WATER_SW, ///< SW 'Water'/'Freeform'.
+
+ WID_GL_TAB_MAP,
+ WID_GL_TAB_ADVANCED,
+ WID_GL_TAB_GAMEPLAY,
+
+ WID_GL_PANEL_MAP,
+ WID_GL_PANEL_ADVANCED,
+ WID_GL_PANEL_GAMEPLAY,
};
/** Widgets of the #CreateScenarioWindow class. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.