Move keyboard shortcut code to libopenrct2ui.

This commit is contained in:
Ted John 2017-06-11 12:30:00 +01:00
parent c8e4e6dae1
commit dfa1b47a4f
14 changed files with 779 additions and 340 deletions

View File

@ -32,6 +32,7 @@
#include <openrct2/Version.h>
#include "CursorRepository.h"
#include "drawing/engines/DrawingEngines.h"
#include "input/KeyboardShortcuts.h"
#include "SDLException.h"
#include "TextComposition.h"
#include "UiContext.h"
@ -45,6 +46,7 @@ extern "C"
using namespace OpenRCT2;
using namespace OpenRCT2::Drawing;
using namespace OpenRCT2::Input;
using namespace OpenRCT2::Ui;
#ifdef __MACOSX__
@ -59,7 +61,6 @@ class UiContext final : public IUiContext
private:
constexpr static uint32 TOUCH_DOUBLE_TIMEOUT = 300;
IPlatformEnvironment * const _env;
IPlatformUiContext * const _platformUiContext;
CursorRepository _cursorRepository;
@ -76,27 +77,27 @@ private:
bool _steamOverlayActive = false;
// Input
TextComposition _textComposition;
CursorState _cursorState = { 0 };
uint32 _lastKeyPressed = 0;
const uint8 * _keysState = nullptr;
uint8 _keysPressed[256] = { 0 };
uint32 _lastGestureTimestamp = 0;
float _gestureRadius = 0;
KeyboardShortcuts _keyboardShortcuts;
TextComposition _textComposition;
CursorState _cursorState = { 0 };
uint32 _lastKeyPressed = 0;
const uint8 * _keysState = nullptr;
uint8 _keysPressed[256] = { 0 };
uint32 _lastGestureTimestamp = 0;
float _gestureRadius = 0;
public:
UiContext(IPlatformEnvironment * env)
: _env(env),
_platformUiContext(CreatePlatformUiContext())
: _platformUiContext(CreatePlatformUiContext()),
_keyboardShortcuts(env)
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
SDLException::Throw("SDL_Init(SDL_INIT_VIDEO)");
}
_cursorRepository.LoadCursors();
// Temporary to prevent warning, will be used for keyboard shortcuts
UNUSED(_env);
_keyboardShortcuts.Reset();
_keyboardShortcuts.Load();
}
~UiContext() override

View File

@ -0,0 +1,262 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include <openrct2/common.h>
#include <SDL.h>
#include <openrct2/core/Console.hpp>
#include <openrct2/core/File.h>
#include <openrct2/core/FileStream.hpp>
#include <openrct2/core/Memory.hpp>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/PlatformEnvironment.h>
#include "KeyboardShortcuts.h"
extern "C"
{
#include <openrct2/localisation/localisation.h>
}
using namespace OpenRCT2;
using namespace OpenRCT2::Input;
// Remove when the C calls are removed
static KeyboardShortcuts * _instance;
KeyboardShortcuts::KeyboardShortcuts(IPlatformEnvironment * env)
: _env(env)
{
_instance = this;
}
void KeyboardShortcuts::Reset()
{
for (size_t i = 0; i < SHORTCUT_COUNT; i++)
{
_keys[i] = DefaultKeys[i];
}
}
bool KeyboardShortcuts::Load()
{
bool result = false;
try
{
std::string path = _env->GetFilePath(PATHID::CONFIG_KEYBOARD);
if (File::Exists(path))
{
auto fs = FileStream(path, FILE_MODE_OPEN);
uint16 version = fs.ReadValue<uint16>();
if (version == KeyboardShortcuts::CURRENT_FILE_VERSION)
{
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
_keys[i] = fs.ReadValue<uint16>();
}
result = true;
}
}
}
catch (const Exception &ex)
{
Console::WriteLine("Error reading shortcut keys: %s", ex.GetMessage());
}
return result;
}
bool KeyboardShortcuts::Save()
{
bool result = false;
try
{
std::string path = _env->GetFilePath(PATHID::CONFIG_KEYBOARD);
auto fs = FileStream(path, FILE_MODE_WRITE);
fs.WriteValue<uint16>(KeyboardShortcuts::CURRENT_FILE_VERSION);
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
fs.WriteValue<uint16>(_keys[i]);
}
result = true;
}
catch (const Exception &ex)
{
Console::WriteLine("Error writing shortcut keys: %s", ex.GetMessage());
}
return result;
}
void KeyboardShortcuts::Set(sint32 key)
{
// Unmap shortcut that already uses this key
sint32 shortcut = GetFromKey(key);
if (shortcut != SHORTCUT_UNDEFINED)
{
_keys[shortcut] = SHORTCUT_UNDEFINED;
}
// Map shortcut to this key
_keys[gKeyboardShortcutChangeId] = key;
// window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
// window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
Save();
}
sint32 KeyboardShortcuts::GetFromKey(sint32 key)
{
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
if (key == _keys[i])
{
return i;
}
}
return SHORTCUT_UNDEFINED;
}
std::string KeyboardShortcuts::GetShortcutString(sint32 shortcut) const
{
utf8 buffer[256] = { 0 };
utf8 formatBuffer[256] = { 0 };
uint16 shortcutKey = _keys[shortcut];
if (shortcutKey == SHORTCUT_UNDEFINED) return std::string();
if (shortcutKey & SHIFT)
{
format_string(formatBuffer, sizeof(formatBuffer), STR_SHIFT_PLUS, NULL);
String::Append(buffer, sizeof(buffer), formatBuffer);
}
if (shortcutKey & CTRL)
{
format_string(formatBuffer, sizeof(formatBuffer), STR_CTRL_PLUS, NULL);
String::Append(buffer, sizeof(buffer), formatBuffer);
}
if (shortcutKey & ALT)
{
#ifdef __MACOSX__
format_string(formatBuffer, sizeof(formatBuffer), STR_OPTION_PLUS, NULL);
#else
format_string(formatBuffer, sizeof(formatBuffer), STR_ALT_PLUS, NULL);
#endif
String::Append(buffer, sizeof(buffer), formatBuffer);
}
if (shortcutKey & CMD)
{
format_string(formatBuffer, sizeof(formatBuffer), STR_CMD_PLUS, NULL);
String::Append(buffer, sizeof(buffer), formatBuffer);
}
String::Append(buffer, sizeof(buffer), SDL_GetScancodeName((SDL_Scancode)(shortcutKey & 0xFF)));
return std::string(buffer);
}
extern "C"
{
void keyboard_shortcuts_reset()
{
_instance->Reset();
}
bool keyboard_shortcuts_load()
{
return _instance->Load();
}
bool keyboard_shortcuts_save()
{
return _instance->Save();
}
void keyboard_shortcuts_set(sint32 key)
{
return _instance->Set(key);
}
sint32 keyboard_shortcuts_get_from_key(sint32 key)
{
return _instance->GetFromKey(key);
}
void keyboard_shortcuts_format_string(char * buffer, size_t bufferSize, sint32 shortcut)
{
auto str = _instance->GetShortcutString(shortcut);
String::Set(buffer, bufferSize, str.c_str());
}
}
// Default keyboard shortcuts
const uint16 KeyboardShortcuts::DefaultKeys[SHORTCUT_COUNT] =
{
SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_TOP_MOST_WINDOW
SHIFT | SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS
SDL_SCANCODE_ESCAPE, // SHORTCUT_CANCEL_CONSTRUCTION_MODE
SDL_SCANCODE_PAUSE, // SHORTCUT_PAUSE_GAME
SDL_SCANCODE_PAGEUP, // SHORTCUT_ZOOM_VIEW_OUT
SDL_SCANCODE_PAGEDOWN, // SHORTCUT_ZOOM_VIEW_IN
SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_CLOCKWISE
SHIFT | SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE
SDL_SCANCODE_Z, // SHORTCUT_ROTATE_CONSTRUCTION_OBJECT
SDL_SCANCODE_1, // SHORTCUT_UNDERGROUND_VIEW_TOGGLE
SDL_SCANCODE_H, // SHORTCUT_REMOVE_BASE_LAND_TOGGLE
SDL_SCANCODE_V, // SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE
SDL_SCANCODE_3, // SHORTCUT_SEE_THROUGH_RIDES_TOGGLE
SDL_SCANCODE_4, // SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE
SDL_SCANCODE_5, // SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE
SDL_SCANCODE_6, // SHORTCUT_INVISIBLE_PEOPLE_TOGGLE
SDL_SCANCODE_8, // SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE
SDL_SCANCODE_9, // SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE
SDL_SCANCODE_0, // SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE
SDL_SCANCODE_F1, // SHORTCUT_ADJUST_LAND
SDL_SCANCODE_F2, // SHORTCUT_ADJUST_WATER
SDL_SCANCODE_F3, // SHORTCUT_BUILD_SCENERY
SDL_SCANCODE_F4, // SHORTCUT_BUILD_PATHS
SDL_SCANCODE_F5, // SHORTCUT_BUILD_NEW_RIDE
SDL_SCANCODE_F, // SHORTCUT_SHOW_FINANCIAL_INFORMATION
SDL_SCANCODE_D, // SHORTCUT_SHOW_RESEARCH_INFORMATION
SDL_SCANCODE_R, // SHORTCUT_SHOW_RIDES_LIST
SDL_SCANCODE_P, // SHORTCUT_SHOW_PARK_INFORMATION
SDL_SCANCODE_G, // SHORTCUT_SHOW_GUEST_LIST
SDL_SCANCODE_S, // SHORTCUT_SHOW_STAFF_LIST
SDL_SCANCODE_M, // SHORTCUT_SHOW_RECENT_MESSAGES
SDL_SCANCODE_TAB, // SHORTCUT_SHOW_MAP
PLATFORM_MODIFIER | SDL_SCANCODE_S, // SHORTCUT_SCREENSHOT
SDL_SCANCODE_MINUS, // SHORTCUT_REDUCE_GAME_SPEED,
SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED,
PLATFORM_MODIFIER | ALT | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SDL_SCANCODE_UP, // SHORTCUT_SCROLL_MAP_UP
SDL_SCANCODE_LEFT, // SHORTCUT_SCROLL_MAP_LEFT
SDL_SCANCODE_DOWN, // SHORTCUT_SCROLL_MAP_DOWN
SDL_SCANCODE_RIGHT, // SHORTCUT_SCROLL_MAP_RIGHT
SDL_SCANCODE_C, // SHORTCUT_OPEN_CHAT_WINDOW
PLATFORM_MODIFIER | SDL_SCANCODE_F10, // SHORTCUT_QUICK_SAVE_GAME
SHORTCUT_UNDEFINED, // SHORTCUT_SHOW_OPTIONS
SHORTCUT_UNDEFINED, // SHORTCUT_MUTE_SOUND
ALT | SDL_SCANCODE_RETURN, // SHORTCUT_WINDOWED_MODE_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_SHOW_MULTIPLAYER
SHORTCUT_UNDEFINED, // SHORTCUT_PAINT_ORIGINAL_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_DEBUG_PAINT_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_SEE_THROUGH_PATHS_TOGGLE
SDL_SCANCODE_KP_4, // SHORTCUT_RIDE_CONSTRUCTION_TURN_LEFT
SDL_SCANCODE_KP_6, // SHORTCUT_RIDE_CONSTRUCTION_TURN_RIGHT
SDL_SCANCODE_KP_5, // SHORTCUT_RIDE_CONSTRUCTION_USE_TRACK_DEFAULT
SDL_SCANCODE_KP_2, // SHORTCUT_RIDE_CONSTRUCTION_SLOPE_DOWN
SDL_SCANCODE_KP_8, // SHORTCUT_RIDE_CONSTRUCTION_SLOPE_UP
SDL_SCANCODE_KP_PLUS, // SHORTCUT_RIDE_CONSTRUCTION_CHAIN_LIFT_TOGGLE
SDL_SCANCODE_KP_1, // SHORTCUT_RIDE_CONSTRUCTION_BANK_LEFT
SDL_SCANCODE_KP_3, // SHORTCUT_RIDE_CONSTRUCTION_BANK_RIGHT
SDL_SCANCODE_KP_7, // SHORTCUT_RIDE_CONSTRUCTION_PREVIOUS_TRACK
SDL_SCANCODE_KP_9, // SHORTCUT_RIDE_CONSTRUCTION_NEXT_TRACK
SDL_SCANCODE_KP_0, // SHORTCUT_RIDE_CONSTRUCTION_BUILD_CURRENT
SDL_SCANCODE_KP_MINUS, // SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT
};

View File

@ -0,0 +1,78 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#pragma once
#include <openrct2/common.h>
#ifdef __cplusplus
extern "C"
{
#endif
#include "../input/keyboard_shortcut.h"
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#include <string>
namespace OpenRCT2
{
interface IPlatformEnvironment;
namespace Input
{
class KeyboardShortcuts
{
private:
constexpr static sint32 CURRENT_FILE_VERSION = 1;
static const uint16 DefaultKeys[SHORTCUT_COUNT];
IPlatformEnvironment * const _env;
uint16 _keys[SHORTCUT_COUNT];
public:
KeyboardShortcuts(IPlatformEnvironment * env);
void Reset();
bool Load();
bool Save();
std::string GetShortcutString(sint32 shortcut) const;
void Set(sint32 key);
sint32 GetFromKey(sint32 key);
};
}
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
void keyboard_shortcuts_reset();
bool keyboard_shortcuts_load();
bool keyboard_shortcuts_save();
void keyboard_shortcuts_set(sint32 key);
sint32 keyboard_shortcuts_get_from_key(sint32 key);
void keyboard_shortcuts_format_string(char * buffer, size_t bufferSize, sint32 shortcut);
#ifdef __cplusplus
}
#endif

View File

@ -14,24 +14,24 @@
*****************************************************************************/
#pragma endregion
#include "../audio/audio.h"
#include "../config/Config.h"
#include "../editor.h"
#include "../game.h"
#include "../input.h"
#include "../interface/chat.h"
#include "../interface/Screenshot.h"
#include "../localisation/localisation.h"
#include "../network/network.h"
#include "../platform/platform.h"
#include "../ride/track.h"
#include "../ride/track_paint.h"
#include "../title/TitleScreen.h"
#include "../util/util.h"
#include "keyboard_shortcut.h"
#include "viewport.h"
#include "widget.h"
#include "window.h"
#include <openrct2/audio/audio.h>
#include <openrct2/config/Config.h>
#include <openrct2/editor.h>
#include <openrct2/game.h>
#include <openrct2/input.h>
#include <openrct2/interface/chat.h>
#include <openrct2/interface/Screenshot.h>
#include <openrct2/localisation/localisation.h>
#include <openrct2/network/network.h>
#include <openrct2/platform/platform.h>
#include <openrct2/ride/track.h>
#include <openrct2/ride/track_paint.h>
#include <openrct2/title/TitleScreen.h>
#include <openrct2/util/util.h>
#include <openrct2/interface/viewport.h>
#include <openrct2/interface/widget.h>
#include <openrct2/interface/window.h>
#include "KeyboardShortcuts.h"
uint8 gKeyboardShortcutChangeId;
@ -39,46 +39,13 @@ typedef void (*shortcut_action)();
static const shortcut_action shortcut_table[SHORTCUT_COUNT];
/**
*
* rct2: 0x006E3E91
*/
void keyboard_shortcut_set(sint32 key)
{
sint32 i;
// Unmap shortcut that already uses this key
for (i = 0; i < SHORTCUT_COUNT; i++) {
if (key == gShortcutKeys[i]) {
gShortcutKeys[i] = SHORTCUT_UNDEFINED;
break;
}
}
// Map shortcut to this key
gShortcutKeys[gKeyboardShortcutChangeId] = key;
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
config_shortcut_keys_save();
}
static sint32 keyboard_shortcut_get_from_key(sint32 key)
{
for (sint32 i = 0; i < SHORTCUT_COUNT; i++) {
if (key == gShortcutKeys[i]) {
return i;
}
}
return -1;
}
/**
*
* rct2: 0x006E3E68
*/
void keyboard_shortcut_handle(sint32 key)
{
sint32 shortcut = keyboard_shortcut_get_from_key(key);
sint32 shortcut = keyboard_shortcuts_get_from_key(key);
if (shortcut != -1) {
keyboard_shortcut_handle_command(shortcut);
}
@ -94,36 +61,6 @@ void keyboard_shortcut_handle_command(sint32 shortcutIndex)
}
}
void keyboard_shortcut_format_string(char *buffer, size_t size, uint16 shortcutKey)
{
char formatBuffer[256];
if (size == 0) return;
*buffer = 0;
if (shortcutKey == SHORTCUT_UNDEFINED) return;
if (shortcutKey & 0x100) {
format_string(formatBuffer, 256, STR_SHIFT_PLUS, NULL);
safe_strcat(buffer, formatBuffer, size);
}
if (shortcutKey & 0x200) {
format_string(formatBuffer, 256, STR_CTRL_PLUS, NULL);
safe_strcat(buffer, formatBuffer, size);
}
if (shortcutKey & 0x400) {
#ifdef __MACOSX__
format_string(formatBuffer, 256, STR_OPTION_PLUS, NULL);
#else
format_string(formatBuffer, 256, STR_ALT_PLUS, NULL);
#endif
safe_strcat(buffer, formatBuffer, size);
}
if (shortcutKey & 0x800) {
format_string(formatBuffer, 256, STR_CMD_PLUS, NULL);
safe_strcat(buffer, formatBuffer, size);
}
safe_strcat(buffer, SDL_GetScancodeName(shortcutKey & 0xFF), size);
}
#pragma region Shortcut Commands
static void toggle_view_flag(sint32 viewportFlag)

View File

@ -17,7 +17,7 @@
#ifndef _INTERFACE_KEYBOARD_SHORTCUT_H_
#define _INTERFACE_KEYBOARD_SHORTCUT_H_
#include "../common.h"
#include <openrct2/common.h>
#define SHORTCUT_UNDEFINED 0xFFFF
@ -29,10 +29,6 @@ void keyboard_shortcut_handle(sint32 key);
void keyboard_shortcut_handle_command(sint32 shortcutIndex);
void keyboard_shortcut_format_string(char *buffer, size_t size, uint16 shortcutKey);
void config_reset_shortcut_keys();
bool config_shortcut_keys_load();
bool config_shortcut_keys_save();
typedef struct shortcut_entry {
uint8 key;
uint8 modifier;
@ -107,6 +103,14 @@ enum {
SHORTCUT_COUNT
};
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
#define SHIFT 0x100
#define CTRL 0x200
#define ALT 0x400
#define CMD 0x800
#ifdef __MACOSX__
#define PLATFORM_MODIFIER CMD
#else
#define PLATFORM_MODIFIER CTRL
#endif
#endif

View File

@ -41,11 +41,15 @@
<ClCompile Include="drawing\engines\opengl\SwapFramebuffer.cpp" />
<ClCompile Include="drawing\engines\opengl\TextureCache.cpp" />
<ClCompile Include="drawing\engines\SoftwareDrawingEngine.cpp" />
<ClCompile Include="input\KeyboardShortcuts.cpp" />
<ClCompile Include="input\keyboard_shortcut.c" />
<ClCompile Include="TextComposition.cpp" />
<ClCompile Include="Ui.cpp" />
<ClCompile Include="UiContext.cpp" />
<ClCompile Include="UiContext.Linux.cpp" />
<ClCompile Include="UiContext.Win32.cpp" />
<ClCompile Include="windows\shortcut_keys.c" />
<ClCompile Include="windows\shortcut_key_change.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="audio\AudioContext.h" />
@ -63,6 +67,8 @@
<ClInclude Include="drawing\engines\opengl\OpenGLShaderProgram.h" />
<ClInclude Include="drawing\engines\opengl\SwapFramebuffer.h" />
<ClInclude Include="drawing\engines\opengl\TextureCache.h" />
<ClInclude Include="input\KeyboardShortcuts.h" />
<ClInclude Include="input\keyboard_shortcut.h" />
<ClInclude Include="SDLException.h" />
<ClInclude Include="TextComposition.h" />
<ClInclude Include="Ui.h" />

View File

@ -14,11 +14,11 @@
*****************************************************************************/
#pragma endregion
#include "../config/Config.h"
#include "../interface/keyboard_shortcut.h"
#include "../interface/window.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include <openrct2/config/Config.h>
#include <openrct2/interface/window.h>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>
#include "../input/keyboard_shortcut.h"
extern const rct_string_id ShortcutStringIds[];

View File

@ -14,12 +14,12 @@
*****************************************************************************/
#pragma endregion
#include "../config/Config.h"
#include "../interface/window.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../platform/platform.h"
#include "../interface/keyboard_shortcut.h"
#include <openrct2/config/Config.h>
#include <openrct2/interface/window.h>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>
#include <openrct2/platform/platform.h>
#include "../input/KeyboardShortcuts.h"
#define WW 420
#define WH 280
@ -188,8 +188,8 @@ static void window_shortcut_mouseup(rct_window *w, rct_widgetindex widgetIndex)
window_close(w);
break;
case WIDX_RESET:
config_reset_shortcut_keys();
config_shortcut_keys_save();
keyboard_shortcuts_reset();
keyboard_shortcuts_save();
window_invalidate(w);
break;
}
@ -289,7 +289,7 @@ static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, s
}
char templateString[128];
keyboard_shortcut_format_string(templateString, 128, gShortcutKeys[i]);
keyboard_shortcuts_format_string(templateString, 128, i);
set_format_arg(0, rct_string_id, STR_SHORTCUT_ENTRY_FORMAT);
set_format_arg(2, rct_string_id, ShortcutStringIds[i]);

View File

@ -1,173 +0,0 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "../common.h"
#include "../core/Console.hpp"
#include "../core/File.h"
#include "../core/FileStream.hpp"
#include "../core/Memory.hpp"
#include "../core/Path.hpp"
#include "../core/String.hpp"
extern "C"
{
#include "../interface/keyboard_shortcut.h"
#include "../platform/platform.h"
}
// Current keyboard shortcuts
uint16 gShortcutKeys[SHORTCUT_COUNT];
namespace KeyboardShortcuts
{
// Default keyboard shortcuts
static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] =
{
SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_TOP_MOST_WINDOW
SHIFT | SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS
SDL_SCANCODE_ESCAPE, // SHORTCUT_CANCEL_CONSTRUCTION_MODE
SDL_SCANCODE_PAUSE, // SHORTCUT_PAUSE_GAME
SDL_SCANCODE_PAGEUP, // SHORTCUT_ZOOM_VIEW_OUT
SDL_SCANCODE_PAGEDOWN, // SHORTCUT_ZOOM_VIEW_IN
SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_CLOCKWISE
SHIFT | SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE
SDL_SCANCODE_Z, // SHORTCUT_ROTATE_CONSTRUCTION_OBJECT
SDL_SCANCODE_1, // SHORTCUT_UNDERGROUND_VIEW_TOGGLE
SDL_SCANCODE_H, // SHORTCUT_REMOVE_BASE_LAND_TOGGLE
SDL_SCANCODE_V, // SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE
SDL_SCANCODE_3, // SHORTCUT_SEE_THROUGH_RIDES_TOGGLE
SDL_SCANCODE_4, // SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE
SDL_SCANCODE_5, // SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE
SDL_SCANCODE_6, // SHORTCUT_INVISIBLE_PEOPLE_TOGGLE
SDL_SCANCODE_8, // SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE
SDL_SCANCODE_9, // SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE
SDL_SCANCODE_0, // SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE
SDL_SCANCODE_F1, // SHORTCUT_ADJUST_LAND
SDL_SCANCODE_F2, // SHORTCUT_ADJUST_WATER
SDL_SCANCODE_F3, // SHORTCUT_BUILD_SCENERY
SDL_SCANCODE_F4, // SHORTCUT_BUILD_PATHS
SDL_SCANCODE_F5, // SHORTCUT_BUILD_NEW_RIDE
SDL_SCANCODE_F, // SHORTCUT_SHOW_FINANCIAL_INFORMATION
SDL_SCANCODE_D, // SHORTCUT_SHOW_RESEARCH_INFORMATION
SDL_SCANCODE_R, // SHORTCUT_SHOW_RIDES_LIST
SDL_SCANCODE_P, // SHORTCUT_SHOW_PARK_INFORMATION
SDL_SCANCODE_G, // SHORTCUT_SHOW_GUEST_LIST
SDL_SCANCODE_S, // SHORTCUT_SHOW_STAFF_LIST
SDL_SCANCODE_M, // SHORTCUT_SHOW_RECENT_MESSAGES
SDL_SCANCODE_TAB, // SHORTCUT_SHOW_MAP
PLATFORM_MODIFIER | SDL_SCANCODE_S, // SHORTCUT_SCREENSHOT
SDL_SCANCODE_MINUS, // SHORTCUT_REDUCE_GAME_SPEED,
SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED,
PLATFORM_MODIFIER | ALT | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SDL_SCANCODE_UP, // SHORTCUT_SCROLL_MAP_UP
SDL_SCANCODE_LEFT, // SHORTCUT_SCROLL_MAP_LEFT
SDL_SCANCODE_DOWN, // SHORTCUT_SCROLL_MAP_DOWN
SDL_SCANCODE_RIGHT, // SHORTCUT_SCROLL_MAP_RIGHT
SDL_SCANCODE_C, // SHORTCUT_OPEN_CHAT_WINDOW
PLATFORM_MODIFIER | SDL_SCANCODE_F10, // SHORTCUT_QUICK_SAVE_GAME
SHORTCUT_UNDEFINED, // SHORTCUT_SHOW_OPTIONS
SHORTCUT_UNDEFINED, // SHORTCUT_MUTE_SOUND
ALT | SDL_SCANCODE_RETURN, // SHORTCUT_WINDOWED_MODE_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_SHOW_MULTIPLAYER
SHORTCUT_UNDEFINED, // SHORTCUT_PAINT_ORIGINAL_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_DEBUG_PAINT_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_SEE_THROUGH_PATHS_TOGGLE
SDL_SCANCODE_KP_4, // SHORTCUT_RIDE_CONSTRUCTION_TURN_LEFT
SDL_SCANCODE_KP_6, // SHORTCUT_RIDE_CONSTRUCTION_TURN_RIGHT
SDL_SCANCODE_KP_5, // SHORTCUT_RIDE_CONSTRUCTION_USE_TRACK_DEFAULT
SDL_SCANCODE_KP_2, // SHORTCUT_RIDE_CONSTRUCTION_SLOPE_DOWN
SDL_SCANCODE_KP_8, // SHORTCUT_RIDE_CONSTRUCTION_SLOPE_UP
SDL_SCANCODE_KP_PLUS, // SHORTCUT_RIDE_CONSTRUCTION_CHAIN_LIFT_TOGGLE
SDL_SCANCODE_KP_1, // SHORTCUT_RIDE_CONSTRUCTION_BANK_LEFT
SDL_SCANCODE_KP_3, // SHORTCUT_RIDE_CONSTRUCTION_BANK_RIGHT
SDL_SCANCODE_KP_7, // SHORTCUT_RIDE_CONSTRUCTION_PREVIOUS_TRACK
SDL_SCANCODE_KP_9, // SHORTCUT_RIDE_CONSTRUCTION_NEXT_TRACK
SDL_SCANCODE_KP_0, // SHORTCUT_RIDE_CONSTRUCTION_BUILD_CURRENT
SDL_SCANCODE_KP_MINUS, // SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT
};
constexpr sint32 CURRENT_FILE_VERSION = 1;
static void Reset()
{
Memory::Copy(gShortcutKeys, _defaultShortcutKeys, sizeof(gShortcutKeys));
}
static std::string GetPath()
{
utf8 path[MAX_PATH];
platform_get_user_directory(path, nullptr, sizeof(path));
Path::Append(path, sizeof(path), "hotkeys.cfg");
return path;
}
}
extern "C"
{
void config_reset_shortcut_keys()
{
KeyboardShortcuts::Reset();
}
bool config_shortcut_keys_load()
{
bool result = false;
try
{
std::string path = KeyboardShortcuts::GetPath();
if (File::Exists(path))
{
auto fs = FileStream(path, FILE_MODE_OPEN);
uint16 version = fs.ReadValue<uint16>();
if (version == KeyboardShortcuts::CURRENT_FILE_VERSION)
{
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
gShortcutKeys[i] = fs.ReadValue<uint16>();
}
result = true;
}
}
}
catch (const Exception &ex)
{
Console::WriteLine("Error reading shortcut keys: %s", ex.GetMessage());
}
return result;
}
bool config_shortcut_keys_save()
{
bool result = false;
try
{
std::string path = KeyboardShortcuts::GetPath();
auto fs = FileStream(path, FILE_MODE_WRITE);
fs.WriteValue<uint16>(KeyboardShortcuts::CURRENT_FILE_VERSION);
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
fs.WriteValue<uint16>(gShortcutKeys[i]);
}
result = true;
}
catch (const Exception &ex)
{
Console::WriteLine("Error writing shortcut keys: %s", ex.GetMessage());
}
return result;
}
}

View File

@ -23,7 +23,6 @@
#include "interface/chat.h"
#include "interface/console.h"
#include "interface/Cursors.h"
#include "interface/keyboard_shortcut.h"
#include "interface/viewport.h"
#include "interface/widget.h"
#include "interface/window.h"
@ -1485,14 +1484,14 @@ void title_handle_keyboard_input()
w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
if (w != NULL) {
keyboard_shortcut_set(key);
// keyboard_shortcut_set(key);
} else {
w = window_find_by_class(WC_TEXTINPUT);
if (w != NULL) {
window_text_input_key(w, key);
}
else if (!gUsingWidgetTextBox) {
keyboard_shortcut_handle(key);
// keyboard_shortcut_handle(key);
}
}
}
@ -1564,13 +1563,13 @@ void game_handle_keyboard_input()
w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
if (w != NULL) {
keyboard_shortcut_set(key);
// keyboard_shortcut_set(key);
} else {
w = window_find_by_class(WC_TEXTINPUT);
if (w != NULL) {
window_text_input_key(w, key);
} else if (!gUsingWidgetTextBox) {
keyboard_shortcut_handle(key);
// keyboard_shortcut_handle(key);
}
}
}
@ -1706,44 +1705,44 @@ void game_handle_key_scroll()
scrollX = 0;
scrollY = 0;
const uint8 * keysState = context_get_keys_state();
for (sint32 shortcutId = SHORTCUT_SCROLL_MAP_UP; shortcutId <= SHORTCUT_SCROLL_MAP_RIGHT; shortcutId++) {
uint16 shortcutKey = gShortcutKeys[shortcutId];
uint8 scancode = shortcutKey & 0xFF;
if (shortcutKey == 0xFFFF) continue;
if (!keysState[scancode]) continue;
if (shortcutKey & SHIFT) {
if (!keysState[SDL_SCANCODE_LSHIFT] && !keysState[SDL_SCANCODE_RSHIFT]) continue;
}
if (shortcutKey & CTRL) {
if (!keysState[SDL_SCANCODE_LCTRL] && !keysState[SDL_SCANCODE_RCTRL]) continue;
}
if (shortcutKey & ALT) {
if (!keysState[SDL_SCANCODE_LALT] && !keysState[SDL_SCANCODE_RALT]) continue;
}
#ifdef __MACOSX__
if (shortcutKey & CMD) {
if (!keysState[SDL_SCANCODE_LGUI] && !keysState[SDL_SCANCODE_RGUI]) continue;
}
#endif
switch (shortcutId) {
case SHORTCUT_SCROLL_MAP_UP:
scrollY = -1;
break;
case SHORTCUT_SCROLL_MAP_LEFT:
scrollX = -1;
break;
case SHORTCUT_SCROLL_MAP_DOWN:
scrollY = 1;
break;
case SHORTCUT_SCROLL_MAP_RIGHT:
scrollX = 1;
break;
}
}
// const uint8 * keysState = context_get_keys_state();
// for (sint32 shortcutId = SHORTCUT_SCROLL_MAP_UP; shortcutId <= SHORTCUT_SCROLL_MAP_RIGHT; shortcutId++) {
// uint16 shortcutKey = gShortcutKeys[shortcutId];
// uint8 scancode = shortcutKey & 0xFF;
//
// if (shortcutKey == 0xFFFF) continue;
// if (!keysState[scancode]) continue;
//
// if (shortcutKey & SHIFT) {
// if (!keysState[SDL_SCANCODE_LSHIFT] && !keysState[SDL_SCANCODE_RSHIFT]) continue;
// }
// if (shortcutKey & CTRL) {
// if (!keysState[SDL_SCANCODE_LCTRL] && !keysState[SDL_SCANCODE_RCTRL]) continue;
// }
// if (shortcutKey & ALT) {
// if (!keysState[SDL_SCANCODE_LALT] && !keysState[SDL_SCANCODE_RALT]) continue;
// }
// #ifdef __MACOSX__
// if (shortcutKey & CMD) {
// if (!keysState[SDL_SCANCODE_LGUI] && !keysState[SDL_SCANCODE_RGUI]) continue;
// }
// #endif
//
// switch (shortcutId) {
// case SHORTCUT_SCROLL_MAP_UP:
// scrollY = -1;
// break;
// case SHORTCUT_SCROLL_MAP_LEFT:
// scrollX = -1;
// break;
// case SHORTCUT_SCROLL_MAP_DOWN:
// scrollY = 1;
// break;
// case SHORTCUT_SCROLL_MAP_RIGHT:
// scrollX = 1;
// break;
// }
// }
// Scroll viewport
if (scrollX != 0) {

View File

@ -59,8 +59,339 @@
<None Include="data\shaders\**\*.frag" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="**\*.c" />
<ClCompile Include="**\*.cpp" />
<ClCompile Include="cheats.c" />
<ClCompile Include="cmdline_sprite.c" />
<ClCompile Include="core\textinputbuffer.c" />
<ClCompile Include="diagnostic.c" />
<ClCompile Include="drawing\drawing.c" />
<ClCompile Include="drawing\font.c" />
<ClCompile Include="drawing\lightfx.c" />
<ClCompile Include="drawing\line.c" />
<ClCompile Include="drawing\rect.c" />
<ClCompile Include="drawing\scrolling_text.c" />
<ClCompile Include="drawing\string.c" />
<ClCompile Include="editor.c" />
<ClCompile Include="game.c" />
<ClCompile Include="input.c" />
<ClCompile Include="interface\chat.c" />
<ClCompile Include="interface\colour.c" />
<ClCompile Include="interface\console.c" />
<ClCompile Include="interface\graph.c" />
<ClCompile Include="interface\viewport.c" />
<ClCompile Include="interface\viewport_interaction.c" />
<ClCompile Include="interface\widget.c" />
<ClCompile Include="interface\window.c" />
<ClCompile Include="intro.c" />
<ClCompile Include="localisation\convert.c" />
<ClCompile Include="localisation\currency.c" />
<ClCompile Include="localisation\date.c" />
<ClCompile Include="localisation\format_codes.c" />
<ClCompile Include="localisation\localisation.c" />
<ClCompile Include="localisation\real_names.c" />
<ClCompile Include="localisation\user.c" />
<ClCompile Include="localisation\utf8.c" />
<ClCompile Include="management\award.c" />
<ClCompile Include="management\finance.c" />
<ClCompile Include="management\marketing.c" />
<ClCompile Include="management\news_item.c" />
<ClCompile Include="management\research.c" />
<ClCompile Include="object_list.c" />
<ClCompile Include="paint\map_element\banner.c" />
<ClCompile Include="paint\map_element\entrance.c" />
<ClCompile Include="paint\map_element\fence.c" />
<ClCompile Include="paint\map_element\map_element.c" />
<ClCompile Include="paint\map_element\path.c" />
<ClCompile Include="paint\map_element\scenery.c" />
<ClCompile Include="paint\map_element\scenery_multiple.c" />
<ClCompile Include="paint\map_element\surface.c" />
<ClCompile Include="paint\paint.c" />
<ClCompile Include="paint\paint_helpers.c" />
<ClCompile Include="paint\sprite\litter.c" />
<ClCompile Include="paint\sprite\misc.c" />
<ClCompile Include="paint\sprite\peep.c" />
<ClCompile Include="paint\sprite\sprite.c" />
<ClCompile Include="paint\supports.c" />
<ClCompile Include="peep\peep.c" />
<ClCompile Include="peep\peep_data.c" />
<ClCompile Include="peep\staff.c" />
<ClCompile Include="platform\linux.c" />
<ClCompile Include="platform\posix.c" />
<ClCompile Include="platform\shared.c" />
<ClCompile Include="platform\windows.c" />
<ClCompile Include="rct1.c" />
<ClCompile Include="rct2.c" />
<ClCompile Include="rct2\addresses.c" />
<ClCompile Include="rct2\hook.c" />
<ClCompile Include="rct2\interop.c" />
<ClCompile Include="ride\cable_lift.c" />
<ClCompile Include="ride\coaster\air_powered_vertical_coaster.c" />
<ClCompile Include="ride\coaster\bobsleigh_coaster.c" />
<ClCompile Include="ride\coaster\bolliger_mabillard_track.c" />
<ClCompile Include="ride\coaster\compact_inverted_coaster.c" />
<ClCompile Include="ride\coaster\corkscrew_roller_coaster.c" />
<ClCompile Include="ride\coaster\flying_roller_coaster.c" />
<ClCompile Include="ride\coaster\giga_coaster.c" />
<ClCompile Include="ride\coaster\heartline_twister_coaster.c" />
<ClCompile Include="ride\coaster\inverted_hairpin_coaster.c" />
<ClCompile Include="ride\coaster\inverted_impulse_coaster.c" />
<ClCompile Include="ride\coaster\inverted_roller_coaster.c" />
<ClCompile Include="ride\coaster\junior_roller_coaster.c" />
<ClCompile Include="ride\coaster\lay_down_roller_coaster.c" />
<ClCompile Include="ride\coaster\lim_launched_roller_coaster.c" />
<ClCompile Include="ride\coaster\looping_roller_coaster.c" />
<ClCompile Include="ride\coaster\mine_ride.c" />
<ClCompile Include="ride\coaster\mine_train_coaster.c" />
<ClCompile Include="ride\coaster\mini_roller_coaster.c" />
<ClCompile Include="ride\coaster\mini_suspended_coaster.c" />
<ClCompile Include="ride\coaster\multi_dimension_roller_coaster.c" />
<ClCompile Include="ride\coaster\reverser_roller_coaster.c" />
<ClCompile Include="ride\coaster\reverse_freefall_coaster.c" />
<ClCompile Include="ride\coaster\side_friction_roller_coaster.c" />
<ClCompile Include="ride\coaster\stand_up_roller_coaster.c" />
<ClCompile Include="ride\coaster\steeplechase.c" />
<ClCompile Include="ride\coaster\suspended_swinging_coaster.c" />
<ClCompile Include="ride\coaster\twister_roller_coaster.c" />
<ClCompile Include="ride\coaster\vertical_drop_roller_coaster.c" />
<ClCompile Include="ride\coaster\virginia_reel.c" />
<ClCompile Include="ride\coaster\wild_mouse.c" />
<ClCompile Include="ride\coaster\wooden_roller_coaster.c" />
<ClCompile Include="ride\coaster\wooden_wild_mouse.c" />
<ClCompile Include="ride\gentle\car_ride.c" />
<ClCompile Include="ride\gentle\circus_show.c" />
<ClCompile Include="ride\gentle\crooked_house.c" />
<ClCompile Include="ride\gentle\dodgems.c" />
<ClCompile Include="ride\gentle\ferris_wheel.c" />
<ClCompile Include="ride\gentle\flying_saucers.c" />
<ClCompile Include="ride\gentle\ghost_train.c" />
<ClCompile Include="ride\gentle\haunted_house.c" />
<ClCompile Include="ride\gentle\maze.c" />
<ClCompile Include="ride\gentle\merry_go_round.c" />
<ClCompile Include="ride\gentle\mini_golf.c" />
<ClCompile Include="ride\gentle\mini_helicopters.c" />
<ClCompile Include="ride\gentle\monorail_cycles.c" />
<ClCompile Include="ride\gentle\observation_tower.c" />
<ClCompile Include="ride\gentle\space_rings.c" />
<ClCompile Include="ride\gentle\spiral_slide.c" />
<ClCompile Include="ride\ride.c" />
<ClCompile Include="ride\ride_data.c" />
<ClCompile Include="ride\ride_ratings.c" />
<ClCompile Include="ride\shops\facility.c" />
<ClCompile Include="ride\shops\shop.c" />
<ClCompile Include="ride\station.c" />
<ClCompile Include="ride\thrill\3d_cinema.c" />
<ClCompile Include="ride\thrill\enterprise.c" />
<ClCompile Include="ride\thrill\go_karts.c" />
<ClCompile Include="ride\thrill\launched_freefall.c" />
<ClCompile Include="ride\thrill\magic_carpet.c" />
<ClCompile Include="ride\thrill\motion_simulator.c" />
<ClCompile Include="ride\thrill\pirate_ship.c" />
<ClCompile Include="ride\thrill\roto_drop.c" />
<ClCompile Include="ride\thrill\swinging_inverter_ship.c" />
<ClCompile Include="ride\thrill\top_spin.c" />
<ClCompile Include="ride\thrill\twist.c" />
<ClCompile Include="ride\track.c" />
<ClCompile Include="ride\track_data.c" />
<ClCompile Include="ride\track_data_old.c" />
<ClCompile Include="ride\track_design.c" />
<ClCompile Include="ride\track_design_save.c" />
<ClCompile Include="ride\track_paint.c" />
<ClCompile Include="ride\transport\chairlift.c" />
<ClCompile Include="ride\transport\lift.c" />
<ClCompile Include="ride\transport\miniature_railway.c" />
<ClCompile Include="ride\transport\monorail.c" />
<ClCompile Include="ride\transport\suspended_monorail.c" />
<ClCompile Include="ride\vehicle.c" />
<ClCompile Include="ride\vehicle_data.c" />
<ClCompile Include="ride\vehicle_paint.c" />
<ClCompile Include="ride\water\boat_ride.c" />
<ClCompile Include="ride\water\dingy_slide.c" />
<ClCompile Include="ride\water\log_flume.c" />
<ClCompile Include="ride\water\river_rapids.c" />
<ClCompile Include="ride\water\splash_boats.c" />
<ClCompile Include="ride\water\submarine_ride.c" />
<ClCompile Include="ride\water\water_coaster.c" />
<ClCompile Include="scenario\scenario.c" />
<ClCompile Include="util\sawyercoding.c" />
<ClCompile Include="util\util.c" />
<ClCompile Include="windows\about.c" />
<ClCompile Include="windows\banner.c" />
<ClCompile Include="windows\changelog.c" />
<ClCompile Include="windows\cheats.c" />
<ClCompile Include="windows\clear_scenery.c" />
<ClCompile Include="windows\custom_currency.c" />
<ClCompile Include="windows\debug_paint.c" />
<ClCompile Include="windows\demolish_ride_prompt.c" />
<ClCompile Include="windows\dropdown.c" />
<ClCompile Include="windows\editor_bottom_toolbar.c" />
<ClCompile Include="windows\editor_inventions_list.c" />
<ClCompile Include="windows\editor_main.c" />
<ClCompile Include="windows\editor_objective_options.c" />
<ClCompile Include="windows\editor_object_selection.c" />
<ClCompile Include="windows\editor_scenario_options.c" />
<ClCompile Include="windows\error.c" />
<ClCompile Include="windows\finances.c" />
<ClCompile Include="windows\footpath.c" />
<ClCompile Include="windows\game_bottom_toolbar.c" />
<ClCompile Include="windows\guest.c" />
<ClCompile Include="windows\guest_list.c" />
<ClCompile Include="windows\install_track.c" />
<ClCompile Include="windows\land.c" />
<ClCompile Include="windows\land_rights.c" />
<ClCompile Include="windows\loadsave.c" />
<ClCompile Include="windows\main.c" />
<ClCompile Include="windows\map.c" />
<ClCompile Include="windows\mapgen.c" />
<ClCompile Include="windows\map_tooltip.c" />
<ClCompile Include="windows\maze_construction.c" />
<ClCompile Include="windows\multiplayer.c" />
<ClCompile Include="windows\music_credits.c" />
<ClCompile Include="windows\network_status.c" />
<ClCompile Include="windows\news.c" />
<ClCompile Include="windows\news_options.c" />
<ClCompile Include="windows\new_campaign.c" />
<ClCompile Include="windows\new_ride.c" />
<ClCompile Include="windows\options.c" />
<ClCompile Include="windows\park.c" />
<ClCompile Include="windows\player.c" />
<ClCompile Include="windows\publisher_credits.c" />
<ClCompile Include="windows\research.c" />
<ClCompile Include="windows\ride.c" />
<ClCompile Include="windows\ride_construction.c" />
<ClCompile Include="windows\ride_list.c" />
<ClCompile Include="windows\save_prompt.c" />
<ClCompile Include="windows\scenery.c" />
<ClCompile Include="windows\server_start.c" />
<ClCompile Include="windows\sign.c" />
<ClCompile Include="windows\staff.c" />
<ClCompile Include="windows\staff_fire_prompt.c" />
<ClCompile Include="windows\staff_list.c" />
<ClCompile Include="windows\text_input.c" />
<ClCompile Include="windows\themes.c" />
<ClCompile Include="windows\tile_inspector.c" />
<ClCompile Include="windows\title_command_editor.c" />
<ClCompile Include="windows\title_editor.c" />
<ClCompile Include="windows\title_exit.c" />
<ClCompile Include="windows\title_logo.c" />
<ClCompile Include="windows\title_menu.c" />
<ClCompile Include="windows\title_options.c" />
<ClCompile Include="windows\title_scenarioselect.c" />
<ClCompile Include="windows\tooltip.c" />
<ClCompile Include="windows\top_toolbar.c" />
<ClCompile Include="windows\track_list.c" />
<ClCompile Include="windows\track_manage.c" />
<ClCompile Include="windows\track_place.c" />
<ClCompile Include="windows\viewport.c" />
<ClCompile Include="windows\view_clipping.c" />
<ClCompile Include="windows\water.c" />
<ClCompile Include="world\footpath.c" />
<ClCompile Include="world\map.c" />
<ClCompile Include="world\mapgen.c" />
<ClCompile Include="world\map_animation.c" />
<ClCompile Include="world\map_helpers.c" />
<ClCompile Include="world\money_effect.c" />
<ClCompile Include="world\park.c" />
<ClCompile Include="world\particle.c" />
<ClCompile Include="world\scenery.c" />
<ClCompile Include="world\sprite.c" />
<ClCompile Include="world\tile_inspector.c" />
<ClCompile Include="audio\audio.cpp" />
<ClCompile Include="audio\AudioMixer.cpp" />
<ClCompile Include="audio\DummyAudioContext.cpp" />
<ClCompile Include="audio\NullAudioSource.cpp" />
<ClCompile Include="cmdline\CommandLine.cpp" />
<ClCompile Include="cmdline\ConvertCommand.cpp" />
<ClCompile Include="cmdline\RootCommands.cpp" />
<ClCompile Include="cmdline\ScreenshotCommands.cpp" />
<ClCompile Include="cmdline\SpriteCommands.cpp" />
<ClCompile Include="cmdline\UriHandler.cpp" />
<ClCompile Include="config\Config.cpp" />
<ClCompile Include="config\IniReader.cpp" />
<ClCompile Include="config\IniWriter.cpp" />
<ClCompile Include="Context.cpp" />
<ClCompile Include="core\Console.cpp" />
<ClCompile Include="core\Diagnostics.cpp" />
<ClCompile Include="core\File.cpp" />
<ClCompile Include="core\FileScanner.cpp" />
<ClCompile Include="core\Guard.cpp" />
<ClCompile Include="core\IStream.cpp" />
<ClCompile Include="core\Json.cpp" />
<ClCompile Include="core\MemoryStream.cpp" />
<ClCompile Include="core\Path.cpp" />
<ClCompile Include="core\String.cpp" />
<ClCompile Include="core\Zip.cpp" />
<ClCompile Include="drawing\drawing_fast.cpp" />
<ClCompile Include="drawing\Image.cpp" />
<ClCompile Include="drawing\NewDrawing.cpp" />
<ClCompile Include="drawing\Rain.cpp" />
<ClCompile Include="drawing\sprite.cpp" />
<ClCompile Include="drawing\X8DrawingEngine.cpp" />
<ClCompile Include="FileClassifier.cpp" />
<ClCompile Include="Imaging.cpp" />
<ClCompile Include="interface\Fonts.cpp" />
<ClCompile Include="interface\Screenshot.cpp" />
<ClCompile Include="interface\Theme.cpp" />
<ClCompile Include="localisation\language.cpp" />
<ClCompile Include="localisation\LanguagePack.cpp" />
<ClCompile Include="network\http.cpp" />
<ClCompile Include="network\network.cpp" />
<ClCompile Include="network\NetworkAction.cpp" />
<ClCompile Include="network\NetworkConnection.cpp" />
<ClCompile Include="network\NetworkGroup.cpp" />
<ClCompile Include="network\NetworkKey.cpp" />
<ClCompile Include="network\NetworkPacket.cpp" />
<ClCompile Include="network\NetworkPlayer.cpp" />
<ClCompile Include="network\NetworkServerAdvertiser.cpp" />
<ClCompile Include="network\NetworkUser.cpp" />
<ClCompile Include="network\ServerList.cpp" />
<ClCompile Include="network\TcpSocket.cpp" />
<ClCompile Include="network\twitch.cpp" />
<ClCompile Include="object\BannerObject.cpp" />
<ClCompile Include="object\EntranceObject.cpp" />
<ClCompile Include="object\FootpathItemObject.cpp" />
<ClCompile Include="object\FootpathObject.cpp" />
<ClCompile Include="object\ImageTable.cpp" />
<ClCompile Include="object\LargeSceneryObject.cpp" />
<ClCompile Include="object\Object.cpp" />
<ClCompile Include="object\ObjectFactory.cpp" />
<ClCompile Include="object\ObjectManager.cpp" />
<ClCompile Include="object\ObjectRepository.cpp" />
<ClCompile Include="object\RideObject.cpp" />
<ClCompile Include="object\SceneryGroupObject.cpp" />
<ClCompile Include="object\SmallSceneryObject.cpp" />
<ClCompile Include="object\StexObject.cpp" />
<ClCompile Include="object\StringTable.cpp" />
<ClCompile Include="object\WallObject.cpp" />
<ClCompile Include="object\WaterObject.cpp" />
<ClCompile Include="OpenRCT2.cpp" />
<ClCompile Include="ParkImporter.cpp" />
<ClCompile Include="PlatformEnvironment.cpp" />
<ClCompile Include="platform\crash.cpp" />
<ClCompile Include="platform\Platform2.cpp" />
<ClCompile Include="rct12\SawyerChunk.cpp" />
<ClCompile Include="rct12\SawyerChunkReader.cpp" />
<ClCompile Include="rct12\SawyerChunkWriter.cpp" />
<ClCompile Include="rct12\SawyerEncoding.cpp" />
<ClCompile Include="rct1\S4Importer.cpp" />
<ClCompile Include="rct1\tables.cpp" />
<ClCompile Include="rct2\S6Exporter.cpp" />
<ClCompile Include="rct2\S6Importer.cpp" />
<ClCompile Include="ride\TrackDesignRepository.cpp" />
<ClCompile Include="scenario\ScenarioRepository.cpp" />
<ClCompile Include="scenario\ScenarioSources.cpp" />
<ClCompile Include="title\TitleScreen.cpp" />
<ClCompile Include="title\TitleSequence.cpp" />
<ClCompile Include="title\TitleSequenceManager.cpp" />
<ClCompile Include="title\TitleSequencePlayer.cpp" />
<ClCompile Include="ui\DummyUiContext.cpp" />
<ClCompile Include="Version.cpp" />
<ClCompile Include="windows\server_list.cpp" />
<ClCompile Include="world\Balloon.cpp" />
<ClCompile Include="world\banner.cpp" />
<ClCompile Include="world\Climate.cpp" />
<ClCompile Include="world\Duck.cpp" />
<ClCompile Include="world\entrance.cpp" />
<ClCompile Include="world\Fountain.cpp" />
<ClCompile Include="world\wall.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\resources\resource.h" />

View File

@ -57,7 +57,6 @@ extern "C" {
#include "../game.h"
#include "../interface/chat.h"
#include "../interface/window.h"
#include "../interface/keyboard_shortcut.h"
#include "../localisation/date.h"
#include "../localisation/localisation.h"
#include "../management/finance.h"
@ -2364,7 +2363,7 @@ void network_chat_show_connected_message()
{
char templateBuffer[128];
char *templateString = templateBuffer;
keyboard_shortcut_format_string(templateBuffer, 128, gShortcutKeys[SHORTCUT_OPEN_CHAT_WINDOW]);
// keyboard_shortcuts_format_string(templateBuffer, sizeof(templateBuffer), SHORTCUT_OPEN_CHAT_WINDOW);
utf8 buffer[256];
NetworkPlayer server;
server.Name = "Server";

View File

@ -27,7 +27,6 @@
#include "../input.h"
#include "../interface/console.h"
#include "../interface/Cursors.h"
#include "../interface/keyboard_shortcut.h"
#include "../interface/window.h"
#include "../localisation/currency.h"
#include "../localisation/localisation.h"

View File

@ -28,7 +28,6 @@
#include "input.h"
#include "interface/chat.h"
#include "interface/console.h"
#include "interface/keyboard_shortcut.h"
#include "interface/viewport.h"
#include "intro.h"
#include "localisation/date.h"
@ -151,10 +150,7 @@ bool rct2_init()
gScenarioTicks = 0;
util_srand((uint32)time(0));
config_reset_shortcut_keys();
config_shortcut_keys_load();
input_reset_place_obj_modifier();
// config_load();
if (!gfx_load_g1()) {
return false;