Minimap screenshot: add console params and help to mostly match screenshot.
This commit is contained in:
@@ -49,8 +49,6 @@ static bool _script_running; ///< Script is running (used to abort execution whe
|
||||
#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[])
|
||||
#define DEF_CONSOLE_HOOK(function) static ConsoleHookResult function(bool echo)
|
||||
|
||||
void SaveMinimap();
|
||||
|
||||
/****************
|
||||
* command hooks
|
||||
****************/
|
||||
@@ -1393,7 +1391,24 @@ DEF_CONSOLE_CMD(ConScreenShot)
|
||||
|
||||
DEF_CONSOLE_CMD(ConMinimap)
|
||||
{
|
||||
SaveMinimap();
|
||||
if (argc == 0) {
|
||||
IConsoleHelp("Create a flat image of the game minimap. Usage: 'minimap [owner] [file name]'");
|
||||
IConsoleHelp("'owner' uses the tile owner to colour the minimap image, this is the only mode at present");
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *name = NULL;
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "owner") != 0) {
|
||||
/* invalid mode */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (argc > 2) {
|
||||
name = argv[2];
|
||||
}
|
||||
|
||||
SaveMinimap(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -924,7 +924,7 @@ static void MinimapOwnerCallback(void *userdata, void *buf, uint y, uint pitch,
|
||||
/**
|
||||
* Saves the complete savemap in a PNG-file.
|
||||
*/
|
||||
void SaveMinimap()
|
||||
void SaveMinimap(const char *name)
|
||||
{
|
||||
/* setup owner table */
|
||||
const Company *c;
|
||||
@@ -941,6 +941,9 @@ void SaveMinimap()
|
||||
_colour_gradient[c->colour][5] * 0x01010101;
|
||||
}
|
||||
|
||||
_screenshot_name[0] = '\0';
|
||||
if (name != NULL) strecpy(_screenshot_name, name, lastof(_screenshot_name));
|
||||
|
||||
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
|
||||
sf->proc(MakeScreenshotName("minimap", sf->extension), MinimapOwnerCallback, NULL, MapSizeX(), MapSizeY(), 32, _cur_palette.palette);
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ enum ScreenshotType {
|
||||
void SetupScreenshotViewport(ScreenshotType t, struct ViewPort *vp);
|
||||
bool MakeHeightmapScreenshot(const char *filename);
|
||||
bool MakeScreenshot(ScreenshotType t, const char *name);
|
||||
void SaveMinimap(const char *name);
|
||||
|
||||
extern char _screenshot_format_name[8];
|
||||
extern uint _num_screenshot_formats;
|
||||
|
Reference in New Issue
Block a user