diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-07-08 03:24:47 +0300 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-07-08 03:24:47 +0300 |
commit | 47f153fe76880ae3a62d82b1193c2a5a4d466836 (patch) | |
tree | 3c6a9949544f245c38a001b9c6848ba7bf731424 /src | |
parent | f9a2f1daf75d5235742917359d3ec10395d46bbc (diff) |
Use CPad functions to check key states in script loader
Diffstat (limited to 'src')
-rw-r--r-- | src/control/Script.cpp | 13 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 17 |
2 files changed, 6 insertions, 24 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1517ec52..e06acdc3 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1769,21 +1769,16 @@ void CRunningScript::Init() #ifdef USE_DEBUG_SCRIPT_LOADER int scriptToLoad = 0; -#ifdef _WIN32 -extern "C" __declspec(dllimport) short __stdcall GetAsyncKeyState(int); -#endif - int open_script() { // glfwGetKey doesn't work because of CGame::Initialise is blocking -#ifdef _WIN32 - if (GetAsyncKeyState('G') & 0x8000) + CPad::UpdatePads(); + if (CPad::GetPad(0)->GetChar('G')) scriptToLoad = 0; - if (GetAsyncKeyState('R') & 0x8000) + if (CPad::GetPad(0)->GetChar('R')) scriptToLoad = 1; - if (GetAsyncKeyState('D') & 0x8000) + if (CPad::GetPad(0)->GetChar('D')) scriptToLoad = 2; -#endif switch (scriptToLoad) { case 0: return CFileMgr::OpenFile("main.scm", "rb"); case 1: return CFileMgr::OpenFile("main_freeroam.scm", "rb"); diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 125360ff..7ff80697 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -4290,29 +4290,16 @@ CMenuManager::ProcessButtonPresses(void) #ifdef USE_DEBUG_SCRIPT_LOADER if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) { -#ifdef RW_GL3 - if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) { + if (CPad::GetPad(0)->GetChar('R')) { scriptToLoad = 1; DoSettingsBeforeStartingAGame(); return; } - if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_D) == GLFW_PRESS) { + if (CPad::GetPad(0)->GetChar('D')) { scriptToLoad = 2; DoSettingsBeforeStartingAGame(); return; } -#elif defined _WIN32 - if (GetAsyncKeyState('R') & 0x8000) { - scriptToLoad = 1; - DoSettingsBeforeStartingAGame(); - return; - } - if (GetAsyncKeyState('D') & 0x8000) { - scriptToLoad = 2; - DoSettingsBeforeStartingAGame(); - return; - } -#endif } #endif |