Add a "current_rotation" variable to the console (#8080)

This is a value from 0-3 showing current rotation of main window, 3
being the default and lower going counter clockwise. Possible to set as
well.
This commit is contained in:
tombomp 2018-10-14 22:44:45 +01:00 committed by Michał Janiszewski
parent bce5c02fb7
commit 18307e3841
2 changed files with 21 additions and 0 deletions

View File

@ -6,6 +6,7 @@
- Feature: [#7971] Toolbox option to open custom content folder.
- Feature: [#7980] Allow data path for RCT1 to be specified by a command line argument.
- Feature: [#8078] Add save_park command to in-game console.
- Feature: [#8080] New console variable "current_rotation" to get or set view rotation.
- Fix: [#6191] OpenRCT2 fails to run when the path has an emoji in it.
- Fix: [#7828] Copied entrances and exits stay when demolishing ride.
- Fix: [#7945] Client IP address is logged as `(null)` in server logs.

View File

@ -626,6 +626,10 @@ static int32_t cc_get(InteractiveConsole& console, const utf8** argv, int32_t ar
{
console.WriteFormatLine("cheat_disable_support_limits %d", gCheatsDisableSupportLimits);
}
else if (strcmp(argv[0], "current_rotation") == 0)
{
console.WriteFormatLine("current_rotation %d", get_current_rotation());
}
#ifndef NO_TTF
else if (strcmp(argv[0], "enable_hinting") == 0)
{
@ -938,6 +942,21 @@ static int32_t cc_set(InteractiveConsole& console, const utf8** argv, int32_t ar
}
console.Execute("get cheat_disable_support_limits");
}
else if (strcmp(argv[0], "current_rotation") == 0 && invalidArguments(&invalidArgs, int_valid[0]))
{
uint8_t currentRotation = get_current_rotation();
rct_window* mainWindow = window_get_main();
int32_t newRotation = int_val[0];
if (newRotation < 0 || newRotation > 3)
{
console.WriteLineError("Invalid argument. Valid rotations are 0-3.");
}
else if (newRotation != currentRotation && mainWindow != nullptr)
{
window_rotate_camera(mainWindow, newRotation - currentRotation);
}
console.Execute("get current_rotation");
}
#ifndef NO_TTF
else if (strcmp(argv[0], "enable_hinting") == 0 && invalidArguments(&invalidArgs, int_valid[0]))
{
@ -1320,6 +1339,7 @@ static constexpr const utf8* console_variable_table[] = {
"cheat_sandbox_mode",
"cheat_disable_clearance_checks",
"cheat_disable_support_limits",
"current_rotation",
};
static constexpr const utf8* console_window_table[] = {
"object_selection",