summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/console_cmds.cpp11
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/screenshot.cpp28
-rw-r--r--src/screenshot.h1
-rw-r--r--src/toolbar_gui.cpp28
5 files changed, 58 insertions, 11 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index fd08ab99c..c1d1afdc1 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -1226,9 +1226,10 @@ DEF_CONSOLE_CMD(ConAlias)
DEF_CONSOLE_CMD(ConScreenShot)
{
if (argc == 0) {
- IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [big | no_con] [file name]'");
- IConsoleHelp("'big' makes a screenshot of the whole map, 'no_con' hides the console to create "
- "the screenshot. Screenshots of whole map are always drawn without console");
+ IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [big | giant | no_con] [file name]'");
+ IConsoleHelp("'big' makes a zoomed-in screenshot of the visible area, 'giant' makes a screenshot of the "
+ "whole map, 'no_con' hides the console to create the screenshot. 'big' or 'giant' "
+ "screenshots are always drawn without console");
return true;
}
@@ -1240,6 +1241,10 @@ DEF_CONSOLE_CMD(ConScreenShot)
if (argc > 1) {
if (strcmp(argv[1], "big") == 0) {
/* screenshot big [filename] */
+ type = SC_ZOOMEDIN;
+ if (argc > 2) name = argv[2];
+ } else if (strcmp(argv[1], "giant") == 0) {
+ /* screenshot giant [filename] */
type = SC_WORLD;
if (argc > 2) name = argv[2];
} else if (strcmp(argv[1], "no_con") == 0) {
diff --git a/src/lang/english.txt b/src/lang/english.txt
index cfcac30aa..cc67ef755 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -442,6 +442,7 @@ STR_ABOUT_MENU_SEPARATOR :
STR_ABOUT_MENU_TOGGLE_CONSOLE :Toggle console
STR_ABOUT_MENU_AI_DEBUG :AI debug
STR_ABOUT_MENU_SCREENSHOT :Screenshot
+STR_ABOUT_MENU_ZOOMIN_SCREENSHOT :Zoomed in screenshot
STR_ABOUT_MENU_GIANT_SCREENSHOT :Whole map screenshot
STR_ABOUT_MENU_ABOUT_OPENTTD :About 'OpenTTD'
STR_ABOUT_MENU_SPRITE_ALIGNER :Sprite aligner
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index 84e44c192..3f0c540e9 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -23,6 +23,8 @@
#include "company_func.h"
#include "strings_func.h"
#include "gui.h"
+#include "window_gui.h"
+#include "window_func.h"
#include "table/strings.h"
@@ -602,12 +604,34 @@ static const char *MakeScreenshotName(const char *ext)
return _full_screenshot_name;
}
+/** Make a screenshot of the current screen. */
static bool MakeSmallScreenshot()
{
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
return sf->proc(MakeScreenshotName(sf->extension), CurrentScreenCallback, NULL, _screen.width, _screen.height, BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth(), _cur_palette);
}
+/** Make a zoomed-in screenshot of the currently visible area. */
+static bool MakeZoomedInScreenshot()
+{
+ Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
+ ViewPort vp;
+
+ vp.zoom = ZOOM_LVL_WORLD_SCREENSHOT;
+ vp.left = w->viewport->left;
+ vp.top = w->viewport->top;
+ vp.virtual_left = w->viewport->virtual_left;
+ vp.virtual_top = w->viewport->virtual_top;
+ vp.virtual_width = w->viewport->virtual_width;
+ vp.width = vp.virtual_width;
+ vp.virtual_height = w->viewport->virtual_height;
+ vp.height = vp.virtual_height;
+
+ const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
+ return sf->proc(MakeScreenshotName(sf->extension), LargeWorldCallback, &vp, vp.width, vp.height, BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth(), _cur_palette);
+}
+
+/** Make a screenshot of the whole map. */
static bool MakeWorldScreenshot()
{
ViewPort vp;
@@ -654,6 +678,10 @@ bool MakeScreenshot(ScreenshotType t, const char *name)
ret = MakeSmallScreenshot();
break;
+ case SC_ZOOMEDIN:
+ ret = MakeZoomedInScreenshot();
+ break;
+
case SC_WORLD:
ret = MakeWorldScreenshot();
break;
diff --git a/src/screenshot.h b/src/screenshot.h
index 2361dc01f..21271214c 100644
--- a/src/screenshot.h
+++ b/src/screenshot.h
@@ -21,6 +21,7 @@ void SetScreenshotFormat(uint i);
enum ScreenshotType {
SC_VIEWPORT, ///< Screenshot of viewport
SC_RAW, ///< Raw screenshot from blitter buffer
+ SC_ZOOMEDIN, ///< Zoomed in screenshot of the visible area
SC_WORLD, ///< World screenshot
};
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 19af55e3e..b4553fd73 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -758,7 +758,7 @@ static void MenuClickNewspaper(int index)
static void ToolbarHelpClick(Window *w)
{
- PopupMainToolbMenu(w, TBN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 8 : 7);
+ PopupMainToolbMenu(w, TBN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 9 : 8);
}
static void MenuClickSmallScreenshot()
@@ -766,6 +766,11 @@ static void MenuClickSmallScreenshot()
MakeScreenshot(SC_VIEWPORT, NULL);
}
+static void MenuClickZoomedInScreenshot()
+{
+ MakeScreenshot(SC_ZOOMEDIN, NULL);
+}
+
static void MenuClickWorldScreenshot()
{
MakeScreenshot(SC_WORLD, NULL);
@@ -774,13 +779,14 @@ static void MenuClickWorldScreenshot()
static void MenuClickHelp(int index)
{
switch (index) {
- case 0: PlaceLandBlockInfo(); break;
- case 2: IConsoleSwitch(); break;
- case 3: ShowAIDebugWindow(); break;
- case 4: MenuClickSmallScreenshot(); break;
- case 5: MenuClickWorldScreenshot(); break;
- case 6: ShowAboutWindow(); break;
- case 7: ShowSpriteAlignerWindow(); break;
+ case 0: PlaceLandBlockInfo(); break;
+ case 2: IConsoleSwitch(); break;
+ case 3: ShowAIDebugWindow(); break;
+ case 4: MenuClickSmallScreenshot(); break;
+ case 5: MenuClickZoomedInScreenshot(); break;
+ case 6: MenuClickWorldScreenshot(); break;
+ case 7: ShowAboutWindow(); break;
+ case 8: ShowSpriteAlignerWindow(); break;
}
}
@@ -1252,6 +1258,7 @@ enum MainToolbarHotkeys {
MTHK_BUILD_TREES,
MTHK_MUSIC,
MTHK_SMALL_SCREENSHOT,
+ MTHK_ZOOMEDIN_SCREENSHOT,
MTHK_GIANT_SCREENSHOT,
MTHK_CHEATS,
MTHK_TERRAFORM,
@@ -1327,6 +1334,7 @@ struct MainToolbarWindow : Window {
case MTHK_BUILD_TREES: ShowBuildTreesToolbar(); break;
case MTHK_MUSIC: ShowMusicWindow(); break;
case MTHK_SMALL_SCREENSHOT: MenuClickSmallScreenshot(); break;
+ case MTHK_ZOOMEDIN_SCREENSHOT: MenuClickZoomedInScreenshot(); break;
case MTHK_GIANT_SCREENSHOT: MenuClickWorldScreenshot(); break;
case MTHK_CHEATS: if (!_networking) ShowCheatWindow(); break;
case MTHK_TERRAFORM: ShowTerraformToolbar(); break;
@@ -1411,6 +1419,7 @@ Hotkey<MainToolbarWindow> MainToolbarWindow::maintoolbar_hotkeys[] = {
Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F11, "build_trees", MTHK_BUILD_TREES),
Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F12, "music", MTHK_MUSIC),
Hotkey<MainToolbarWindow>(WKC_CTRL | 'S', "small_screenshot", MTHK_SMALL_SCREENSHOT),
+ Hotkey<MainToolbarWindow>(WKC_CTRL | 'P', "zoomedin_screenshot", MTHK_ZOOMEDIN_SCREENSHOT),
Hotkey<MainToolbarWindow>((uint16)0, "giant_screenshot", MTHK_GIANT_SCREENSHOT),
Hotkey<MainToolbarWindow>(WKC_CTRL | WKC_ALT | 'C', "cheats", MTHK_CHEATS),
Hotkey<MainToolbarWindow>('L', "terraform", MTHK_TERRAFORM),
@@ -1529,6 +1538,7 @@ enum MainToolbarEditorHotkeys {
MTEHK_MUSIC,
MTEHK_LANDINFO,
MTEHK_SMALL_SCREENSHOT,
+ MTEHK_ZOOMEDIN_SCREENSHOT,
MTEHK_GIANT_SCREENSHOT,
MTEHK_ZOOM_IN,
MTEHK_ZOOM_OUT,
@@ -1624,6 +1634,7 @@ public:
case MTEHK_MUSIC: ShowMusicWindow(); break;
case MTEHK_LANDINFO: PlaceLandBlockInfo(); break;
case MTEHK_SMALL_SCREENSHOT: MenuClickSmallScreenshot(); break;
+ case MTEHK_ZOOMEDIN_SCREENSHOT: MenuClickZoomedInScreenshot(); break;
case MTEHK_GIANT_SCREENSHOT: MenuClickWorldScreenshot(); break;
case MTEHK_ZOOM_IN: ToolbarZoomInClick(this); break;
case MTEHK_ZOOM_OUT: ToolbarZoomOutClick(this); break;
@@ -1700,6 +1711,7 @@ Hotkey<ScenarioEditorToolbarWindow> ScenarioEditorToolbarWindow::scenedit_mainto
Hotkey<ScenarioEditorToolbarWindow>(WKC_F11, "industry_list", MTEHK_MUSIC),
Hotkey<ScenarioEditorToolbarWindow>(WKC_F12, "train_list", MTEHK_LANDINFO),
Hotkey<ScenarioEditorToolbarWindow>(WKC_CTRL | 'S', "small_screenshot", MTEHK_SMALL_SCREENSHOT),
+ Hotkey<ScenarioEditorToolbarWindow>(WKC_CTRL | 'P', "zoomedin_screenshot", MTEHK_ZOOMEDIN_SCREENSHOT),
Hotkey<ScenarioEditorToolbarWindow>((uint16)0, "giant_screenshot", MTEHK_GIANT_SCREENSHOT),
Hotkey<ScenarioEditorToolbarWindow>(_maintoolbar_zoomin_keys, "zoomin", MTEHK_ZOOM_IN),
Hotkey<ScenarioEditorToolbarWindow>(_maintoolbar_zoomout_keys, "zoomout", MTEHK_ZOOM_OUT),