diff --git a/distribution/changelog.txt b/distribution/changelog.txt index aebe130239..e3e497082b 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -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. diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 013421fbd5..a9652823fa 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -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",