Fix sticky keys due to loading screens

Fix infinite loop/hang after an assertion failure

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1113 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-07-25 04:44:58 +00:00
parent b559e8601d
commit b24712f2b6
2 changed files with 26 additions and 2 deletions
+8 -2
View File
@@ -1613,9 +1613,15 @@ void DequeueAllKeyBoardEvents()
//dequeue all the events waiting in the windows queue
while( PeekMessage( &KeyMessage, ghWindow, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) );
//Give them proper processing like the old window hook method used to.
while( PeekMessage( &KeyMessage, ghWindow, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) )
{
TranslateMessage( &KeyMessage);
DispatchMessage( &KeyMessage);
}
//Deque all the events waiting in the SGP queue
//Now deque all the events waiting in the SGP queue
//Including those that were just posted in the code above
while (DequeueEvent(&InputEvent) == TRUE)
{
//dont do anything
+18
View File
@@ -1743,6 +1743,12 @@ void RefreshScreen(void *DummyVariable)
ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, 0, 0, gpFrameBuffer, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
{
// Prevent the assertion error lockup
if (ReturnCode == DDERR_INVALIDRECT)
{
break;
}
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
if (ReturnCode == DDERR_SURFACELOST)
@@ -2133,6 +2139,12 @@ void RefreshScreen(void *DummyVariable)
ReturnCode = IDirectDrawSurface2_SGPBltFast(gMouseCursorBackground[CURRENT_MOUSE_DATA].pSurface, gMouseCursorBackground[CURRENT_MOUSE_DATA].usLeft, gMouseCursorBackground[CURRENT_MOUSE_DATA].usTop, gpBackBuffer, &Region, DDBLTFAST_NOCOLORKEY);
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
{
// Prevent the assertion failure lockup
if (ReturnCode == DDERR_INVALIDRECT)
{
break;
}
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
}
@@ -2156,6 +2168,12 @@ void RefreshScreen(void *DummyVariable)
ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseXPos, gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseYPos, gpMouseCursor, &Region, DDBLTFAST_SRCCOLORKEY);
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
{
// Prevent the assertion failure lockup
if (ReturnCode == DDERR_INVALIDRECT)
{
break;
}
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
}