Add screenshot type: whole map at current zoom level
This commit is contained in:
@@ -1476,11 +1476,12 @@ DEF_CONSOLE_CMD(ConAlias)
|
|||||||
DEF_CONSOLE_CMD(ConScreenShot)
|
DEF_CONSOLE_CMD(ConScreenShot)
|
||||||
{
|
{
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [viewport | normal | big | giant | heightmap | minimap] [no_con] [size <width> <height>] [<filename>]'");
|
IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [viewport | normal | big | giant | world | heightmap | minimap] [no_con] [size <width> <height>] [<filename>]'");
|
||||||
IConsoleHelp("'viewport' (default) makes a screenshot of the current viewport (including menus, windows, ..), "
|
IConsoleHelp("'viewport' (default) makes a screenshot of the current viewport (including menus, windows, ..), "
|
||||||
"'normal' makes a screenshot of the visible area, "
|
"'normal' makes a screenshot of the visible area, "
|
||||||
"'big' makes a zoomed-in screenshot of the visible area, "
|
"'big' makes a zoomed-in screenshot of the visible area, "
|
||||||
"'giant' makes a screenshot of the whole map, "
|
"'giant' makes a screenshot of the whole map using the default zoom level, "
|
||||||
|
"'world' makes a screenshot of the whole map using the current zoom level, "
|
||||||
"'heightmap' makes a heightmap screenshot of the map that can be loaded in as heightmap, "
|
"'heightmap' makes a heightmap screenshot of the map that can be loaded in as heightmap, "
|
||||||
"'minimap' makes a top-viewed minimap screenshot of the whole world which represents one tile by one pixel. "
|
"'minimap' makes a top-viewed minimap screenshot of the whole world which represents one tile by one pixel. "
|
||||||
"'no_con' hides the console to create the screenshot (only useful in combination with 'viewport'). "
|
"'no_con' hides the console to create the screenshot (only useful in combination with 'viewport'). "
|
||||||
@@ -1509,6 +1510,9 @@ DEF_CONSOLE_CMD(ConScreenShot)
|
|||||||
} else if (strcmp(argv[arg_index], "giant") == 0) {
|
} else if (strcmp(argv[arg_index], "giant") == 0) {
|
||||||
type = SC_WORLD;
|
type = SC_WORLD;
|
||||||
arg_index += 1;
|
arg_index += 1;
|
||||||
|
} else if (strcmp(argv[arg_index], "world") == 0) {
|
||||||
|
type = SC_WORLD_ZOOM;
|
||||||
|
arg_index += 1;
|
||||||
} else if (strcmp(argv[arg_index], "heightmap") == 0) {
|
} else if (strcmp(argv[arg_index], "heightmap") == 0) {
|
||||||
type = SC_HEIGHTMAP;
|
type = SC_HEIGHTMAP;
|
||||||
arg_index += 1;
|
arg_index += 1;
|
||||||
|
@@ -5273,7 +5273,8 @@ STR_SCREENSHOT_CAPTION :{WHITE}Take a s
|
|||||||
STR_SCREENSHOT_SCREENSHOT :{BLACK}Normal screenshot
|
STR_SCREENSHOT_SCREENSHOT :{BLACK}Normal screenshot
|
||||||
STR_SCREENSHOT_ZOOMIN_SCREENSHOT :{BLACK}Fully zoomed in screenshot
|
STR_SCREENSHOT_ZOOMIN_SCREENSHOT :{BLACK}Fully zoomed in screenshot
|
||||||
STR_SCREENSHOT_DEFAULTZOOM_SCREENSHOT :{BLACK}Default zoom screenshot
|
STR_SCREENSHOT_DEFAULTZOOM_SCREENSHOT :{BLACK}Default zoom screenshot
|
||||||
STR_SCREENSHOT_WORLD_SCREENSHOT :{BLACK}Whole map screenshot
|
STR_SCREENSHOT_WORLD_SCREENSHOT :{BLACK}Whole map default zoom screenshot
|
||||||
|
STR_SCREENSHOT_WORLD_SCREENSHOT_CURRENT_ZOOM :{BLACK}Whole map current zoom screenshot
|
||||||
STR_SCREENSHOT_HEIGHTMAP_SCREENSHOT :{BLACK}Heightmap screenshot
|
STR_SCREENSHOT_HEIGHTMAP_SCREENSHOT :{BLACK}Heightmap screenshot
|
||||||
STR_SCREENSHOT_MINIMAP_SCREENSHOT :{BLACK}Minimap screenshot
|
STR_SCREENSHOT_MINIMAP_SCREENSHOT :{BLACK}Minimap screenshot
|
||||||
|
|
||||||
|
@@ -755,11 +755,18 @@ void SetupScreenshotViewport(ScreenshotType t, Viewport *vp, uint32 width, uint3
|
|||||||
vp->overlay = w->viewport->overlay;
|
vp->overlay = w->viewport->overlay;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SC_WORLD: {
|
case SC_WORLD:
|
||||||
|
case SC_WORLD_ZOOM: {
|
||||||
assert(width == 0 && height == 0);
|
assert(width == 0 && height == 0);
|
||||||
|
|
||||||
/* Determine world coordinates of screenshot */
|
/* Determine world coordinates of screenshot */
|
||||||
|
if (t == SC_WORLD_ZOOM) {
|
||||||
|
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||||
|
vp->zoom = w->viewport->zoom;
|
||||||
|
vp->map_type = w->viewport->map_type;
|
||||||
|
} else {
|
||||||
vp->zoom = ZOOM_LVL_WORLD_SCREENSHOT;
|
vp->zoom = ZOOM_LVL_WORLD_SCREENSHOT;
|
||||||
|
}
|
||||||
|
|
||||||
TileIndex north_tile = _settings_game.construction.freeform_edges ? TileXY(1, 1) : TileXY(0, 0);
|
TileIndex north_tile = _settings_game.construction.freeform_edges ? TileXY(1, 1) : TileXY(0, 0);
|
||||||
TileIndex south_tile = MapSize() - 1;
|
TileIndex south_tile = MapSize() - 1;
|
||||||
@@ -965,6 +972,7 @@ bool MakeScreenshot(ScreenshotType t, const char *name, uint32 width, uint32 hei
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SC_WORLD:
|
case SC_WORLD:
|
||||||
|
case SC_WORLD_ZOOM:
|
||||||
ret = MakeLargeWorldScreenshot(t);
|
ret = MakeLargeWorldScreenshot(t);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -21,6 +21,7 @@ enum ScreenshotType {
|
|||||||
SC_ZOOMEDIN, ///< Fully zoomed in screenshot of the visible area.
|
SC_ZOOMEDIN, ///< Fully zoomed in screenshot of the visible area.
|
||||||
SC_DEFAULTZOOM, ///< Zoomed to default zoom level screenshot of the visible area.
|
SC_DEFAULTZOOM, ///< Zoomed to default zoom level screenshot of the visible area.
|
||||||
SC_WORLD, ///< World screenshot.
|
SC_WORLD, ///< World screenshot.
|
||||||
|
SC_WORLD_ZOOM, ///< World screenshot using current zoom level.
|
||||||
SC_HEIGHTMAP, ///< Heightmap of the world.
|
SC_HEIGHTMAP, ///< Heightmap of the world.
|
||||||
SC_MINIMAP, ///< Minimap screenshot.
|
SC_MINIMAP, ///< Minimap screenshot.
|
||||||
};
|
};
|
||||||
|
@@ -36,6 +36,7 @@ struct ScreenshotWindow : Window {
|
|||||||
case WID_SC_TAKE_ZOOMIN: st = SC_ZOOMEDIN; break;
|
case WID_SC_TAKE_ZOOMIN: st = SC_ZOOMEDIN; break;
|
||||||
case WID_SC_TAKE_DEFAULTZOOM: st = SC_DEFAULTZOOM; break;
|
case WID_SC_TAKE_DEFAULTZOOM: st = SC_DEFAULTZOOM; break;
|
||||||
case WID_SC_TAKE_WORLD: st = SC_WORLD; break;
|
case WID_SC_TAKE_WORLD: st = SC_WORLD; break;
|
||||||
|
case WID_SC_TAKE_WORLD_ZOOM: st = SC_WORLD_ZOOM; break;
|
||||||
case WID_SC_TAKE_HEIGHTMAP: st = SC_HEIGHTMAP; break;
|
case WID_SC_TAKE_HEIGHTMAP: st = SC_HEIGHTMAP; break;
|
||||||
case WID_SC_TAKE_MINIMAP: st = SC_MINIMAP; break;
|
case WID_SC_TAKE_MINIMAP: st = SC_MINIMAP; break;
|
||||||
}
|
}
|
||||||
@@ -55,6 +56,7 @@ static const NWidgetPart _nested_screenshot[] = {
|
|||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_ZOOMIN), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_ZOOMIN_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_ZOOMIN), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_ZOOMIN_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_DEFAULTZOOM), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_DEFAULTZOOM_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_DEFAULTZOOM), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_DEFAULTZOOM_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_WORLD), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_WORLD_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_WORLD), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_WORLD_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
||||||
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_WORLD_ZOOM), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_WORLD_SCREENSHOT_CURRENT_ZOOM, 0), SetMinimalTextLines(2, 0),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_HEIGHTMAP), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_HEIGHTMAP_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_HEIGHTMAP), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_HEIGHTMAP_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_MINIMAP), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_MINIMAP_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SC_TAKE_MINIMAP), SetFill(1, 1), SetDataTip(STR_SCREENSHOT_MINIMAP_SCREENSHOT, 0), SetMinimalTextLines(2, 0),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
|
@@ -17,6 +17,7 @@ enum ScreenshotWindowWidgets {
|
|||||||
WID_SC_TAKE_ZOOMIN, ///< Button for taking a zoomed in screenshot
|
WID_SC_TAKE_ZOOMIN, ///< Button for taking a zoomed in screenshot
|
||||||
WID_SC_TAKE_DEFAULTZOOM, ///< Button for taking a screenshot at normal zoom
|
WID_SC_TAKE_DEFAULTZOOM, ///< Button for taking a screenshot at normal zoom
|
||||||
WID_SC_TAKE_WORLD, ///< Button for taking a screenshot of the whole world
|
WID_SC_TAKE_WORLD, ///< Button for taking a screenshot of the whole world
|
||||||
|
WID_SC_TAKE_WORLD_ZOOM, ///< Button for taking a screenshot of the whole world at the current zoom level
|
||||||
WID_SC_TAKE_HEIGHTMAP, ///< Button for taking a heightmap "screenshot"
|
WID_SC_TAKE_HEIGHTMAP, ///< Button for taking a heightmap "screenshot"
|
||||||
WID_SC_TAKE_MINIMAP, ///< Button for taking a minimap screenshot
|
WID_SC_TAKE_MINIMAP, ///< Button for taking a minimap screenshot
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user