From 79c010f08275a7152e920bd0a9e3dbf6493f5b4c Mon Sep 17 00:00:00 2001 From: withmorten Date: Thu, 8 Jul 2021 01:44:55 +0200 Subject: fix macro redefinition warnings on win-glfw build --- src/control/Script.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 4b70a678..1eee1c9e 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2209,8 +2209,9 @@ int scriptToLoad = 0; const char *scriptfile = "main.scm"; #ifdef _WIN32 -#include +extern "C" __declspec(dllimport) short __stdcall GetAsyncKeyState(int); #endif + int open_script() { // glfwGetKey doesn't work because of CGame::Initialise is blocking -- cgit v1.2.3 From 72f67809059c732588ac29eedf8a10f9156b27b4 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 8 Jul 2021 03:37:14 +0300 Subject: Use CPad functions to check key states in script loader --- src/control/Script.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1eee1c9e..76ab9471 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2208,21 +2208,16 @@ void CRunningScript::Init() int scriptToLoad = 0; const char *scriptfile = "main.scm"; -#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) + // glfwGetKey doesn't work because of CGame::Initialise is blocking + 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: scriptfile = "main.scm"; break; case 1: scriptfile = "freeroam_miami.scm"; break; -- cgit v1.2.3