mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 05:23:04 +01:00
@@ -3800,3 +3800,4 @@ STR_5463 :Goal: Have fun!
|
||||
STR_5464 :General
|
||||
STR_5465 :Climate
|
||||
STR_5466 :Staff
|
||||
STR_5467 :ALT +
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "../config.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "keyboard_shortcut.h"
|
||||
#include "viewport.h"
|
||||
#include "window.h"
|
||||
@@ -75,6 +76,26 @@ void keyboard_shortcut_handle_command(int shortcutIndex)
|
||||
shortcut_table[shortcutIndex]();
|
||||
}
|
||||
|
||||
void keyboard_shortcut_format_string(char *buffer, uint16 shortcutKey)
|
||||
{
|
||||
char *formatBuffer[256];
|
||||
|
||||
*buffer = 0;
|
||||
if (shortcutKey & 0x100) {
|
||||
format_string(formatBuffer, STR_SHIFT_PLUS, NULL);
|
||||
strcat(buffer, formatBuffer);
|
||||
}
|
||||
if (shortcutKey & 0x200) {
|
||||
format_string(formatBuffer, STR_CTRL_PLUS, NULL);
|
||||
strcat(buffer, formatBuffer);
|
||||
}
|
||||
if (shortcutKey & 0x400) {
|
||||
format_string(formatBuffer, STR_ALT_PLUS, NULL);
|
||||
strcat(buffer, formatBuffer);
|
||||
}
|
||||
strcat(buffer, SDL_GetScancodeName(shortcutKey & 0xFF));
|
||||
}
|
||||
|
||||
#pragma region Shortcut Commands
|
||||
|
||||
static void toggle_view_flag(int viewportFlag)
|
||||
|
||||
@@ -24,5 +24,6 @@
|
||||
void keyboard_shortcut_set(int key);
|
||||
void keyboard_shortcut_handle(int key);
|
||||
void keyboard_shortcut_handle_command(int shortcutIndex);
|
||||
void keyboard_shortcut_format_string(char *buffer, uint16 shortcutKey);
|
||||
|
||||
#endif
|
||||
@@ -1795,6 +1795,8 @@ enum {
|
||||
STR_CHEAT_CLIMATE_GROUP = 5465,
|
||||
STR_CHEAT_STAFF_GROUP = 5466,
|
||||
|
||||
STR_ALT_PLUS = 5467,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
STR_COUNT = 32768
|
||||
};
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../interface/themes.h"
|
||||
|
||||
extern const rct_string_id ShortcutStringIds[];
|
||||
|
||||
#define WW 250
|
||||
#define WH 60
|
||||
|
||||
@@ -119,6 +121,6 @@ static void window_shortcut_change_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
int x = w->x + 125;
|
||||
int y = w->y + 30;
|
||||
|
||||
RCT2_GLOBAL(0x13CE952, uint16) = 2493 + RCT2_GLOBAL(0x9DE511, uint8);
|
||||
gfx_draw_string_centred_wrapped(dpi, (void*)0x13CE952, x, y, 242, 2785, RCT2_GLOBAL(0x9DEB8D, uint8));
|
||||
RCT2_GLOBAL(0x13CE952, uint16) = ShortcutStringIds[RCT2_GLOBAL(0x009DE511, uint8)];
|
||||
gfx_draw_string_centred_wrapped(dpi, (void*)0x013CE952, x, y, 242, 2785, RCT2_GLOBAL(0x9DEB8D, uint8));
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "../interface/widget.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "../interface/keyboard_shortcut.h"
|
||||
#include "../interface/themes.h"
|
||||
|
||||
#define WW 340
|
||||
@@ -247,27 +248,13 @@ static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, i
|
||||
gfx_fill_rect(dpi, 0, y, 800, y + 9, 0x2000031);
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(0x13CE954, uint16) = ShortcutStringIds[i];
|
||||
RCT2_GLOBAL(0x13CE956, uint16) = 0;
|
||||
RCT2_GLOBAL(0x13CE958, uint16) = 0;
|
||||
|
||||
uint16 shortcut_entry = gShortcutKeys[i];
|
||||
if (shortcut_entry != 0xFFFF) {
|
||||
rct_string_id templateStringId = 2525;
|
||||
const char *scanCodeName = SDL_GetScancodeName(shortcut_entry & 0xFF);
|
||||
char *templateString = (char*)language_get_string(templateStringId);
|
||||
strcpy(templateString, scanCodeName);
|
||||
|
||||
RCT2_GLOBAL(0x13CE958, uint16) = templateStringId;
|
||||
|
||||
// Display the modifer
|
||||
if (shortcut_entry & 0x100)
|
||||
RCT2_GLOBAL(0x13CE956, uint16) = STR_SHIFT_PLUS;
|
||||
else if (shortcut_entry & 0x200)
|
||||
RCT2_GLOBAL(0x13CE956, uint16) = STR_CTRL_PLUS;
|
||||
}
|
||||
rct_string_id templateStringId = 2525;
|
||||
char *templateString = (char*)language_get_string(templateStringId);
|
||||
keyboard_shortcut_format_string(templateString, gShortcutKeys[i]);
|
||||
|
||||
RCT2_GLOBAL(0x13CE952, uint16) = STR_SHORTCUT_ENTRY_FORMAT;
|
||||
RCT2_GLOBAL(0x13CE954, uint16) = ShortcutStringIds[i];
|
||||
RCT2_GLOBAL(0x13CE956, uint16) = templateStringId;
|
||||
gfx_draw_string_left(dpi, format, (void*)0x13CE952, 0, 0, y - 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user