diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index 55bb7d4c3..922917289 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -81,11 +81,8 @@ extern uint32_t divideu32_noinline(uint32_t n, uint32_t d); extern int32_t tabledivide32_noinline(int32_t n, int32_t d); extern int64_t tabledivide64_noinline(int64_t n, int64_t d); -#ifdef GEKKO -static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw(tabledivide64(ldexp(eax, ecx), ebx)); } -#else + static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw(tabledivide64(qw(eax) << by(ecx), ebx)); } -#endif static inline int64_t divscale64(int64_t eax, int64_t ebx, int64_t ecx) { return tabledivide64(eax << ecx, ebx); } diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index ccd0429ae..6f7262871 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -26,29 +26,12 @@ int32_t g_borderless=2; // input char inputdevices = 0; -vec2_t g_mousePos; -vec2_t g_mouseAbs; - bool g_mouseEnabled; bool g_mouseGrabbed; bool g_mouseInsideWindow = 1; bool g_mouseLockedToWindow = 1; - -void mouseReadPos(int32_t *x, int32_t *y) -{ - if (!g_mouseEnabled || !g_mouseGrabbed || !appactive) - { - *x = *y = 0; - return; - } - - *x = g_mousePos.x; - *y = g_mousePos.y; - g_mousePos.x = g_mousePos.y = 0; -} - int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput) { if (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index c16e5482d..2628bb928 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -1135,51 +1135,6 @@ void G_DisplayRest(int32_t smoothratio) } } -#ifdef GEKKO - // like the mouse cursor, the pointer doesn't use the crosshair enabled / scale options - if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.camerasprite == -1 && - (g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && mouseReadAbs((vec2_t *)&ud.returnvar[0], &g_mouseAbs)) - { - int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYPOINTER, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR); - if ((unsigned) a < MAXTILES) - { - vec2_t pointerpos = { tabledivide32(ud.returnvar[0], upscalefactor), tabledivide32(ud.returnvar[1], upscalefactor) }; - uint8_t pointer_pal = CROSSHAIR_PAL; - uint32_t pointer_o = 1|2; - uint32_t pointer_scale = 65536; - - auto const oyxaspect = yxaspect; - if (FURY) - { - pointerpos.x = scale(pointerpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15); - pointerpos.y = scale(pointerpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15); - pointer_scale = scale(pointer_scale, ydim << 2, xdim * 3) >> 1; - pointer_pal = 0; - pointer_o |= 1024; - renderSetAspect(viewingrange, 65536); - } - - rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o); - - if (FURY) - renderSetAspect(viewingrange, oyxaspect); - } - } -#endif -#if 0 - if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM) - { - for (i=0; iteam == g_player[myconnectindex].ps->team) - { - j = min(max((G_GetAngleDelta(getangle(g_player[i].ps->pos.x-g_player[myconnectindex].ps->pos.x, - g_player[i].ps->pos.y-g_player[myconnectindex].ps->pos.y), g_player[myconnectindex].ps->ang))>>1, -160), 160); - rotatesprite_win((160-j)<<16, 100L<<16, 65536L, 0, DUKEICON, 0, 0, 2+1); - } - } - } -#endif if (VM_HaveEvent(EVENT_DISPLAYREST)) { diff --git a/source/mact/src/control.cpp b/source/mact/src/control.cpp index f22bd1040..d96f50b65 100644 --- a/source/mact/src/control.cpp +++ b/source/mact/src/control.cpp @@ -65,10 +65,20 @@ bool CONTROL_SmoothMouse = 0; #define CONTROL_CheckRange(which) ((unsigned)which >= (unsigned)NUMKEYS) +vec2_t g_mousePos; // Written to directly by the message pump. +vec2_t g_mouseAbs; // Used by the menus for some coodinate voodoo. Will be removed anyway so no need to refactor. + static void CONTROL_GetMouseDelta(ControlInfo * info) { vec2_t input; - mouseReadPos(&input.x, &input.y); + if (!g_mouseEnabled || !g_mouseGrabbed || !appactive) + { + input = {0,0}; + return; + } + + input = g_mousePos; + g_mousePos = {}; vec2f_t finput = { float(input.x), float(input.y) }; diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index a3d27739e..bb7405def 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -1146,39 +1146,6 @@ void G_DisplayRest(int32_t smoothratio) } } -#ifdef GEKKO - // like the mouse cursor, the pointer doesn't use the crosshair enabled / scale options - if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.camerasprite == -1 && - (g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && mouseReadAbs((vec2_t *)&ud.returnvar[0], &g_mouseAbs)) - { - int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYPOINTER, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR); - if ((unsigned) a < MAXTILES) - { - vec2_t pointerpos = { tabledivide32(ud.returnvar[0], upscalefactor), tabledivide32(ud.returnvar[1], upscalefactor) }; - uint8_t pointer_pal = CROSSHAIR_PAL; - uint32_t pointer_o = 1|2; - uint32_t pointer_scale = 65536; - - auto const oyxaspect = yxaspect; - - rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o); - } - } -#endif -#if 0 - if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM) - { - for (i=0; iteam == g_player[myconnectindex].ps->team) - { - j = min(max((G_GetAngleDelta(getangle(g_player[i].ps->pos.x-g_player[myconnectindex].ps->pos.x, - g_player[i].ps->pos.y-g_player[myconnectindex].ps->pos.y), g_player[myconnectindex].ps->ang))>>1, -160), 160); - rotatesprite_win((160-j)<<16, 100L<<16, 65536L, 0, DUKEICON, 0, 0, 2+1); - } - } - } -#endif if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) menutext_center(100, "Game Paused");