Bitl / Black-Shades-Enhanced

A mod for Wolfire's game Black Shades that incorporates new aspects, such as a larger FPS limit, windowed mode, and larger FOV
GNU General Public License v3.0
10 stars 5 forks source link

Sniper zooming out on idle #7

Closed z33ky closed 5 years ago

z33ky commented 5 years ago

I have a weird issue that when just crouching down with the sniperrifle and not pressing any keys or moving the mouse, the zoom will disengage after a second or two. It seems SDL is erroneously generating a KEYUP-event for LCTRL for whatever reason. I have a workaround:

diff --git a/blackshades/Source/GameLoop.cpp b/blackshades/Source/GameLoop.cpp
index d2bc745..97dbd8b 100644
--- a/blackshades/Source/GameLoop.cpp
+++ b/blackshades/Source/GameLoop.cpp
@@ -318,6 +318,8 @@ static void DoSDLKey(Game *g, SDL_Event *event)
    }

    mackey = sdlkeymap[event->key.keysym.sym];
+   if(mackey == MAC_CONTROL_KEY)
+       press = SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL);

    if (mackey != -1) {
        index = mackey / 8;

SDL_GetModState() seems to return the state correctly. I didn't create a PR since I fear it might just be my system that is behaving weird. So, do you get this, too?

Bitl commented 5 years ago

will add this in 1.1.2