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; }
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 GameLoop(void) { InputAtom InputEvent; POINT MousePos; UINT32 uiOldScreen=guiCurrentScreen; GetCursorPos(&MousePos); // Hook into mouse stuff for MOVEMENT MESSAGES MouseSystemHook(MOUSE_POS, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); MusicPoll( FALSE ); while (DequeueSpecificEvent(&InputEvent, LEFT_BUTTON_REPEAT|RIGHT_BUTTON_REPEAT|LEFT_BUTTON_DOWN|LEFT_BUTTON_UP|RIGHT_BUTTON_DOWN|RIGHT_BUTTON_UP ) == 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; case LEFT_BUTTON_REPEAT: MouseSystemHook(LEFT_BUTTON_REPEAT, (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; } } if ( gfGlobalError ) { guiCurrentScreen = ERROR_SCREEN; } //if we are to check for free space on the hard drive if( gubCheckForFreeSpaceOnHardDriveCount < DONT_CHECK_FOR_FREE_SPACE ) { //only if we are in a screen that can get this check if( guiCurrentScreen == MAP_SCREEN || guiCurrentScreen == GAME_SCREEN || guiCurrentScreen == SAVE_LOAD_SCREEN ) { if( gubCheckForFreeSpaceOnHardDriveCount < 1 ) { gubCheckForFreeSpaceOnHardDriveCount++; } else { // Make sure the user has enough hard drive space if( !DoesUserHaveEnoughHardDriveSpace() ) { CHAR16 zText[512]; CHAR16 zSpaceOnDrive[512]; UINT32 uiSpaceOnDrive; CHAR16 zSizeNeeded[512]; swprintf( zSizeNeeded, L"%d", REQUIRED_FREE_SPACE / BYTESINMEGABYTE ); InsertCommasForDollarFigure( zSizeNeeded ); uiSpaceOnDrive = GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ); swprintf( zSpaceOnDrive, L"%.2f", uiSpaceOnDrive / (FLOAT)BYTESINMEGABYTE ); swprintf( zText, pMessageStrings[ MSG_LOWDISKSPACE_WARNING ], zSpaceOnDrive, zSizeNeeded ); if( guiPreviousOptionScreen == MAP_SCREEN ) DoMapMessageBox( MSG_BOX_BASIC_STYLE, zText, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); else DoMessageBox( MSG_BOX_BASIC_STYLE, zText, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL ); } gubCheckForFreeSpaceOnHardDriveCount = DONT_CHECK_FOR_FREE_SPACE; } } } // ATE: Force to be in message box screen! if ( gfInMsgBox ) { guiPendingScreen = MSG_BOX_SCREEN; } if ( guiPendingScreen != NO_PENDING_SCREEN ) { // Based on active screen, deinit! if( guiPendingScreen != guiCurrentScreen ) { switch( guiCurrentScreen ) { case MAP_SCREEN: if( guiPendingScreen != MSG_BOX_SCREEN ) { EndMapScreen( FALSE ); } break; case LAPTOP_SCREEN: ExitLaptop(); break; } } // if the screen has chnaged if( uiOldScreen != guiPendingScreen ) { // Set the fact that the screen has changed uiOldScreen = guiPendingScreen; HandleNewScreenChange( guiPendingScreen, guiCurrentScreen ); } guiCurrentScreen = guiPendingScreen; guiPendingScreen = NO_PENDING_SCREEN; } uiOldScreen = (*(GameScreens[guiCurrentScreen].HandleScreen))(); // if the screen has chnaged if( uiOldScreen != guiCurrentScreen ) { HandleNewScreenChange( uiOldScreen, guiCurrentScreen ); guiCurrentScreen = uiOldScreen; } RefreshScreen( NULL ); guiGameCycleCounter++; UpdateClock(); #ifdef JA2BETAVERSION if( gubReportMapscreenLock ) { ReportMapscreenErrorLock(); } #endif }