From 2e0eb742ebe4d090f266cd5900a461c3d16a929e Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Tue, 7 Mar 2017 10:33:40 +0200 Subject: [PATCH 1/6] Moved some ancient playsim mouse input code around so that it works properly with input events --- src/d_main.cpp | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 77e0edda0..984121fee 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -258,6 +258,33 @@ static int pagetic; // //========================================================================== +// [ZZ] this handles the mouse changes in the playsim. +// I have no idea why it had to be done before events are dispatched... also no idea why is this not in G_Responder or something. +static void D_ProcessMouseForPlaysim(event_t *ev) +{ + //if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_CheckUiProcessors()) + if (ev->type == EV_Mouse && !paused) // [ZZ] the other checks are replaced with responders eating the event. + { + if (Button_Mlook.bDown || freelook) + { + int look = int(ev->y * m_pitch * mouse_sensitivity * 16.0); + if (invertmouse) + look = -look; + G_AddViewPitch(look); + events[eventhead].y = 0; + } + if (!Button_Strafe.bDown && !lookstrafe) + { + G_AddViewAngle(int(ev->x * m_yaw * mouse_sensitivity * 8.0)); + events[eventhead].x = 0; + } + if ((events[eventhead].x | events[eventhead].y) == 0) + { + return; + } + } +} + void D_ProcessEvents (void) { event_t *ev; @@ -290,6 +317,8 @@ void D_ProcessEvents (void) // check events if (E_Responder(ev)) // [ZZ] ZScript ate the event continue; + // before passing this further, do some magic + D_ProcessMouseForPlaysim(ev); G_Responder (ev); } } @@ -310,26 +339,6 @@ void D_PostEvent (const event_t *ev) return; } events[eventhead] = *ev; - if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_CheckUiProcessors()) - { - if (Button_Mlook.bDown || freelook) - { - int look = int(ev->y * m_pitch * mouse_sensitivity * 16.0); - if (invertmouse) - look = -look; - G_AddViewPitch (look); - events[eventhead].y = 0; - } - if (!Button_Strafe.bDown && !lookstrafe) - { - G_AddViewAngle (int(ev->x * m_yaw * mouse_sensitivity * 8.0)); - events[eventhead].x = 0; - } - if ((events[eventhead].x | events[eventhead].y) == 0) - { - return; - } - } eventhead = (eventhead+1)&(MAXEVENTS-1); } From a681b5b706099aff1a8ab4a10095aae67d00c97f Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Tue, 7 Mar 2017 10:43:30 +0200 Subject: [PATCH 2/6] Just in case, don't send useless mouse move events to G_Responder. --- src/d_main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 984121fee..ac423d10b 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -260,7 +260,7 @@ static int pagetic; // [ZZ] this handles the mouse changes in the playsim. // I have no idea why it had to be done before events are dispatched... also no idea why is this not in G_Responder or something. -static void D_ProcessMouseForPlaysim(event_t *ev) +static bool D_ProcessMouseForPlaysim(event_t *ev) { //if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_CheckUiProcessors()) if (ev->type == EV_Mouse && !paused) // [ZZ] the other checks are replaced with responders eating the event. @@ -280,9 +280,11 @@ static void D_ProcessMouseForPlaysim(event_t *ev) } if ((events[eventhead].x | events[eventhead].y) == 0) { - return; + return false; } } + + return true; } void D_ProcessEvents (void) @@ -318,8 +320,8 @@ void D_ProcessEvents (void) if (E_Responder(ev)) // [ZZ] ZScript ate the event continue; // before passing this further, do some magic - D_ProcessMouseForPlaysim(ev); - G_Responder (ev); + if (D_ProcessMouseForPlaysim(ev)) + G_Responder (ev); } } From 1c95ddacb8a2ced158775d87dc1f511a9663e5eb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 7 Mar 2017 10:26:03 +0100 Subject: [PATCH 3/6] Revert "Moved some ancient playsim mouse input code around so that it works properly with input events" This reverts commit 2e0eb742ebe4d090f266cd5900a461c3d16a929e. This effectively nullifies the attempt to get a higher mouse update rate for the display. --- src/d_main.cpp | 53 ++++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index ac423d10b..77e0edda0 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -258,35 +258,6 @@ static int pagetic; // //========================================================================== -// [ZZ] this handles the mouse changes in the playsim. -// I have no idea why it had to be done before events are dispatched... also no idea why is this not in G_Responder or something. -static bool D_ProcessMouseForPlaysim(event_t *ev) -{ - //if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_CheckUiProcessors()) - if (ev->type == EV_Mouse && !paused) // [ZZ] the other checks are replaced with responders eating the event. - { - if (Button_Mlook.bDown || freelook) - { - int look = int(ev->y * m_pitch * mouse_sensitivity * 16.0); - if (invertmouse) - look = -look; - G_AddViewPitch(look); - events[eventhead].y = 0; - } - if (!Button_Strafe.bDown && !lookstrafe) - { - G_AddViewAngle(int(ev->x * m_yaw * mouse_sensitivity * 8.0)); - events[eventhead].x = 0; - } - if ((events[eventhead].x | events[eventhead].y) == 0) - { - return false; - } - } - - return true; -} - void D_ProcessEvents (void) { event_t *ev; @@ -319,9 +290,7 @@ void D_ProcessEvents (void) // check events if (E_Responder(ev)) // [ZZ] ZScript ate the event continue; - // before passing this further, do some magic - if (D_ProcessMouseForPlaysim(ev)) - G_Responder (ev); + G_Responder (ev); } } @@ -341,6 +310,26 @@ void D_PostEvent (const event_t *ev) return; } events[eventhead] = *ev; + if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_CheckUiProcessors()) + { + if (Button_Mlook.bDown || freelook) + { + int look = int(ev->y * m_pitch * mouse_sensitivity * 16.0); + if (invertmouse) + look = -look; + G_AddViewPitch (look); + events[eventhead].y = 0; + } + if (!Button_Strafe.bDown && !lookstrafe) + { + G_AddViewAngle (int(ev->x * m_yaw * mouse_sensitivity * 8.0)); + events[eventhead].x = 0; + } + if ((events[eventhead].x | events[eventhead].y) == 0) + { + return; + } + } eventhead = (eventhead+1)&(MAXEVENTS-1); } From e5a3d2244e0af266fb5b93e94f3724167ff0e79f Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 7 Mar 2017 11:59:52 +0200 Subject: [PATCH 4/6] Updated AppVeyor configuration Add dependencies for sound backends Exclude travis test branches from build Set git clone depth to one --- .appveyor.yml | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 508746db6..608f8d0fc 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,11 @@ version: "{build}" +branches: + except: + - /^travis.*$/ + +clone_depth: 1 + os: Visual Studio 2015 platform: @@ -10,12 +16,37 @@ configuration: - Debug - Release +cache: + - ci_deps_win_v01.zip + +environment: + # Update dependencies here: https://github.com/coelckers/gzdoom/releases/tag/ci_deps + DEPS_URL: https://github.com/coelckers/gzdoom/releases/download/ci_deps/ + DEPS_FILENAME: ci_deps_win_v01.zip + +install: + - if not exist "%DEPS_FILENAME%" + appveyor DownloadFile "%DEPS_URL%%DEPS_FILENAME%" + - 7z x -y "%DEPS_FILENAME%" + before_build: - - cmd: md build - - cmd: cd build - - cmd: if "%platform%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 - - cmd: if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 Win64 - - cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% .. + - md build + - cd build + - if "%PLATFORM%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 + - if "%PLATFORM%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 Win64 + - set DEPS_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\ci_deps_win\include + - set DEPS_LIB_DIR=%APPVEYOR_BUILD_FOLDER%\ci_deps_win\lib\%PLATFORM% + - cmake -G "%CMAKE_GENERATOR_NAME%" -T "v140_xp" + -DCMAKE_BUILD_TYPE="%CONFIGURATION%" + -DFMOD_INCLUDE_DIR="%DEPS_INCLUDE_DIR%" + -DFMOD_LIBRARY="%DEPS_LIB_DIR%\fmodex.lib" + -DOPENAL_INCLUDE_DIR="%DEPS_INCLUDE_DIR%" + -DOPENAL_LIBRARY="%DEPS_LIB_DIR%\OpenAL32.lib" + -DMPG123_INCLUDE_DIR="%DEPS_INCLUDE_DIR%" + -DMPG123_LIBRARIES="%DEPS_LIB_DIR%\libmpg123-0.lib" + -DSNDFILE_INCLUDE_DIR="%DEPS_INCLUDE_DIR%" + -DSNDFILE_LIBRARY="%DEPS_LIB_DIR%\libsndfile-1.lib" + .. build: project: build\GZDoom.sln From 883048b5388a0b970d0a051eaf03cda99b54ff04 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Tue, 7 Mar 2017 11:43:14 +0200 Subject: [PATCH 5/6] Added E_Responder call for direct mouse input interception --- src/d_main.cpp | 4 ++-- src/events.cpp | 24 ++++++++++++++++-------- src/events.h | 10 +++++----- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 77e0edda0..b9c83360b 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -288,7 +288,7 @@ void D_ProcessEvents (void) if (M_Responder (ev)) continue; // menu ate the event // check events - if (E_Responder(ev)) // [ZZ] ZScript ate the event + if (E_Responder(ev)) // [ZZ] ZScript ate the event // update 07.03.17: mouse events are handled directly continue; G_Responder (ev); } @@ -310,7 +310,7 @@ void D_PostEvent (const event_t *ev) return; } events[eventhead] = *ev; - if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_CheckUiProcessors()) + if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_Responder(ev)) { if (Button_Mlook.bDown || freelook) { diff --git a/src/events.cpp b/src/events.cpp index 5faee810a..d0d8050cc 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -410,15 +410,21 @@ void E_PlayerDisconnected(int num) handler->PlayerDisconnected(num); } -bool E_Responder(event_t* ev) +bool E_Responder(const event_t* ev) { + bool uiProcessorsFound = false; + if (ev->type == EV_GUI_Event) { // iterate handlers back to front by order, and give them this event. for (DStaticEventHandler* handler = E_LastEventHandler; handler; handler = handler->prev) { - if (handler->IsUiProcessor && handler->UiProcess(ev)) - return true; // event was processed + if (handler->IsUiProcessor) + { + uiProcessorsFound = true; + if (handler->UiProcess(ev)) + return true; // event was processed + } } } else @@ -426,12 +432,14 @@ bool E_Responder(event_t* ev) // not sure if we want to handle device changes, but whatevs. for (DStaticEventHandler* handler = E_LastEventHandler; handler; handler = handler->prev) { + if (handler->IsUiProcessor) + uiProcessorsFound = true; if (handler->InputProcess(ev)) return true; // event was processed } } - return false; + return (uiProcessorsFound && (ev->type == EV_Mouse)); // mouse events are eaten by the event system if there are any uiprocessors. } void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manual) @@ -939,7 +947,7 @@ void DStaticEventHandler::PlayerDisconnected(int num) } } -FUiEvent::FUiEvent(event_t *ev) +FUiEvent::FUiEvent(const event_t *ev) { Type = (EGUIEvent)ev->subtype; KeyChar = 0; @@ -979,7 +987,7 @@ FUiEvent::FUiEvent(event_t *ev) } } -bool DStaticEventHandler::UiProcess(event_t* ev) +bool DStaticEventHandler::UiProcess(const event_t* ev) { IFVIRTUAL(DStaticEventHandler, UiProcess) { @@ -998,7 +1006,7 @@ bool DStaticEventHandler::UiProcess(event_t* ev) return false; } -FInputEvent::FInputEvent(event_t *ev) +FInputEvent::FInputEvent(const event_t *ev) { Type = (EGenericEvent)ev->type; // we don't want the modders to remember what weird fields mean what for what events. @@ -1025,7 +1033,7 @@ FInputEvent::FInputEvent(event_t *ev) } } -bool DStaticEventHandler::InputProcess(event_t* ev) +bool DStaticEventHandler::InputProcess(const event_t* ev) { IFVIRTUAL(DStaticEventHandler, InputProcess) { diff --git a/src/events.h b/src/events.h index 6a84da3f6..292030333 100755 --- a/src/events.h +++ b/src/events.h @@ -56,7 +56,7 @@ void E_PlayerDied(int num); // this executes when a player leaves the game void E_PlayerDisconnected(int num); // this executes on events. -bool E_Responder(event_t* ev); // splits events into InputProcess and UiProcess +bool E_Responder(const event_t* ev); // splits events into InputProcess and UiProcess // this executes on console/net events. void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manual); @@ -148,8 +148,8 @@ public: void PlayerDisconnected(int num); // return true if handled. - bool InputProcess(event_t* ev); - bool UiProcess(event_t* ev); + bool InputProcess(const event_t* ev); + bool UiProcess(const event_t* ev); // void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual); @@ -215,7 +215,7 @@ struct FUiEvent bool IsCtrl; bool IsAlt; - FUiEvent(event_t *ev); + FUiEvent(const event_t *ev); }; struct FInputEvent @@ -230,7 +230,7 @@ struct FInputEvent int MouseX; int MouseY; - FInputEvent(event_t *ev); + FInputEvent(const event_t *ev); }; struct FConsoleEvent From 620ce72ebdbb4dab1b8f2d47d61e51793064eec7 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Tue, 7 Mar 2017 11:55:17 +0200 Subject: [PATCH 6/6] Fixed E_Responder for mouse events. It being active during console was actually a bug, because console should prevent any events. --- src/d_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index b9c83360b..ca143a0ec 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -288,7 +288,7 @@ void D_ProcessEvents (void) if (M_Responder (ev)) continue; // menu ate the event // check events - if (E_Responder(ev)) // [ZZ] ZScript ate the event // update 07.03.17: mouse events are handled directly + if (ev->type != EV_Mouse && E_Responder(ev)) // [ZZ] ZScript ate the event // update 07.03.17: mouse events are handled directly continue; G_Responder (ev); } @@ -310,7 +310,7 @@ void D_PostEvent (const event_t *ev) return; } events[eventhead] = *ev; - if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_Responder(ev)) + if (ev->type == EV_Mouse && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !E_Responder(ev) && !paused) { if (Button_Mlook.bDown || freelook) {