diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index cf8bc9a89..45e1bb4fa 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -149,6 +149,7 @@ void readmousebstatus(int32_t *b); void readjoybstatus(int32_t *b); void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur); void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur); +extern int32_t inputchecked; int32_t inittimer(int32_t); void uninittimer(void); diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 394aeda0f..a175e8b0f 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -741,6 +741,8 @@ CANCEL: M32_DrawRoomsAndMasks(); + inputchecked = 1; + #ifdef M32_SHOWDEBUG if (searchstat>=0 && (searchwall<0 || searchsector<0)) { @@ -3722,6 +3724,8 @@ void overheadeditor(void) OSD_Draw(); } + inputchecked = 1; + VM_OnEvent(EVENT_PREKEYS2D, -1); ExtCheckKeys(); // TX 20050101, it makes more sense to have this here so keys can be overwritten with new functions in bstub.c @@ -5695,14 +5699,22 @@ end_point_dragging: { if ((DOWN_BK(MOVEUP) || (bstatus&16)) && m32_sideelev < 512) { - m32_sideelev += synctics<<(1+!!(bstatus&16)); + if (DOWN_BK(MOVEUP)) + m32_sideelev += synctics<<1; + if (bstatus&16) + m32_sideelev += 4<<1; + if (m32_sideelev > 512) m32_sideelev = 512; _printmessage16("Sideview elevation: %d", m32_sideelev); } if ((DOWN_BK(MOVEDOWN) || (bstatus&32)) && m32_sideelev > 0) { - m32_sideelev -= synctics<<(1+!!(bstatus&32)); + if (DOWN_BK(MOVEDOWN)) + m32_sideelev -= synctics<<1; + if (bstatus&32) + m32_sideelev -= 4<<1; + if (m32_sideelev < 0) m32_sideelev = 0; _printmessage16("Sideview elevation: %d", m32_sideelev); @@ -5714,13 +5726,21 @@ end_point_dragging: if ((DOWN_BK(MOVEUP) || (bstatus&16)) && zoom < 65536) { - zoom += synctics*(zoom>>4); + if (DOWN_BK(MOVEUP)) + zoom += synctics*(zoom>>4); + if (bstatus&16) + zoom += 4*(zoom>>4); + if (zoom < 24) zoom += 2; didzoom = 1; } if ((DOWN_BK(MOVEDOWN) || (bstatus&32)) && zoom > 8) { - zoom -= synctics*(zoom>>4); + if (DOWN_BK(MOVEDOWN)) + zoom -= synctics*(zoom>>4); + if (bstatus&32) + zoom -= 4*(zoom>>4); + didzoom = 1; } @@ -9051,6 +9071,8 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha searchx = osearchx; searchy = osearchy; + inputchecked = 1; + if ((flags&8)==0) ExtCheckKeys(); diff --git a/polymer/eduke32/build/src/rawinput.c b/polymer/eduke32/build/src/rawinput.c index d870dd32c..11e7aa0a5 100644 --- a/polymer/eduke32/build/src/rawinput.c +++ b/polymer/eduke32/build/src/rawinput.c @@ -10,12 +10,10 @@ static BOOL rawinput_started = 0; static uint8_t KeyboardState[256] = {0}; // VKeys extern volatile uint8_t moustat, mousegrab; -extern uint32_t mousewheel[2]; extern void SetKey(int32_t key, int32_t state); //#define MASK_DOWN (1<<(i<<1)) //#define MASK_UP (MASK_DOWN<<1) -#define MouseWheelFakePressTime 50 #ifndef GET_RAWINPUT_CODE_WPARAM #define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff) #endif @@ -73,15 +71,11 @@ static inline void RI_ProcessMouse(const RAWMOUSE *rmouse) if (MWheel > 0) // wheel up { - if (mousewheel[0] > 0 && mousepresscallback) mousepresscallback(5,0); - mousewheel[0] = getticks(); mouseb |= 16; if (mousepresscallback) mousepresscallback(5, 1); } else if (MWheel < 0) // wheel down { - if (mousewheel[1] > 0 && mousepresscallback) mousepresscallback(6,0); - mousewheel[1] = getticks(); mouseb |= 32; if (mousepresscallback) mousepresscallback(6, 1); } @@ -225,6 +219,18 @@ void RI_PollDevices(BOOL loop) rawinput_started = 1; } + if (inputchecked) + { + if (mousepresscallback) + { + if (mouseb & 16) + mousepresscallback(5, 0); + if (mouseb & 32) + mousepresscallback(6, 0); + } + mouseb &= ~(16|32); + } + // snapshot the whole keyboard state so we can translate key presses into ascii later for (i = 0; i < 256; i++) KeyboardState[i] = GetAsyncKeyState(i) >> 8; @@ -239,18 +245,6 @@ void RI_PollDevices(BOOL loop) ClientToScreen((HWND)win_gethwnd(), &pt); SetCursorPos(pt.x, pt.y); - - // do this here because we only want the wheel to signal once, but hold the state for a moment - if (mousewheel[0] > 0 && getticks() - mousewheel[0] > MouseWheelFakePressTime) - { - if (mousepresscallback) mousepresscallback(5,0); - mousewheel[0] = 0; mouseb &= ~16; - } - if (mousewheel[1] > 0 && getticks() - mousewheel[1] > MouseWheelFakePressTime) - { - if (mousepresscallback) mousepresscallback(6,0); - mousewheel[1] = 0; mouseb &= ~32; - } } } diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index a0b1a9ea6..4f5ff3096 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -61,8 +61,7 @@ int32_t startwin_settitle(const char *s) { UNREFERENCED_PARAMETER(s); return 0; #define ANY_WINDOWED_SIZE // fix for mousewheel -#define MWHEELTICKS 10 -static uint32_t mwheelup, mwheeldown; +int32_t inputchecked = 0; extern int32_t app_main(int32_t argc, const char **argv); @@ -2026,6 +2025,21 @@ int32_t handleevents(void) int32_t code, rv=0, j; SDL_Event ev; + if (inputchecked) + { + if (moustat) + { + if (mousepresscallback) + { + if (mouseb & 16) + mousepresscallback(5, 0); + if (mouseb & 32) + mousepresscallback(6, 0); + } + mouseb &= ~(16|32); + } + } + while (SDL_PollEvent(&ev)) { switch (ev.type) @@ -2108,14 +2122,12 @@ int32_t handleevents(void) // initprintf("wheel y %d\n",ev.wheel.y); if (ev.wheel.y > 0) { - mwheelup = totalclock; mouseb |= 16; if (mousepresscallback) mousepresscallback(5, 1); } if (ev.wheel.y < 0) { - mwheeldown = totalclock; mouseb |= 32; if (mousepresscallback) mousepresscallback(6, 1); @@ -2260,16 +2272,6 @@ int32_t handleevents(void) if (ev.button.state == SDL_PRESSED) { -#if SDL_MAJOR_VERSION==1 - if (ev.button.button == SDL_BUTTON_WHEELUP) - { - mwheelup = totalclock; - } - if (ev.button.button == SDL_BUTTON_WHEELDOWN) - { - mwheeldown = totalclock; - } -#endif mouseb |= (1<0) mousepresscallback(5,0); - if (mousewheel[1]>0) mousepresscallback(6,0); + if (mouseb & 16) mousepresscallback(5, 0); + if (mouseb & 32) mousepresscallback(6, 0); if (mouseb & 64) mousepresscallback(7, 0); } - mousewheel[0]=mousewheel[1]=0; mouseb = 0; if (joypresscallback) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 05d81dcb5..b3a128419 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -4285,6 +4285,8 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int searchx = osearchx; searchy = osearchy; + inputchecked = 1; + ExtCheckKeys(); Bsprintf(buffer,"%s%d",namestart,danum); @@ -4478,6 +4480,8 @@ ENDFOR1: searchx = osearchx; searchy = osearchy; + inputchecked = 1; + ExtCheckKeys(); printmessage256(0,0,"^251Text entry mode.^31 Navigation keys change vars."); diff --git a/polymer/eduke32/source/jmact/control.c b/polymer/eduke32/source/jmact/control.c index 93f70c0f8..13f588dc6 100644 --- a/polymer/eduke32/source/jmact/control.c +++ b/polymer/eduke32/source/jmact/control.c @@ -791,6 +791,8 @@ void CONTROL_GetInput(ControlInfo *info) CONTROL_PollDevices(info); CONTROL_GetFunctionInput(); + + inputchecked = 1; } int32_t CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t ticspersecond)