mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
add shortcut versions and rotate clockwise/anticlockwise shortcut
This commit is contained in:
@@ -2500,7 +2500,7 @@ STR_2495 :Cancel construction mode
|
|||||||
STR_2496 :Pause game
|
STR_2496 :Pause game
|
||||||
STR_2497 :Zoom view out
|
STR_2497 :Zoom view out
|
||||||
STR_2498 :Zoom view in
|
STR_2498 :Zoom view in
|
||||||
STR_2499 :Rotate view
|
STR_2499 :Rotate view clockwise
|
||||||
STR_2500 :Rotate construction object
|
STR_2500 :Rotate construction object
|
||||||
STR_2501 :Underground view toggle
|
STR_2501 :Underground view toggle
|
||||||
STR_2502 :Remove base land toggle
|
STR_2502 :Remove base land toggle
|
||||||
@@ -3790,3 +3790,4 @@ STR_5453 :Select another ride
|
|||||||
STR_5454 :Uncap FPS
|
STR_5454 :Uncap FPS
|
||||||
STR_5458 :Rotate clockwise
|
STR_5458 :Rotate clockwise
|
||||||
STR_5459 :Rotate anti-clockwise
|
STR_5459 :Rotate anti-clockwise
|
||||||
|
STR_5460 :Rotate view anti-clockwise
|
||||||
|
|||||||
34
src/config.c
34
src/config.c
@@ -914,18 +914,23 @@ void config_dat_save()
|
|||||||
|
|
||||||
#pragma region Shortcuts
|
#pragma region Shortcuts
|
||||||
|
|
||||||
|
#define SHIFT 0x100
|
||||||
|
#define CTRL 0x200
|
||||||
|
#define ALT 0x400
|
||||||
|
|
||||||
// Current keyboard shortcuts
|
// Current keyboard shortcuts
|
||||||
uint16 gShortcutKeys[SHORTCUT_COUNT];
|
uint16 gShortcutKeys[SHORTCUT_COUNT];
|
||||||
|
|
||||||
// Default keyboard shortcuts
|
// Default keyboard shortcuts
|
||||||
static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = {
|
static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = {
|
||||||
SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_TOP_MOST_WINDOW
|
SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_TOP_MOST_WINDOW
|
||||||
0x0100 | SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS
|
SHIFT | SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS
|
||||||
SDL_SCANCODE_ESCAPE, // SHORTCUT_CANCEL_CONSTRUCTION_MODE
|
SDL_SCANCODE_ESCAPE, // SHORTCUT_CANCEL_CONSTRUCTION_MODE
|
||||||
SDL_SCANCODE_PAUSE, // SHORTCUT_PAUSE_GAME
|
SDL_SCANCODE_PAUSE, // SHORTCUT_PAUSE_GAME
|
||||||
SDL_SCANCODE_PAGEUP, // SHORTCUT_ZOOM_VIEW_OUT
|
SDL_SCANCODE_PAGEUP, // SHORTCUT_ZOOM_VIEW_OUT
|
||||||
SDL_SCANCODE_PAGEDOWN, // SHORTCUT_ZOOM_VIEW_IN
|
SDL_SCANCODE_PAGEDOWN, // SHORTCUT_ZOOM_VIEW_IN
|
||||||
SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW
|
SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_CLOCKWISE
|
||||||
|
SHIFT | SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE
|
||||||
SDL_SCANCODE_Z, // SHORTCUT_ROTATE_CONSTRUCTION_OBJECT
|
SDL_SCANCODE_Z, // SHORTCUT_ROTATE_CONSTRUCTION_OBJECT
|
||||||
SDL_SCANCODE_1, // SHORTCUT_UNDERGROUND_VIEW_TOGGLE
|
SDL_SCANCODE_1, // SHORTCUT_UNDERGROUND_VIEW_TOGGLE
|
||||||
SDL_SCANCODE_H, // SHORTCUT_REMOVE_BASE_LAND_TOGGLE
|
SDL_SCANCODE_H, // SHORTCUT_REMOVE_BASE_LAND_TOGGLE
|
||||||
@@ -950,15 +955,17 @@ static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = {
|
|||||||
SDL_SCANCODE_S, // SHORTCUT_SHOW_STAFF_LIST
|
SDL_SCANCODE_S, // SHORTCUT_SHOW_STAFF_LIST
|
||||||
SDL_SCANCODE_M, // SHORTCUT_SHOW_RECENT_MESSAGES
|
SDL_SCANCODE_M, // SHORTCUT_SHOW_RECENT_MESSAGES
|
||||||
SDL_SCANCODE_TAB, // SHORTCUT_SHOW_MAP
|
SDL_SCANCODE_TAB, // SHORTCUT_SHOW_MAP
|
||||||
0x0200 | SDL_SCANCODE_S, // SHORTCUT_SCREENSHOT
|
CTRL | SDL_SCANCODE_S, // SHORTCUT_SCREENSHOT
|
||||||
|
|
||||||
// New
|
// New
|
||||||
SDL_SCANCODE_MINUS, // SHORTCUT_REDUCE_GAME_SPEED,
|
SDL_SCANCODE_MINUS, // SHORTCUT_REDUCE_GAME_SPEED,
|
||||||
SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED,
|
SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED,
|
||||||
0x0200 | 0x0400 | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
|
CTRL | ALT | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
|
||||||
SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
|
SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SHORTCUT_FILE_VERSION 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x006E3604
|
* rct2: 0x006E3604
|
||||||
@@ -978,13 +985,19 @@ bool config_shortcut_keys_load()
|
|||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int result;
|
bool result;
|
||||||
|
uint16 version;
|
||||||
|
|
||||||
config_shortcut_keys_get_path(path);
|
config_shortcut_keys_get_path(path);
|
||||||
|
|
||||||
file = fopen(path, "rb");
|
file = fopen(path, "rb");
|
||||||
if (file != NULL) {
|
if (file != NULL) {
|
||||||
result = fread(gShortcutKeys, sizeof(gShortcutKeys), 1, file) == 1;
|
result = fread(&version, sizeof(version), 1, file) == 1;
|
||||||
|
if (result && version == SHORTCUT_FILE_VERSION) {
|
||||||
|
result = fread(gShortcutKeys, sizeof(gShortcutKeys), 1, file) == 1;
|
||||||
|
} else {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
} else {
|
} else {
|
||||||
result = false;
|
result = false;
|
||||||
@@ -995,15 +1008,20 @@ bool config_shortcut_keys_load()
|
|||||||
|
|
||||||
bool config_shortcut_keys_save()
|
bool config_shortcut_keys_save()
|
||||||
{
|
{
|
||||||
|
const uint16 version = SHORTCUT_FILE_VERSION;
|
||||||
|
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int result;
|
bool result;
|
||||||
|
|
||||||
config_shortcut_keys_get_path(path);
|
config_shortcut_keys_get_path(path);
|
||||||
|
|
||||||
file = fopen(path, "wb");
|
file = fopen(path, "wb");
|
||||||
if (file != NULL) {
|
if (file != NULL) {
|
||||||
result = fwrite(gShortcutKeys, sizeof(gShortcutKeys), 1, file) == 1;
|
result = fwrite(&version, sizeof(version), 1, file) == 1;
|
||||||
|
if (result) {
|
||||||
|
result = fwrite(gShortcutKeys, sizeof(gShortcutKeys), 1, file) == 1;
|
||||||
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
} else {
|
} else {
|
||||||
result = false;
|
result = false;
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ enum {
|
|||||||
SHORTCUT_PAUSE_GAME,
|
SHORTCUT_PAUSE_GAME,
|
||||||
SHORTCUT_ZOOM_VIEW_OUT,
|
SHORTCUT_ZOOM_VIEW_OUT,
|
||||||
SHORTCUT_ZOOM_VIEW_IN,
|
SHORTCUT_ZOOM_VIEW_IN,
|
||||||
SHORTCUT_ROTATE_VIEW,
|
SHORTCUT_ROTATE_VIEW_CLOCKWISE,
|
||||||
|
SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE,
|
||||||
SHORTCUT_ROTATE_CONSTRUCTION_OBJECT,
|
SHORTCUT_ROTATE_CONSTRUCTION_OBJECT,
|
||||||
SHORTCUT_UNDERGROUND_VIEW_TOGGLE,
|
SHORTCUT_UNDERGROUND_VIEW_TOGGLE,
|
||||||
SHORTCUT_REMOVE_BASE_LAND_TOGGLE,
|
SHORTCUT_REMOVE_BASE_LAND_TOGGLE,
|
||||||
@@ -71,6 +72,7 @@ enum {
|
|||||||
SHORTCUT_INCREASE_GAME_SPEED,
|
SHORTCUT_INCREASE_GAME_SPEED,
|
||||||
SHORTCUT_OPEN_CHEAT_WINDOW,
|
SHORTCUT_OPEN_CHEAT_WINDOW,
|
||||||
SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
|
SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
|
||||||
|
|
||||||
|
|
||||||
SHORTCUT_COUNT
|
SHORTCUT_COUNT
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -155,12 +155,18 @@ static void shortcut_zoom_view_in()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shortcut_rotate_view()
|
static void shortcut_rotate_view_clockwise()
|
||||||
{
|
{
|
||||||
rct_window* w = window_get_main();
|
rct_window* w = window_get_main();
|
||||||
window_rotate_camera(w, 1);
|
window_rotate_camera(w, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void shortcut_rotate_view_anticlockwise()
|
||||||
|
{
|
||||||
|
rct_window* w = window_get_main();
|
||||||
|
window_rotate_camera(w, -1);
|
||||||
|
}
|
||||||
|
|
||||||
static void shortcut_rotate_construction_object()
|
static void shortcut_rotate_construction_object()
|
||||||
{
|
{
|
||||||
rct_window *w;
|
rct_window *w;
|
||||||
@@ -468,7 +474,8 @@ static const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
|
|||||||
shortcut_pause_game,
|
shortcut_pause_game,
|
||||||
shortcut_zoom_view_out,
|
shortcut_zoom_view_out,
|
||||||
shortcut_zoom_view_in,
|
shortcut_zoom_view_in,
|
||||||
shortcut_rotate_view,
|
shortcut_rotate_view_clockwise,
|
||||||
|
shortcut_rotate_view_anticlockwise,
|
||||||
shortcut_rotate_construction_object,
|
shortcut_rotate_construction_object,
|
||||||
shortcut_underground_view_toggle,
|
shortcut_underground_view_toggle,
|
||||||
shortcut_remove_base_land_toggle,
|
shortcut_remove_base_land_toggle,
|
||||||
|
|||||||
@@ -1159,7 +1159,7 @@ enum {
|
|||||||
STR_SHORTCUT_PAUSE_GAME = 2496,
|
STR_SHORTCUT_PAUSE_GAME = 2496,
|
||||||
STR_SHORTCUT_ZOOM_VIEW_OUT = 2497,
|
STR_SHORTCUT_ZOOM_VIEW_OUT = 2497,
|
||||||
STR_SHORTCUT_ZOOM_VIEW_IN = 2498,
|
STR_SHORTCUT_ZOOM_VIEW_IN = 2498,
|
||||||
STR_SHORTCUT_ROTATE_VIEW = 2499,
|
STR_SHORTCUT_ROTATE_VIEW_CLOCKWISE = 2499,
|
||||||
STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT = 2500,
|
STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT = 2500,
|
||||||
STR_SHORTCUT_UNDERGROUND_VIEW_TOGGLE = 2501,
|
STR_SHORTCUT_UNDERGROUND_VIEW_TOGGLE = 2501,
|
||||||
STR_SHORTCUT_REMOVE_BASE_LAND_TOGGLE = 2502,
|
STR_SHORTCUT_REMOVE_BASE_LAND_TOGGLE = 2502,
|
||||||
@@ -1774,6 +1774,8 @@ enum {
|
|||||||
|
|
||||||
STR_SELECT_OTHER_RIDE = 5453,
|
STR_SELECT_OTHER_RIDE = 5453,
|
||||||
|
|
||||||
|
STR_SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE = 5460,
|
||||||
|
|
||||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||||
STR_COUNT = 32768
|
STR_COUNT = 32768
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ const rct_string_id ShortcutStringIds[] = {
|
|||||||
STR_SHORTCUT_PAUSE_GAME,
|
STR_SHORTCUT_PAUSE_GAME,
|
||||||
STR_SHORTCUT_ZOOM_VIEW_OUT,
|
STR_SHORTCUT_ZOOM_VIEW_OUT,
|
||||||
STR_SHORTCUT_ZOOM_VIEW_IN,
|
STR_SHORTCUT_ZOOM_VIEW_IN,
|
||||||
STR_SHORTCUT_ROTATE_VIEW,
|
STR_SHORTCUT_ROTATE_VIEW_CLOCKWISE,
|
||||||
|
STR_SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE,
|
||||||
STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT,
|
STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT,
|
||||||
STR_SHORTCUT_UNDERGROUND_VIEW_TOGGLE,
|
STR_SHORTCUT_UNDERGROUND_VIEW_TOGGLE,
|
||||||
STR_SHORTCUT_REMOVE_BASE_LAND_TOGGLE,
|
STR_SHORTCUT_REMOVE_BASE_LAND_TOGGLE,
|
||||||
|
|||||||
Reference in New Issue
Block a user