Changeset - r24996:203408ab0070
[Not reviewed]
master
0 1 0
Patric Stout - 3 years ago 2021-03-04 09:38:25
truebrain@openttd.org
Add: allow making heightmap screenshot via console
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -1400,29 +1400,30 @@ DEF_CONSOLE_CMD(ConAlias)
 
	if (alias == nullptr) {
 
		IConsoleAliasRegister(argv[1], argv[2]);
 
	} else {
 
		free(alias->cmdline);
 
		alias->cmdline = stredup(argv[2]);
 
	}
 
	return true;
 
}
 

	
 
DEF_CONSOLE_CMD(ConScreenShot)
 
{
 
	if (argc == 0) {
 
		IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [viewport | normal | big | giant | minimap] [no_con] [size <width> <height>] [<filename>]'");
 
		IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [viewport | normal | big | giant | heightmap | minimap] [no_con] [size <width> <height>] [<filename>]'");
 
		IConsoleHelp("'viewport' (default) makes a screenshot of the current viewport (including menus, windows, ..), "
 
				"'normal' makes a screenshot of the visible area, "
 
				"'big' makes a zoomed-in screenshot of the visible area, "
 
				"'giant' makes a screenshot of the whole map, "
 
				"'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. "
 
				"'no_con' hides the console to create the screenshot (only useful in combination with 'viewport'). "
 
				"'size' sets the width and height of the viewport to make a screenshot of (only useful in combination with 'normal' or 'big').");
 
		return true;
 
	}
 

	
 
	if (argc > 7) return false;
 

	
 
	ScreenshotType type = SC_VIEWPORT;
 
	uint32 width = 0;
 
	uint32 height = 0;
 
	const char *name = nullptr;
 
@@ -1432,24 +1433,27 @@ DEF_CONSOLE_CMD(ConScreenShot)
 
		if (strcmp(argv[arg_index], "viewport") == 0) {
 
			type = SC_VIEWPORT;
 
			arg_index += 1;
 
		} else if (strcmp(argv[arg_index], "normal") == 0) {
 
			type = SC_DEFAULTZOOM;
 
			arg_index += 1;
 
		} else if (strcmp(argv[arg_index], "big") == 0) {
 
			type = SC_ZOOMEDIN;
 
			arg_index += 1;
 
		} else if (strcmp(argv[arg_index], "giant") == 0) {
 
			type = SC_WORLD;
 
			arg_index += 1;
 
		} else if (strcmp(argv[arg_index], "heightmap") == 0) {
 
			type = SC_HEIGHTMAP;
 
			arg_index += 1;
 
		} else if (strcmp(argv[arg_index], "minimap") == 0) {
 
			type = SC_MINIMAP;
 
			arg_index += 1;
 
		}
 
	}
 

	
 
	if (argc > arg_index && strcmp(argv[arg_index], "no_con") == 0) {
 
		if (type != SC_VIEWPORT) {
 
			IConsoleError("'no_con' can only be used in combination with 'viewport'");
 
			return true;
 
		}
 
		IConsoleClose();
0 comments (0 inline, 0 general)