diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 2d391f278d..6983860660 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -28,6 +28,7 @@ #include "../localisation/localisation.h" #include "../platform/platform.h" #include "../util/util.h" +#include "../world/Climate.h" #include "viewport.h" using namespace OpenRCT2; @@ -347,21 +348,22 @@ sint32 cmdline_for_gfxbench(const char **argv, sint32 argc) sint32 cmdline_for_screenshot(const char **argv, sint32 argc) { - bool giantScreenshot = argc == 5 && _stricmp(argv[2], "giant") == 0; - if (argc != 4 && argc != 8 && !giantScreenshot) { - printf("Usage: openrct2 screenshot [ ]\n"); - printf("Usage: openrct2 screenshot giant \n"); + bool giantScreenshot = (argc == 5 || argc == 6) && _stricmp(argv[2], "giant") == 0; + if (argc != 4 && argc != 5 && argc != 8 && argc != 9 && !giantScreenshot) { + printf("Usage: openrct2 screenshot [ ] []\n"); + printf("Usage: openrct2 screenshot giant []\n"); return -1; } bool customLocation = false; bool centreMapX = false; bool centreMapY = false; - sint32 resolutionWidth, resolutionHeight, customX = 0, customY = 0, customZoom, customRotation = 0; + sint32 resolutionWidth, resolutionHeight, customX = 0, customY = 0, customZoom, customRotation = 0, customWeather = -1; const char *inputPath = argv[0]; const char *outputPath = argv[1]; - if (giantScreenshot) { + if (giantScreenshot) + { resolutionWidth = 0; resolutionHeight = 0; customLocation = true; @@ -369,10 +371,15 @@ sint32 cmdline_for_screenshot(const char **argv, sint32 argc) centreMapY = true; customZoom = atoi(argv[3]); customRotation = atoi(argv[4]) & 3; - } else { + if (argc == 6) + customWeather = atoi(argv[5]); + } + else + { resolutionWidth = atoi(argv[2]); resolutionHeight = atoi(argv[3]); - if (argc == 8) { + if (argc >= 8) + { customLocation = true; if (argv[4][0] == 'c') centreMapX = true; @@ -385,8 +392,14 @@ sint32 cmdline_for_screenshot(const char **argv, sint32 argc) customZoom = atoi(argv[6]); customRotation = atoi(argv[7]) & 3; - } else { + if (argc == 9) + customWeather = atoi(argv[8]); + } + else + { customZoom = 0; + if (argc == 5) + customWeather = atoi(argv[4]); } } @@ -457,6 +470,17 @@ sint32 cmdline_for_screenshot(const char **argv, sint32 argc) gCurrentRotation = gSavedViewRotation; } + if (customWeather != -1) + { + if (customWeather < -1 || customWeather >= 6) + { + printf("Weather can only be set to an integer value from 0 till 5."); + return -1; + } + + climate_force_weather(customWeather); + } + // Ensure sprites appear regardless of rotation reset_all_sprite_quadrant_placements();