Set up mouse cursor display in menus, with idle timeout fully implemented. No functionality yet. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4738 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-11-17 07:39:12 +00:00
parent e5923955ef
commit 164d9ccb41
15 changed files with 158 additions and 93 deletions

View file

@ -101,7 +101,7 @@ extern void SetKey(int32_t key, int32_t state);
// mouse // mouse
extern int32_t mousex, mousey, mouseb, mouseabsx, mouseabsy; extern int32_t mousex, mousey, mouseb, mouseabsx, mouseabsy;
extern uint8_t mousegrab, moustat; extern uint8_t mousegrab, moustat, mouseinwindow, AppMouseGrab;
// joystick // joystick
extern int32_t *joyaxis, *joyhat, joyb; extern int32_t *joyaxis, *joyhat, joyb;
@ -158,8 +158,9 @@ void bflushchars(void);
int32_t initmouse(void); int32_t initmouse(void);
void uninitmouse(void); void uninitmouse(void);
void grabmouse(char a); void grabmouse(char a);
void AppGrabMouse(char a);
void readmousexy(int32_t *x, int32_t *y); void readmousexy(int32_t *x, int32_t *y);
void readmouseabsxy(int32_t *x, int32_t *y); int32_t readmouseabsxy(int32_t *x, int32_t *y);
void readmousebstatus(int32_t *b); void readmousebstatus(int32_t *b);
void readjoybstatus(int32_t *b); void readjoybstatus(int32_t *b);
void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur); void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur);

View file

@ -16,7 +16,7 @@ char remap[KEYSTATUSSIZ];
int32_t remapinit=0; int32_t remapinit=0;
char key_names[NUMKEYS][24]; char key_names[NUMKEYS][24];
int32_t mousex=0,mousey=0,mouseb=0,mouseabsx=0,mouseabsy=0; int32_t mousex=0,mousey=0,mouseb=0,mouseabsx=0,mouseabsy=0;
uint8_t moustat = 0, mousegrab = 0; uint8_t moustat = 0, mousegrab = 0, mouseinwindow = 1, AppMouseGrab = 1;
int32_t *joyaxis = NULL, joyb=0, *joyhat = NULL; int32_t *joyaxis = NULL, joyb=0, *joyhat = NULL;
char joyisgamepad=0, joynumaxes=0, joynumbuttons=0, joynumhats=0; char joyisgamepad=0, joynumaxes=0, joynumbuttons=0, joynumhats=0;
int32_t joyaxespresent=0; int32_t joyaxespresent=0;
@ -104,24 +104,24 @@ void readmousexy(int32_t *x, int32_t *y)
mousex = mousey = 0; mousex = mousey = 0;
} }
void readmouseabsxy(int32_t *x, int32_t *y) int32_t readmouseabsxy(int32_t *x, int32_t *y)
{ {
if (!moustat || !mousegrab || !appactive) int32_t xwidth;
{
// no mouse, centre it if (!moustat || !mouseinwindow)
*x = xdim >> 1; return 0;
*y = ydim >> 1;
} xwidth = max(scale(240<<16, xdim, ydim), 320<<16);
else
{ *x = scale(mouseabsx, xwidth, xdim) - ((xwidth>>1) - (320<<15));
*x = mouseabsx; *y = scale(mouseabsy, 200<<16, ydim);
*y = mouseabsy;
} return 1;
} }
void readmousebstatus(int32_t *b) void readmousebstatus(int32_t *b)
{ {
if (!moustat || !mousegrab || !appactive) { *b = 0; return; } if (!moustat || !appactive || !mouseinwindow) { *b = 0; return; }
*b = mouseb; *b = mouseb;
} }

View file

@ -1429,7 +1429,7 @@ void OSD_CaptureInput(int32_t cap)
{ {
osd->flags = (osd->flags & ~(OSD_CAPTURE|OSD_CTRL|OSD_SHIFT)) | (-cap & OSD_CAPTURE); osd->flags = (osd->flags & ~(OSD_CAPTURE|OSD_CTRL|OSD_SHIFT)) | (-cap & OSD_CAPTURE);
grabmouse(cap == 0); grabmouse(cap == 0 ? AppMouseGrab : 0);
onshowosd(cap); onshowosd(cap);
if (cap) if (cap)

View file

@ -251,7 +251,7 @@ void RI_PollDevices(BOOL loop)
int32_t initmouse(void) int32_t initmouse(void)
{ {
if (moustat) return 0; if (moustat) return 0;
grabmouse(moustat = 1); grabmouse(moustat = AppMouseGrab);
return 0; return 0;
} }
@ -279,3 +279,7 @@ void grabmouse(char a)
SetCursorPos(pos.x, pos.y); SetCursorPos(pos.x, pos.y);
} }
void AppGrabMouse(char a)
{
UNREFERENCED_PARAMETER(a);
}

View file

@ -910,8 +910,8 @@ const char *getjoyname(int32_t what, int32_t num)
// //
int32_t initmouse(void) int32_t initmouse(void)
{ {
moustat=1; moustat=AppMouseGrab;
grabmouse(1); // FIXME - SA grabmouse(AppMouseGrab); // FIXME - SA
return 0; return 0;
} }
@ -966,7 +966,13 @@ void grabmouse(char a)
mousegrab = a; mousegrab = a;
} }
mousex = mousey = 0; mousex = mousey = 0;
mouseabsx = mouseabsy = 0; }
void AppGrabMouse(char a)
{
grabmouse(a);
AppMouseGrab = mousegrab;
SDL_ShowCursor(SDL_DISABLE);
} }
// //
@ -1947,7 +1953,8 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
//if (c==8) setpalette(0,256,0); //if (c==8) setpalette(0,256,0);
if (regrab) grabmouse(1); if (regrab)
grabmouse(AppMouseGrab);
return 0; return 0;
} }
@ -2375,7 +2382,7 @@ int32_t handleevents(void)
case SDL_WINDOWEVENT_FOCUS_GAINED: case SDL_WINDOWEVENT_FOCUS_GAINED:
appactive = 1; appactive = 1;
if (mousegrab && moustat) if (mousegrab && moustat)
grabmouse_low(1); grabmouse_low(AppMouseGrab);
#ifdef _WIN32 #ifdef _WIN32
if (backgroundidle) if (backgroundidle)
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
@ -2397,6 +2404,12 @@ int32_t handleevents(void)
windowy = ev.window.data2; windowy = ev.window.data2;
} }
break; break;
case SDL_WINDOWEVENT_ENTER:
mouseinwindow = 1;
break;
case SDL_WINDOWEVENT_LEAVE:
mouseinwindow = 0;
break;
} }
break; break;
// #warning Using SDL 1.3 or 2.X // #warning Using SDL 1.3 or 2.X
@ -2462,7 +2475,7 @@ int32_t handleevents(void)
if (mousegrab && moustat) if (mousegrab && moustat)
{ {
if (appactive) if (appactive)
grabmouse_low(1); grabmouse_low(AppMouseGrab);
else else
grabmouse_low(0); grabmouse_low(0);
} }
@ -2474,6 +2487,8 @@ int32_t handleevents(void)
# endif # endif
rv=-1; rv=-1;
} }
if (ev.active.state & SDL_APPMOUSEFOCUS)
mouseinwindow = ev.active.gain;
break; break;
#endif // SDL version #endif // SDL version
@ -2536,25 +2551,29 @@ int32_t handleevents(void)
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
#ifdef GEKKO
// check if it's a wiimote pointer pretending to be a mouse
if (ev.motion.state & SDL_BUTTON_X2MASK)
{
// the absolute values are used to draw the crosshair
mouseabsx = ev.motion.x;
mouseabsy = ev.motion.y;
// hack: reduce the scale of the "relative" motions
// to make it act more like a real mouse
ev.motion.xrel /= 16;
ev.motion.yrel /= 12;
}
#else
mouseabsx = ev.motion.x;
mouseabsy = ev.motion.y;
#endif
// SDL <VER> doesn't handle relative mouse movement correctly yet as the cursor still clips to the screen edges // SDL <VER> doesn't handle relative mouse movement correctly yet as the cursor still clips to the screen edges
// so, we call SDL_WarpMouse() to center the cursor and ignore the resulting motion event that occurs // so, we call SDL_WarpMouse() to center the cursor and ignore the resulting motion event that occurs
// <VER> is 1.3 for PK, 1.2 for tueidj // <VER> is 1.3 for PK, 1.2 for tueidj
if (appactive && mousegrab) if (appactive && mousegrab)
{ {
#ifdef GEKKO if (ev.motion.x != (xdim>>1) || ev.motion.y != (ydim>>1))
// check if it's a wiimote pointer pretending to be a mouse
if (ev.motion.state & SDL_BUTTON_X2MASK)
{
// the absolute values are used to draw the crosshair
mouseabsx = ev.motion.x;
mouseabsy = ev.motion.y;
// hack: reduce the scale of the "relative" motions
// to make it act more like a real mouse
ev.motion.xrel /= 16;
ev.motion.yrel /= 12;
}
#endif
if (ev.motion.x != xdim>>1 || ev.motion.y != ydim>>1)
{ {
mousex += ev.motion.xrel; mousex += ev.motion.xrel;
mousey += ev.motion.yrel; mousey += ev.motion.yrel;

View file

@ -3536,7 +3536,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
{ {
if (regrabmouse) if (regrabmouse)
{ {
grabmouse(1); grabmouse(AppMouseGrab);
regrabmouse = 0; regrabmouse = 0;
} }
ShowWindow(hWindow, SW_RESTORE); ShowWindow(hWindow, SW_RESTORE);

View file

@ -55,9 +55,9 @@ static int32_t demo_synccompress=1, demorec_seeds=1, demo_hasseeds;
static void Demo_RestoreModes(int32_t menu) static void Demo_RestoreModes(int32_t menu)
{ {
if (menu) if (menu)
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
else else
g_player[myconnectindex].ps->gm &= ~MODE_MENU; M_CloseMenu(myconnectindex);
g_player[myconnectindex].ps->gm &= ~MODE_GAME; g_player[myconnectindex].ps->gm &= ~MODE_GAME;
g_player[myconnectindex].ps->gm |= MODE_DEMO; g_player[myconnectindex].ps->gm |= MODE_DEMO;
@ -561,7 +561,7 @@ RECHECK:
{ {
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
} }
ready2send = 0; ready2send = 0;
@ -702,7 +702,7 @@ RECHECK:
corrupt: corrupt:
OSD_Printf(OSD_ERROR "Demo %d is corrupt (code %d).\n", g_whichDemo-1, corruptcode); OSD_Printf(OSD_ERROR "Demo %d is corrupt (code %d).\n", g_whichDemo-1, corruptcode);
nextdemo: nextdemo:
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
nextdemo_nomenu: nextdemo_nomenu:
foundemo = 0; foundemo = 0;
ud.reccnt = 0; ud.reccnt = 0;
@ -913,7 +913,7 @@ nextdemo_nomenu:
I_EscapeTriggerClear(); I_EscapeTriggerClear();
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
M_ChangeMenu(MENU_MAIN); M_ChangeMenu(MENU_MAIN);
S_MenuSound(); S_MenuSound();
} }
@ -928,7 +928,10 @@ nextdemo_nomenu:
Net_SendMessage(); Net_SendMessage();
if ((g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE) if ((g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE)
g_player[myconnectindex].ps->gm = MODE_MENU; {
g_player[myconnectindex].ps->gm = 0;
M_OpenMenu(myconnectindex);
}
} }
else else
{ {

View file

@ -3280,7 +3280,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
} }
} }
#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1)
palette_t CrosshairColors = { 255, 255, 255, 0 }; palette_t CrosshairColors = { 255, 255, 255, 0 };
palette_t DefaultCrosshairColors = { 0, 0, 0, 0 }; palette_t DefaultCrosshairColors = { 0, 0, 0, 0 };
@ -3728,7 +3727,7 @@ void G_DisplayRest(int32_t smoothratio)
S_MenuSound(); S_MenuSound();
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) ready2send = 0; if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) ready2send = 0;
@ -3757,20 +3756,14 @@ void G_DisplayRest(int32_t smoothratio)
a = CROSSHAIR; a = CROSSHAIR;
#ifdef GEKKO #ifdef GEKKO
readmouseabsxy(&x, &y); if (!readmouseabsxy(&x, &y))
if (x || y)
{
x >>= 1;
y = (y*5)/12;
}
else
#endif #endif
{ {
x = 160; x = 160<<16;
y = 100; y = 100<<16;
} }
rotatesprite_win((x-(g_player[myconnectindex].ps->look_ang>>1))<<16,y<<16,scale(65536,ud.crosshairscale,100), rotatesprite_win(x-(g_player[myconnectindex].ps->look_ang<<15),y,scale(65536,ud.crosshairscale,100),
0,a,0,CROSSHAIR_PAL,2+1); 0,a,0,CROSSHAIR_PAL,2+1);
} }
} }
@ -8883,7 +8876,7 @@ void G_HandleLocalKeys(void)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
if ((!g_netServer && ud.multimode < 2)) if ((!g_netServer && ud.multimode < 2))
{ {
@ -8936,7 +8929,7 @@ FAKE_F2:
S_ClearSoundLocks(); S_ClearSoundLocks();
// setview(0,0,xdim-1,ydim-1); // setview(0,0,xdim-1,ydim-1);
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
if ((!g_netServer && ud.multimode < 2)) if ((!g_netServer && ud.multimode < 2))
{ {
@ -8956,7 +8949,7 @@ FAKE_F3:
S_ClearSoundLocks(); S_ClearSoundLocks();
// setview(0,0,xdim-1,ydim-1); // setview(0,0,xdim-1,ydim-1);
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
{ {
ready2send = 0; ready2send = 0;
@ -8972,7 +8965,7 @@ FAKE_F3:
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
{ {
ready2send = 0; ready2send = 0;
@ -9073,7 +9066,7 @@ FAKE_F3:
M_ChangeMenu(MENU_QUIT_INGAME); M_ChangeMenu(MENU_QUIT_INGAME);
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
{ {
ready2send = 0; ready2send = 0;
@ -9139,7 +9132,7 @@ FAKE_F3:
M_ChangeMenu(MENU_COLCORR_INGAME); M_ChangeMenu(MENU_COLCORR_INGAME);
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
{ {
ready2send = 0; ready2send = 0;
@ -11090,7 +11083,8 @@ void G_BackToMenu(void)
boardfilename[0] = 0; boardfilename[0] = 0;
if (ud.recstat == 1) G_CloseDemoWrite(); if (ud.recstat == 1) G_CloseDemoWrite();
ud.warp_on = 0; ud.warp_on = 0;
g_player[myconnectindex].ps->gm = MODE_MENU; g_player[myconnectindex].ps->gm = 0;
M_OpenMenu(myconnectindex);
M_ChangeMenu(MENU_MAIN); M_ChangeMenu(MENU_MAIN);
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
G_UpdateAppTitle(); G_UpdateAppTitle();
@ -11126,7 +11120,8 @@ static int32_t G_EndOfLevel(void)
{ {
if (!VOLUMEALL) if (!VOLUMEALL)
G_DoOrderScreen(); G_DoOrderScreen();
g_player[myconnectindex].ps->gm = MODE_MENU; g_player[myconnectindex].ps->gm = 0;
M_OpenMenu(myconnectindex);
M_ChangeMenu(MENU_MAIN); M_ChangeMenu(MENU_MAIN);
return 2; return 2;
} }

View file

@ -293,6 +293,8 @@ extern int32_t voting;
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen; //extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1)
extern palette_t CrosshairColors; extern palette_t CrosshairColors;
extern palette_t DefaultCrosshairColors; extern palette_t DefaultCrosshairColors;

View file

@ -989,7 +989,7 @@ static int32_t VM_ResetPlayer(int32_t g_p, int32_t g_flags)
{ {
if (g_lastSaveSlot >= 0 && ud.recstat != 2) if (g_lastSaveSlot >= 0 && ud.recstat != 2)
{ {
g_player[g_p].ps->gm |= MODE_MENU; M_OpenMenu(g_p);
KB_ClearKeyDown(sc_Space); KB_ClearKeyDown(sc_Space);
I_AdvanceTriggerClear(); I_AdvanceTriggerClear();
M_ChangeMenu(MENU_RESETPLAYER); M_ChangeMenu(MENU_RESETPLAYER);

View file

@ -1775,6 +1775,10 @@ static void __fastcall VM_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVa
case PLAYER_SCREAM_VOICE: case PLAYER_SCREAM_VOICE:
ps->scream_voice=lVar1; return; ps->scream_voice=lVar1; return;
case PLAYER_GM: case PLAYER_GM:
if (!(ps->gm & MODE_MENU) && (lVar1 & MODE_MENU))
M_OpenMenu(iPlayer);
else if ((ps->gm & MODE_MENU) && !(lVar1 & MODE_MENU))
M_CloseMenu(iPlayer);
ps->gm=lVar1; return; ps->gm=lVar1; return;
case PLAYER_ON_WARPING_SECTOR: case PLAYER_ON_WARPING_SECTOR:
ps->on_warping_sector=lVar1; return; ps->on_warping_sector=lVar1; return;

View file

@ -3194,23 +3194,7 @@ void M_ChangeMenu(MenuID_t cm)
g_currentMenu = g_previousMenu; g_currentMenu = g_previousMenu;
} }
else if (cm == MENU_CLOSE) else if (cm == MENU_CLOSE)
{ M_CloseMenu(myconnectindex);
if (g_player[myconnectindex].ps->gm & MODE_GAME)
{
g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
{
ready2send = 1;
totalclock = ototalclock;
CAMERACLOCK = totalclock;
CAMERADIST = 65536;
m_animation.start = 0;
m_animation.length = 0;
}
walock[TILE_SAVESHOT] = 199;
G_UpdateScreenArea();
}
}
else if (cm >= 0) else if (cm >= 0)
{ {
if ((g_player[myconnectindex].ps->gm&MODE_GAME) && cm == MENU_MAIN) if ((g_player[myconnectindex].ps->gm&MODE_GAME) && cm == MENU_MAIN)
@ -3392,6 +3376,42 @@ static inline int32_t M_UpdateScreenOK(MenuID_t cm)
chances are you should scroll up. chances are you should scroll up.
*/ */
#define M_MOUSETIMEOUT 120
static int32_t m_mouselastactivity;
static vec2_t m_prevmousepos, m_mousepos;
void M_OpenMenu(size_t playerID)
{
g_player[playerID].ps->gm |= MODE_MENU;
readmouseabsxy(&m_prevmousepos.x, &m_prevmousepos.y);
m_mouselastactivity = -M_MOUSETIMEOUT;
AppGrabMouse(0);
}
void M_CloseMenu(size_t playerID)
{
if (g_player[playerID].ps->gm & MODE_GAME)
{
// The following lines are here so that you cannot close the menu when no game is running.
g_player[playerID].ps->gm &= ~MODE_MENU;
AppGrabMouse(1);
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
{
ready2send = 1;
totalclock = ototalclock;
CAMERACLOCK = totalclock;
CAMERADIST = 65536;
m_animation.start = 0;
m_animation.length = 0;
}
walock[TILE_SAVESHOT] = 199;
G_UpdateScreenArea();
}
}
static void M_BlackRectangle(int32_t x, int32_t y, int32_t width, int32_t height) static void M_BlackRectangle(int32_t x, int32_t y, int32_t width, int32_t height)
{ {
const int32_t xscale = scale(65536, width, tilesiz[0].x<<16), yscale = scale(65536, height, tilesiz[0].y<<16); const int32_t xscale = scale(65536, width, tilesiz[0].x<<16), yscale = scale(65536, height, tilesiz[0].y<<16);
@ -4919,6 +4939,14 @@ void M_DisplayMenus(void)
return; return;
} }
if (!M_IsTextInput(m_currentMenu) && KB_KeyPressed(sc_Q))
{
g_previousMenu = g_currentMenu;
M_ChangeMenuAnimate(MENU_QUIT, MA_Advance);
}
M_RunMenuInput(m_currentMenu);
VM_OnEvent(EVENT_DISPLAYMENU, g_player[screenpeek].ps->i, screenpeek, -1, 0); VM_OnEvent(EVENT_DISPLAYMENU, g_player[screenpeek].ps->i, screenpeek, -1, 0);
g_player[myconnectindex].ps->gm &= (0xff-MODE_TYPE); g_player[myconnectindex].ps->gm &= (0xff-MODE_TYPE);
@ -4930,12 +4958,6 @@ void M_DisplayMenus(void)
if (M_UpdateScreenOK(g_currentMenu)) if (M_UpdateScreenOK(g_currentMenu))
G_UpdateScreenArea(); G_UpdateScreenArea();
if (!M_IsTextInput(m_currentMenu) && KB_KeyPressed(sc_Q))
{
g_previousMenu = g_currentMenu;
M_ChangeMenuAnimate(MENU_QUIT, MA_Advance);
}
#if defined(USE_OPENGL) && defined(DROIDMENU) #if defined(USE_OPENGL) && defined(DROIDMENU)
gltexfiltermode = 1; gltexfiltermode = 1;
gltexapplyprops(); gltexapplyprops();
@ -4955,8 +4977,6 @@ void M_DisplayMenus(void)
else else
M_RunMenu(m_currentMenu, origin); M_RunMenu(m_currentMenu, origin);
M_RunMenuInput(m_currentMenu);
#if defined(USE_OPENGL) && defined(DROIDMENU) #if defined(USE_OPENGL) && defined(DROIDMENU)
gltexfiltermode = menufiltermode ? 5 : 2; gltexfiltermode = menufiltermode ? 5 : 2;
gltexapplyprops(); gltexapplyprops();
@ -4965,6 +4985,20 @@ void M_DisplayMenus(void)
if (VM_HaveEvent(EVENT_DISPLAYMENUREST)) if (VM_HaveEvent(EVENT_DISPLAYMENUREST))
VM_OnEvent(EVENT_DISPLAYMENUREST, g_player[screenpeek].ps->i, screenpeek, -1, 0); VM_OnEvent(EVENT_DISPLAYMENUREST, g_player[screenpeek].ps->i, screenpeek, -1, 0);
if (readmouseabsxy(&m_mousepos.x, &m_mousepos.y))
{
if (m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y)
{
m_prevmousepos = m_mousepos;
m_mouselastactivity = totalclock;
}
}
else
m_mouselastactivity = -M_MOUSETIMEOUT;
if (totalclock - m_mouselastactivity < M_MOUSETIMEOUT)
rotatesprite_win(m_mousepos.x,m_mousepos.y,65536,0,CROSSHAIR,0,CROSSHAIR_PAL,2|1);
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)
{ {
G_UpdateScreenArea(); G_UpdateScreenArea();

View file

@ -374,6 +374,8 @@ void M_ChangeMenuAnimate(int32_t cm, MenuAnimationType_t animtype);
int32_t M_IsTextInput(Menu_t *cm); int32_t M_IsTextInput(Menu_t *cm);
void G_CheckPlayerColor(int32_t *color,int32_t prev_color); void G_CheckPlayerColor(int32_t *color,int32_t prev_color);
void M_Init(void); void M_Init(void);
void M_OpenMenu(size_t playerID);
void M_CloseMenu(size_t playerID);
void M_DisplayMenus(void); void M_DisplayMenus(void);
#endif #endif

View file

@ -136,7 +136,7 @@ static int32_t osdcmd_changelevel(const osdfuncparm_t *parm)
if ((GametypeFlags[ud.m_coop] & GAMETYPE_PLAYERSFRIENDLY) && !(GametypeFlags[ud.m_coop] & GAMETYPE_TDM)) if ((GametypeFlags[ud.m_coop] & GAMETYPE_PLAYERSFRIENDLY) && !(GametypeFlags[ud.m_coop] & GAMETYPE_TDM))
ud.m_noexits = 0; ud.m_noexits = 0;
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
M_ChangeMenu(MENU_NETWAITVOTES); M_ChangeMenu(MENU_NETWAITVOTES);
} }
*/ */
@ -272,7 +272,7 @@ static int32_t osdcmd_map(const osdfuncparm_t *parm)
if ((GametypeFlags[ud.m_coop] & GAMETYPE_PLAYERSFRIENDLY) && !(GametypeFlags[ud.m_coop] & GAMETYPE_TDM)) if ((GametypeFlags[ud.m_coop] & GAMETYPE_PLAYERSFRIENDLY) && !(GametypeFlags[ud.m_coop] & GAMETYPE_TDM))
ud.m_noexits = 0; ud.m_noexits = 0;
g_player[myconnectindex].ps->gm |= MODE_MENU; M_OpenMenu(myconnectindex);
M_ChangeMenu(MENU_NETWAITVOTES); M_ChangeMenu(MENU_NETWAITVOTES);
} }
*/ */

View file

@ -1400,6 +1400,7 @@ end_vol4a:
p->zoom = 768; p->zoom = 768;
#endif #endif
p->gm = 0; p->gm = 0;
M_CloseMenu(0);
#if !defined LUNATIC #if !defined LUNATIC
//AddLog("Newgame"); //AddLog("Newgame");