void GetPlayerKeyBoardInputForIMPHomePage( void ) { InputAtom InputEvent; POINT MousePos; GetCursorPos(&MousePos); while (DequeueEvent(&InputEvent) == TRUE) { // HOOK INTO MOUSE HOOKS /* switch(InputEvent.usEvent) { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_UP: MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; } */ if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT || InputEvent.usEvent == KEY_UP ) ) { switch( InputEvent.usParam ) { case (( ENTER ) ): if(( InputEvent.usEvent == KEY_UP ) ) { // return hit, check to see if current player activation string is a valid one ProcessPlayerInputActivationString( ); fNewCharInActivationString = TRUE; } break; case (( ESC )): LeaveLapTopScreen( ); break; default: if(InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT ) { HandleTextEvent( InputEvent.usParam ); } break; } } } return; }
/* * Called when the Router Manager tells us there's an event * in our event queue. * NOTE: this can be called after the protocol is stopped, as in when * the ip router manager is retrieving the ROUTER_STOPPED message, so * we do not call ENTER_XORPRTM_API()/LEAVE_XORPRTM_API(). */ DWORD CM_GetEventMessage ( ROUTING_PROTOCOL_EVENTS *prpeEvent, MESSAGE *pmMessage) { DWORD dwErr = NO_ERROR; dwErr = DequeueEvent(prpeEvent, pmMessage); return dwErr; }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: void StateMachineRun(StateMachine* s) { uint8_t next_event = DequeueEvent(s); State next_state = LookupTransition(s, next_event); // Will this cause a transition? if (s->state != next_state) { (s->state)(EXIT); s->state = next_state; (s->state)(ENTER); } else { (s->state)(next_event); } }
void GetGIOScreenUserInput() { InputAtom Event; // POINT MousePos; // GetCursorPos(&MousePos); while( DequeueEvent( &Event ) ) { if( Event.usEvent == KEY_DOWN ) { switch( Event.usParam ) { case ESC: //Exit out of the screen gubGameOptionScreenHandler = GIO_CANCEL; break; #ifdef JA2TESTVERSION case 'r': gfReRenderGIOScreen=TRUE; break; case 'i': InvalidateRegion( 0, 0, 640, 480 ); break; #endif case ENTER: gubGameOptionScreenHandler = GIO_EXIT; break; } } } }
void PopupMenuHandle() { InputAtom InputEvent; if( gPopup.ubActiveType == POPUP_ACTIVETYPE_NOT_YET_DETERMINED ) { //Attempt to determine if the menu will be persistant or not. //Determination is made when the mouse's left button is released or if //the mouse cursor enters the menu region. if( gusMouseXPos >= gPopup.usLeft && gusMouseXPos <= gPopup.usRight && gusMouseYPos > gPopup.usTop //one pixel gap on top ignored && gusMouseYPos < gPopup.usBottom - 1 ) //two pixel gap on bottom ignored { //mouse cursor has just entered the menu region -- nonpersistant. //KRIS: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //Disabled this because Linda doesn't like it... (I like it though, and it works) //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //UNCOMMENT IF NONPERSISTANT IS ALLOWED //gPopup.ubActiveType = POPUP_ACTIVETYPE_NONPERSISTANT; return; } else if( !gfLeftButtonState ) { //left button has been released before entering region -- persistant gPopup.ubActiveType = POPUP_ACTIVETYPE_PERSISTANT; return; } } if( !gPopup.fUseKeyboardInfoUntilMouseMoves ) { //check menu entry based on mouse position gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); } else if( gusMouseXPos != gPopup.usLastMouseX || gusMouseYPos != gPopup.usLastMouseY ) { //The keyboard determined the last entry, but the mouse has moved, //so use the mouse to determine the new entry. gPopup.fUseKeyboardInfoUntilMouseMoves = FALSE; gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); } //Check terminating conditions for persistant states. if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT ) fWaitingForLButtonRelease = TRUE; if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT || !gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_NONPERSISTANT ) { //Selection conditions via mouse have been met whether the mouse is in the //menu region or not. gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); if( gPopup.ubSelectedIndex ) { ProcessPopupMenuSelection(); } gPopup.fActive = FALSE; MSYS_RemoveRegion( &popupRegion ); gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; return; } //Use keyboard input as well. while( DequeueEvent( &InputEvent ) ) { switch(InputEvent.usEvent) { case KEY_DOWN: switch( InputEvent.usParam ) { case DNARROW: gPopup.fUseKeyboardInfoUntilMouseMoves = TRUE; gPopup.usLastMouseX = gusMouseXPos; gPopup.usLastMouseY = gusMouseYPos; gPopup.ubSelectedIndex++; if( gPopup.ubSelectedIndex > gPopup.ubNumEntries ) { gPopup.ubSelectedIndex = 1; } break; case UPARROW: gPopup.fUseKeyboardInfoUntilMouseMoves = TRUE; gPopup.usLastMouseX = gusMouseXPos; gPopup.usLastMouseY = gusMouseYPos; if( gPopup.ubSelectedIndex < 2 ) { gPopup.ubSelectedIndex = gPopup.ubNumEntries; } else { gPopup.ubSelectedIndex--; } break; case ESC: gPopup.fActive = FALSE; MSYS_RemoveRegion( &popupRegion ); gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; break; case ENTER: ProcessPopupMenuSelection(); gPopup.fActive = FALSE; MSYS_RemoveRegion( &popupRegion ); gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; break; } break; } } }
UINT32 MPChatScreenHandle( ) { InputAtom InputEvent; if ( gfNewChatBox ) { // If in game screen.... if ( ( gfStartedFromGameScreen )||( gfStartedFromMapScreen ) ) { //UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; //UINT8 *pDestBuf, *pSrcBuf; if( gfStartedFromGameScreen ) { HandleTacticalUILoseCursorFromOtherScreen( ); } else { HandleMAPUILoseCursorFromOtherScreen( ); } gfStartedFromGameScreen = FALSE; gfStartedFromMapScreen = FALSE; } gfNewChatBox = FALSE; return( MP_CHAT_SCREEN ); } UnmarkButtonsDirty( ); // Render the box! if ( gChatBox.fRenderBox ) { // Render the Background ( this includes the text string) RenderMercPopUpBoxFromIndex( gChatBox.iBoxId, gChatBox.sX, gChatBox.sY, FRAME_BUFFER ); UINT16 usWidth = StringPixLength( gzMPChatboxText[0], CHATBOX_FONT_TITLE ); int usPosY = 0; int usPosX = 0; usPosY = gChatBox.sY + 10; usPosX = gChatBox.sX + ((gChatBox.usWidth - usWidth) / 2); DrawTextToScreen( gzMPChatboxText[0], usPosX, usPosY, usWidth, CHATBOX_FONT_TITLE, CHATBOX_FONT_COLOR, DEFAULT_SHADOW, FALSE, CENTER_JUSTIFIED | TEXT_SHADOWED ); // Render the toggle button strings for(UINT8 cnt=0; cnt<NUM_CHAT_TOGGLES; cnt++) { GUI_BUTTON* btn = ButtonList[ guiChatToggles[ cnt ] ]; usPosX = btn->XLoc + 12 + 10; usPosY = btn->YLoc; usWidth = StringPixLength( gzMPChatToggleText[ cnt ], CHATBOX_FONT_TOGGLE ); DrawTextToScreen( gzMPChatToggleText[ cnt ], usPosX, usPosY, usWidth, CHATBOX_FONT_TOGGLE, CHATBOX_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); } if (gIncludeChatLog) { // draw chatbox HVOBJECT hHandle; // get and blt panel GetVideoObject(&hHandle, guiCHATLOGIMG ); BltVideoObject( FRAME_BUFFER , hHandle, 0, gChatMessageLogRegion.iLeft, gChatMessageLogRegion.iTop, VO_BLT_SRCTRANSPARENCY,NULL ); BltVideoObject( FRAME_BUFFER , hHandle, 1, gChatMessageLogRegion.iRight+CHATBOX_SLIDER_GAP, gChatMessageLogRegion.iTop, VO_BLT_SRCTRANSPARENCY,NULL ); // draw slider DisplayChatLogScrollBarSlider( ); // draw chat log text DisplayStringsInChatLogMessageList(); } } MarkButtonsDirty(); EnableDisableChatLogScrollButtonsAndRegions(); // Render buttons RenderButtons( ); // render text boxes //SaveFontSettings(); SetFontDestBuffer( FRAME_BUFFER, gChatTextBoxRegion.iLeft , gChatTextBoxRegion.iTop , gChatTextBoxRegion.iRight , gChatTextBoxRegion.iBottom, FALSE ); RenderAllTextFields(); // textbox system call SetFontDestBuffer( FRAME_BUFFER, 0 , 0 , SCREEN_WIDTH , SCREEN_HEIGHT , FALSE ); //RestoreFontSettings(); EndFrameBufferRender( ); // carter, need key shortcuts for clearing up message boxes // Check for esc bool bHandled; while (DequeueEvent(&InputEvent) == TRUE) { bHandled = false; if(InputEvent.usEvent == KEY_DOWN ) { if( ( InputEvent.usParam == ESC ) ) { // Exit messagebox gChatBox.bHandled = MSG_BOX_RETURN_NO; memset(gszChatBoxInputString,0,sizeof(CHAR16)*255); bHandled = true; } if( InputEvent.usParam == ENTER ) { // retrieve the string from the text box Get16BitStringFromField( 0, gszChatBoxInputString, 255 ); // these indexes are based on the order created // Exit messagebox gChatBox.bHandled = MSG_BOX_RETURN_OK; bHandled = true; } // OJW - 20090403 - add better key control UINT8 ubDesiredMessageIndex; UINT8 ubNumMessages; ubNumMessages = GetRangeOfChatLogMessages(); if ( ubNumMessages > MAX_CHATLOG_MESSAGES ) { if (InputEvent.usParam == PGUP) { //move up a page ChatScreenMsgScrollUp( MAX_CHATLOG_MESSAGES ); bHandled = true; } if (InputEvent.usParam == PGDN) { // move down a page ChatScreenMsgScrollDown( MAX_CHATLOG_MESSAGES ); bHandled = true; } if (InputEvent.usParam == HOME) { // move to the beginning ChangeCurrentChatScreenMessageIndex( 0 ); bHandled = true; } if (InputEvent.usParam == END) { // move to end ubDesiredMessageIndex = ubNumMessages - MAX_CHATLOG_MESSAGES; ChangeCurrentChatScreenMessageIndex( ubDesiredMessageIndex ); bHandled = true; } } } // send to text box if (!bHandled) HandleTextInput( &InputEvent ); } if ( gChatBox.bHandled ) { SetRenderFlags( RENDER_FLAG_FULL ); return( ExitChatBox( gChatBox.bHandled ) ); } return( MP_CHAT_SCREEN ); }
UINT32 LoadSaveScreenHandle(void) { FDLG_LIST *FListNode; INT32 x; InputAtom DialogEvent; if( fEnteringLoadSaveScreen ) { LoadSaveScreenEntry(); } if( gbCurrentFileIOStatus ) //loading or saving map { UINT32 uiScreen; uiScreen = ProcessFileIO(); if( uiScreen == EDIT_SCREEN && gbCurrentFileIOStatus == LOADING_MAP ) RemoveProgressBar( 0 ); return uiScreen; } if( gubMessageBoxStatus ) { if( MessageBoxHandled() ) return ProcessLoadSaveScreenMessageBoxResult(); return LOADSAVE_SCREEN; } //handle all key input. while( DequeueEvent(&DialogEvent) ) { if( !HandleTextInput(&DialogEvent) && (DialogEvent.usEvent == KEY_DOWN || DialogEvent.usEvent == KEY_REPEAT) ) { HandleMainKeyEvents( &DialogEvent ); } } HandleMouseWheelEvents();//dnl ch36 150909 DrawFileDialog(); // Skip to first filename to show FListNode = FileList; for(x=0;x<iTopFileShown && x<iTotalFiles && FListNode != NULL;x++) { FListNode = FListNode->pNext; } // Show up to 8 filenames in the window SetFont( FONT12POINT1 ); if( gfNoFiles ) { SetFontForeground( FONT_LTRED ); SetFontBackground( 142 ); mprintf( iScreenWidthOffset + 226, iScreenHeightOffset + 126, L"NO FILES IN \\MAPS DIRECTORY" ); } else for(x=iTopFileShown;x<(iTopFileShown+8) && x<iTotalFiles && FListNode != NULL; x++) { if( !EditingText() && x == iCurrFileShown ) { SetFontForeground( FONT_GRAY2 ); SetFontBackground( FONT_METALGRAY ); } else { SetFontForeground( FONT_BLACK ); SetFontBackground( 142 ); } mprintf( iScreenWidthOffset + 186,(iScreenHeightOffset + 73+ (x-iTopFileShown)*15 ), L"%S", FListNode->FileInfo.zFileName); FListNode = FListNode->pNext; } RenderAllTextFields(); InvalidateScreen(); ExecuteBaseDirtyRectQueue(); EndFrameBufferRender(); switch( iFDlgState ) { case DIALOG_CANCEL: RemoveFileDialog(); fEnteringLoadSaveScreen = TRUE; return EDIT_SCREEN; case DIALOG_DELETE: sprintf( gszCurrFilename, "MAPS\\%S", gzFilename ); if( GetFileFirst(gszCurrFilename, &FileInfo) ) { CHAR16 str[40]; if( FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_HIDDEN|FILE_IS_SYSTEM) ) { swprintf( str, L" Delete READ-ONLY file %s? ", gzFilename ); gfReadOnly = TRUE; } else swprintf( str, L" Delete file %s? ", gzFilename ); gfDeleteFile = TRUE; CreateMessageBox( str ); } return LOADSAVE_SCREEN; case DIALOG_SAVE://dnl ch37 230909 { if(!ExtractFilenameFromFields()) { CreateMessageBox(L" Illegal filename. Try another filename? "); gfIllegalName = TRUE; iFDlgState = DIALOG_NONE; return(LOADSAVE_SCREEN); } sprintf(gszCurrFilename, "MAPS\\%S", gzFilename); gfFileExists = FALSE; #ifndef USE_VFS gfReadOnly = FALSE; if(FileExists(gszCurrFilename)) { gfFileExists = TRUE; if(GetFileFirst(gszCurrFilename, &FileInfo)) { if(FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_DIRECTORY|FILE_IS_HIDDEN|FILE_IS_SYSTEM|FILE_IS_OFFLINE|FILE_IS_TEMPORARY)) gfReadOnly = TRUE; GetFileClose(&FileInfo); } } #else gfReadOnly = TRUE; vfs::CProfileStack* st = getVFS()->getProfileStack(); vfs::CProfileStack::Iterator it = st->begin(); while(!it.end()) { vfs::CVirtualProfile* prof = it.value(); if(prof->cWritable == true) { gfReadOnly = FALSE; vfs::Path const& path = gszCurrFilename; vfs::IBaseFile *file = prof->getFile(path); if(file) { gfFileExists = TRUE; if(file->implementsWritable() == false) gfReadOnly = TRUE; } break; } it.next(); } #endif if(gfReadOnly) { CreateMessageBox(L" File is read only! Choose a different name? "); return( LOADSAVE_SCREEN); } else if(gfFileExists) { CreateMessageBox(L" File exists, Overwrite? "); return(LOADSAVE_SCREEN); } RemoveFileDialog(); gbCurrentFileIOStatus = INITIATE_MAP_SAVE; return(LOADSAVE_SCREEN); } case DIALOG_LOAD: if( !ExtractFilenameFromFields() ) { CreateMessageBox( L" Illegal filename. Try another filename? " ); gfIllegalName = TRUE; iFDlgState = DIALOG_NONE; return LOADSAVE_SCREEN; } RemoveFileDialog(); CreateProgressBar( 0, iScreenWidthOffset + 118, iScreenHeightOffset + 183, iScreenWidthOffset + 522, iScreenHeightOffset + 202 ); DefineProgressBarPanel( 0, 65, 79, 94, iScreenWidthOffset + 100, iScreenHeightOffset + 155, iScreenWidthOffset + 540, iScreenHeightOffset + 235 ); swprintf( zOrigName, L"Loading map: %s", gzFilename ); SetProgressBarTitle( 0, zOrigName, BLOCKFONT2, FONT_RED, FONT_NEARBLACK ); gbCurrentFileIOStatus = INITIATE_MAP_LOAD; return LOADSAVE_SCREEN ; default: iFDlgState = DIALOG_NONE; } iFDlgState = DIALOG_NONE; return LOADSAVE_SCREEN ; }
UINT32 LoadSaveScreenHandle(void) { FDLG_LIST *FListNode; INT32 x; InputAtom DialogEvent; if( fEnteringLoadSaveScreen ) { LoadSaveScreenEntry(); } if( gbCurrentFileIOStatus ) //loading or saving map { UINT32 uiScreen; uiScreen = ProcessFileIO(); if( uiScreen == EDIT_SCREEN && gbCurrentFileIOStatus == LOADING_MAP ) RemoveProgressBar( 0 ); return uiScreen; } if( gubMessageBoxStatus ) { if( MessageBoxHandled() ) return ProcessLoadSaveScreenMessageBoxResult(); return LOADSAVE_SCREEN; } //handle all key input. while( DequeueEvent(&DialogEvent) ) { if( !HandleTextInput(&DialogEvent) && (DialogEvent.usEvent == KEY_DOWN || DialogEvent.usEvent == KEY_REPEAT) ) { HandleMainKeyEvents( &DialogEvent ); } } DrawFileDialog(); // Skip to first filename to show FListNode = FileList; for(x=0; x<iTopFileShown && x<iTotalFiles && FListNode != NULL; x++) { FListNode = FListNode->pNext; } // Show up to 8 filenames in the window SetFont( FONT12POINT1 ); if( gfNoFiles ) { SetFontForeground( FONT_LTRED ); SetFontBackground( 142 ); mprintf( 226, 126, L"NO FILES IN \\MAPS DIRECTORY" ); } else for(x=iTopFileShown; x<(iTopFileShown+8) && x<iTotalFiles && FListNode != NULL; x++) { if( !EditingText() && x == iCurrFileShown ) { SetFontForeground( FONT_GRAY2 ); SetFontBackground( FONT_METALGRAY ); } else { SetFontForeground( FONT_BLACK ); SetFontBackground( 142 ); } mprintf( 186,(73+ (x-iTopFileShown)*15 ), L"%S", FListNode->FileInfo.zFileName); FListNode = FListNode->pNext; } RenderAllTextFields(); InvalidateScreen(); ExecuteBaseDirtyRectQueue(); EndFrameBufferRender(); switch( iFDlgState ) { case DIALOG_CANCEL: RemoveFileDialog(); fEnteringLoadSaveScreen = TRUE; return EDIT_SCREEN; case DIALOG_DELETE: sprintf( gszCurrFilename, "MAPS\\%S", gzFilename ); if( GetFileFirst(gszCurrFilename, &FileInfo) ) { UINT16 str[40]; if( FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_HIDDEN|FILE_IS_SYSTEM) ) { swprintf( str, L" Delete READ-ONLY file %s? ", gzFilename ); gfReadOnly = TRUE; } else swprintf( str, L" Delete file %s? ", gzFilename ); gfDeleteFile = TRUE; CreateMessageBox( str ); } return LOADSAVE_SCREEN; case DIALOG_SAVE: if( !ExtractFilenameFromFields() ) { CreateMessageBox( L" Illegal filename. Try another filename? " ); gfIllegalName = TRUE; iFDlgState = DIALOG_NONE; return LOADSAVE_SCREEN; } sprintf( gszCurrFilename, "MAPS\\%S", gzFilename ); if ( FileExists( gszCurrFilename ) ) { gfFileExists = TRUE; gfReadOnly = FALSE; if( GetFileFirst(gszCurrFilename, &FileInfo) ) { if( FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_DIRECTORY|FILE_IS_HIDDEN|FILE_IS_SYSTEM|FILE_IS_OFFLINE|FILE_IS_TEMPORARY) ) gfReadOnly = TRUE; GetFileClose(&FileInfo); } if( gfReadOnly ) CreateMessageBox( L" File is read only! Choose a different name? " ); else CreateMessageBox( L" File exists, Overwrite? " ); return( LOADSAVE_SCREEN ); } RemoveFileDialog(); gbCurrentFileIOStatus = INITIATE_MAP_SAVE; return LOADSAVE_SCREEN ; case DIALOG_LOAD: if( !ExtractFilenameFromFields() ) { CreateMessageBox( L" Illegal filename. Try another filename? " ); gfIllegalName = TRUE; iFDlgState = DIALOG_NONE; return LOADSAVE_SCREEN; } RemoveFileDialog(); CreateProgressBar( 0, 118, 183, 522, 202 ); DefineProgressBarPanel( 0, 65, 79, 94, 100, 155, 540, 235 ); swprintf( zOrigName, L"Loading map: %s", gzFilename ); SetProgressBarTitle( 0, zOrigName, BLOCKFONT2, FONT_RED, FONT_NEARBLACK ); gbCurrentFileIOStatus = INITIATE_MAP_LOAD; return LOADSAVE_SCREEN ; default: iFDlgState = DIALOG_NONE; } iFDlgState = DIALOG_NONE; return LOADSAVE_SCREEN ; }
UINT32 MessageBoxScreenHandle( ) { InputAtom InputEvent; if ( gfNewMessageBox ) { // If in game screen.... if ( ( gfStartedFromGameScreen )||( gfStartedFromMapScreen ) ) { //UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; //UINT8 *pDestBuf, *pSrcBuf; if( gfStartedFromGameScreen ) { HandleTacticalUILoseCursorFromOtherScreen( ); } else { HandleMAPUILoseCursorFromOtherScreen( ); } gfStartedFromGameScreen = FALSE; gfStartedFromMapScreen = FALSE; /* // Save what we have under here... pDestBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES); Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0 , 0, gMsgBox.sX , gMsgBox.sY, gMsgBox.usWidth, gMsgBox.usHeight ); UnLockVideoSurface( gMsgBox.uiSaveBuffer ); UnLockVideoSurface( FRAME_BUFFER ); */ } gfNewMessageBox = FALSE; return( MSG_BOX_SCREEN ); } UnmarkButtonsDirty( ); // Render the box! if ( gMsgBox.fRenderBox ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { MarkAButtonDirty( gMsgBox.uiButton[0] ); MarkAButtonDirty( gMsgBox.uiButton[1] ); MarkAButtonDirty( gMsgBox.uiButton[2] ); MarkAButtonDirty( gMsgBox.uiButton[3] ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_CANCEL ) { MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKCONTRACT ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERIC ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) { // Exit messagebox MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOLIE ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKSKIP ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } RenderMercPopUpBoxFromIndex( gMsgBox.iBoxId, gMsgBox.sX, gMsgBox.sY, FRAME_BUFFER ); //gMsgBox.fRenderBox = FALSE; // ATE: Render each frame... } // Render buttons RenderButtons( ); EndFrameBufferRender( ); // carter, need key shortcuts for clearing up message boxes // Check for esc while (DequeueEvent(&InputEvent) == TRUE) { if( InputEvent.usEvent == KEY_UP ) { if( ( InputEvent.usParam == ESC ) || ( InputEvent.usParam == 'n') ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_NO; } } if( InputEvent.usParam == ENTER ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_YES; } else if( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_OK; } else if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_OK; } } if( InputEvent.usParam == 'o' ) { if( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_OK; } } if( InputEvent.usParam == 'y' ) { if( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_YES; } } if( InputEvent.usParam == '1' ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { // Exit messagebox gMsgBox.bHandled = 1; } } if( InputEvent.usParam == '2' ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { // Exit messagebox gMsgBox.bHandled = 1; } } if( InputEvent.usParam == '3' ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { // Exit messagebox gMsgBox.bHandled = 1; } } if( InputEvent.usParam == '4' ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { // Exit messagebox gMsgBox.bHandled = 1; } } } } if ( gMsgBox.bHandled ) { SetRenderFlags( RENDER_FLAG_FULL ); return( ExitMsgBox( gMsgBox.bHandled ) ); } return( MSG_BOX_SCREEN ); }
void GetIntroScreenUserInput() { InputAtom Event; POINT MousePos; GetCursorPos(&MousePos); while( DequeueEvent( &Event ) ) { // HOOK INTO MOUSE HOOKS switch( Event.usEvent) { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_UP: MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_REPEAT: MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_REPEAT: MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; } if( Event.usEvent == KEY_UP ) { switch( Event.usParam ) { case ESC: PrepareToExitIntroScreen(); break; case SPACE: SmkCloseFlic( gpSmackFlic ); break; #ifdef JA2TESTVERSION case 'r': break; case 'i': InvalidateRegion( 0, 0, 640, 480 ); break; #endif } } } // if the user presses either mouse button if( gfLeftButtonState || gfRightButtonState ) { //advance to the next flic SmkCloseFlic( gpSmackFlic ); } }
void GetPlayerKeyBoardInputForIMPBeginScreen( void ) { InputAtom InputEvent; POINT MousePos; // get the current curosr position, might just need it. GetCursorPos(&MousePos); // handle input events while( DequeueEvent(&InputEvent) ) { /* // HOOK INTO MOUSE HOOKS switch(InputEvent.usEvent) { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_UP: MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; } */ if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT) ) { switch( InputEvent.usParam ) { case (( ENTER )): // check to see if gender was highlighted..if so, select it if( FEMALE_GENDER_SELECT == ubTextEnterMode ) { bGenderFlag = IMP_FEMALE; } else if( MALE_GENDER_SELECT == ubTextEnterMode ) { bGenderFlag = IMP_MALE; } // increment to next selection box IncrementTextEnterMode( ); fNewCharInString = TRUE; break; case( SPACE ): // handle space bar if( FEMALE_GENDER_SELECT == ubTextEnterMode ) { bGenderFlag = IMP_FEMALE; DecrementTextEnterMode( ); } else if( MALE_GENDER_SELECT == ubTextEnterMode ) { bGenderFlag = IMP_MALE; IncrementTextEnterMode( ); } else { HandleBeginScreenTextEvent( InputEvent.usParam ); } fNewCharInString = TRUE; break; case (( ESC )): LeaveLapTopScreen( ); break; case (( TAB )): // tab hit, increment to next selection box IncrementTextEnterMode( ); fNewCharInString = TRUE; break; case ( 265 ): // tab and shift DecrementTextEnterMode( ); fNewCharInString = TRUE; break; default: HandleBeginScreenTextEvent( InputEvent.usParam ); break; } } } return; }
void HandleIMPQuizKeyBoard( void ) { InputAtom InputEvent; POINT MousePos; BOOLEAN fSkipFrame = FALSE; GetCursorPos(&MousePos); ScreenToClient(ghWindow, &MousePos); // In window coords! while( ( DequeueEvent(&InputEvent) == TRUE ) ) { if( fSkipFrame == FALSE ) { // HOOK INTO MOUSE HOOKS // //if( (InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam >= '1' ) && ( InputEvent.usParam <= '9') ) //{ // if( ( UINT16 )( iNumberOfPersonaButtons ) >= InputEvent.usParam - '0' ) // { // reset buttons // ResetQuizAnswerButtons( ); // ok, check to see if button was disabled, if so, re enable // CheckStateOfTheConfirmButton( ); // toggle this button on // ButtonList[ giIMPPersonalityQuizAnswerButton[ InputEvent.usParam - '1' ] ]->uiFlags |= (BUTTON_CLICKED_ON); // iCurrentAnswer = InputEvent.usParam - '1'; // PrintImpText( ); // the current and last question numbers // PrintQuizQuestionNumber( ); // fReDrawCharProfile = TRUE; // fSkipFrame = TRUE; // } // } // else if( ( iCurrentAnswer != -1 ) && ( InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam == ENTER ) ) // { // reset all the buttons // ResetQuizAnswerButtons( ); // copy the answer into the list // iQuizAnswerList[ giCurrentPersonalityQuizQuestion ] = iCurrentAnswer; // reset answer for next question // iCurrentAnswer = -1; // next question, JOHNNY! // giCurrentPersonalityQuizQuestion++; // giMaxPersonalityQuizQuestion++; // OPPS!, done..time to finish up // if( giCurrentPersonalityQuizQuestion > 15) // { // iCurrentImpPage = IMP_PERSONALITY_FINISH; // process // CompileQuestionsInStatsAndWhatNot( ); // } // fSkipFrame = TRUE; // } // else if( ( InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam == '=' ) ) // { // MoveAheadAQuestion( ); // fSkipFrame = TRUE; // } // else if( ( InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam == '-' ) ) // { // MoveBackAQuestion( ); // fSkipFrame = TRUE; // } // else // { switch(InputEvent.usEvent) { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_UP: MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_REPEAT: MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_REPEAT: MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; default: HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); break; // } } } } return; }