1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Add optional screenshot argument to set weather

This commit is contained in:
Hielke Morsink
2017-11-21 00:29:24 +01:00
parent a1c1842a52
commit 9452457bf9

View File

@@ -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 <file> <ouput_image> <width> <height> [<x> <y> <zoom> <rotation>]\n");
printf("Usage: openrct2 screenshot <file> <ouput_image> giant <zoom> <rotation>\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 <file> <ouput_image> <width> <height> [<x> <y> <zoom> <rotation>] [<weather>]\n");
printf("Usage: openrct2 screenshot <file> <ouput_image> giant <zoom> <rotation> [<weather>]\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();