mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-29 07:11:44 +00:00
Merge pull request #36 from petr666/feature/menu-cursor
Fix team arena cursor; prevent crashes caused by invalid pointer when switching to TA and back
This commit is contained in:
commit
271ce70f86
3 changed files with 20 additions and 17 deletions
|
@ -933,9 +933,6 @@ void UI_MouseEvent( int dx, int dy )
|
||||||
else if (uis.cursory > SCREEN_HEIGHT+16)
|
else if (uis.cursory > SCREEN_HEIGHT+16)
|
||||||
uis.cursory = SCREEN_HEIGHT+16;
|
uis.cursory = SCREEN_HEIGHT+16;
|
||||||
|
|
||||||
vr->menuCursorX = &uis.cursorx;
|
|
||||||
vr->menuCursorY = &uis.cursory;
|
|
||||||
|
|
||||||
// region test the active menu items
|
// region test the active menu items
|
||||||
for (i=0; i<uis.activemenu->nitems; i++)
|
for (i=0; i<uis.activemenu->nitems; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,13 +50,17 @@ Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, i
|
||||||
case UI_INIT: {
|
case UI_INIT: {
|
||||||
int ptr[2] = {arg1, arg2};
|
int ptr[2] = {arg1, arg2};
|
||||||
vr = (vr_clientinfo_t *) (*(long *) (ptr));
|
vr = (vr_clientinfo_t *) (*(long *) (ptr));
|
||||||
|
|
||||||
UI_Init();
|
UI_Init();
|
||||||
|
vr->menuCursorX = &uis.cursorx;
|
||||||
|
vr->menuCursorY = &uis.cursory;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case UI_SHUTDOWN:
|
case UI_SHUTDOWN: {
|
||||||
UI_Shutdown();
|
vr->menuCursorX = NULL;
|
||||||
|
vr->menuCursorY = NULL;
|
||||||
|
UI_Shutdown();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case UI_KEY_EVENT:
|
case UI_KEY_EVENT:
|
||||||
|
|
|
@ -163,15 +163,20 @@ Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, i
|
||||||
return UI_API_VERSION;
|
return UI_API_VERSION;
|
||||||
|
|
||||||
case UI_INIT: {
|
case UI_INIT: {
|
||||||
int ptr[2] = {arg1, arg2};
|
int ptr[2] = {arg1, arg2};
|
||||||
vr = (vr_clientinfo_t *) (*(long *) (ptr));
|
vr = (vr_clientinfo_t *) (*(long *) (ptr));
|
||||||
_UI_Init(arg0);
|
_UI_Init(arg0);
|
||||||
}
|
vr->menuCursorX = &uiInfo.uiDC.cursorx;
|
||||||
return 0;
|
vr->menuCursorY = &uiInfo.uiDC.cursory;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
case UI_SHUTDOWN:
|
case UI_SHUTDOWN: {
|
||||||
_UI_Shutdown();
|
vr->menuCursorX = NULL;
|
||||||
return 0;
|
vr->menuCursorY = NULL;
|
||||||
|
_UI_Shutdown();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
case UI_KEY_EVENT:
|
case UI_KEY_EVENT:
|
||||||
_UI_KeyEvent( arg0, arg1 );
|
_UI_KeyEvent( arg0, arg1 );
|
||||||
|
@ -5272,9 +5277,6 @@ void _UI_MouseEvent( int dx, int dy )
|
||||||
else if (uiInfo.uiDC.cursory > SCREEN_HEIGHT+16)
|
else if (uiInfo.uiDC.cursory > SCREEN_HEIGHT+16)
|
||||||
uiInfo.uiDC.cursory = SCREEN_HEIGHT+16;
|
uiInfo.uiDC.cursory = SCREEN_HEIGHT+16;
|
||||||
|
|
||||||
vr->menuCursorX = &uiInfo.uiDC.cursorx;
|
|
||||||
vr->menuCursorY = &uiInfo.uiDC.cursory;
|
|
||||||
|
|
||||||
if (Menu_Count() > 0) {
|
if (Menu_Count() > 0) {
|
||||||
//menuDef_t *menu = Menu_GetFocused();
|
//menuDef_t *menu = Menu_GetFocused();
|
||||||
//Menu_HandleMouseMove(menu, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory);
|
//Menu_HandleMouseMove(menu, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory);
|
||||||
|
|
Loading…
Reference in a new issue