void DeleteEditorBuffers() { INT32 i; DeleteVideoSurfaceFromIndex( guiMercTempBuffer ); for( i = 0; i < 9; i++ ) { DeleteVideoSurfaceFromIndex( guiMercInvPanelBuffers[ i ] ); } }
BOOLEAN DeleteNode( CRDT_NODE *pNodeToDelete ) { CRDT_NODE *pTempNode; pTempNode = pNodeToDelete; if( gCrdtLastAddedNode == pNodeToDelete ) { gCrdtLastAddedNode = NULL; } //if its Not the first node if( pNodeToDelete->pPrev != NULL ) pNodeToDelete->pPrev = pNodeToDelete->pNext; else { if( gCrdtRootNode->pNext != NULL ) { gCrdtRootNode = gCrdtRootNode->pNext; gCrdtRootNode->pPrev = NULL; } } //if its the last node in the list if( pNodeToDelete->pNext == NULL && pNodeToDelete->pPrev != NULL ) pNodeToDelete->pPrev->pNext = NULL; //iof the node that is being deleted is the first node if( pTempNode == gCrdtRootNode ) gCrdtRootNode = NULL; //Free the string if( pTempNode->pString != NULL ) { MemFree( pTempNode->pString ); pTempNode->pString = NULL; } //if the node had something to display, delete a surface for it if( pTempNode->uiType == CRDT_NODE_DEFAULT ) { DeleteVideoSurfaceFromIndex( pTempNode->uiVideoSurfaceImage ); pTempNode->uiVideoSurfaceImage = 0; } //Free the node MemFree( pTempNode ); pTempNode = NULL; return( TRUE ); }
void ExitMainMenu( ) { UINT32 iCounter2 ; CreateDestroyBackGroundMouseMask( FALSE ); CreateDestroyMainMenuButtons( FALSE ); for( iCounter2 = 1; iCounter2 < MAX_ELEMENT; iCounter2++ ) { if (gMainMenulayout[iCounter2].Visible == 1) { // WANNE: This is a dirty fix. I don't know when that was introduced, but when clicking on "Multiplayer Game", the game crashes when trying to call DeleteVideoSurfaceFromIndex() if (is_networked && iCounter2 == 1) continue; // DeleteVideoObjectFromIndex( gMainMenulayout[iCounter2].uiIndex ); DeleteVideoSurfaceFromIndex( gMainMenulayout[iCounter2].uiIndex ); } } gMsgBox.uiExitScreen = MAINMENU_SCREEN; }
UINT32 ExitChatBox( INT8 ubExitCode ) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; UINT8 *pDestBuf, *pSrcBuf; SGPPoint pPosition; // Delete popup! RemoveMercPopupBoxFromIndex( gChatBox.iBoxId ); gChatBox.iBoxId = -1; // OJW - 20090208 - Add text input box type // exit text input mode in this screen and clean up text boxes KillAllTextInputModes(); RemoveButton( gChatBox.uiOKButton ); RemoveButton( gChatBox.uiNOButton ); // Delete button images UnloadButtonImage( gChatBox.iButtonImages ); //Remove the toggle buttons for(int cnt=0; cnt<NUM_CHAT_TOGGLES; cnt++) { RemoveButton( guiChatToggles[ cnt ] ); } // delete graphics and scrolling buttons / slider if (gIncludeChatLog) { RemoveButton( guiChatLogScrollButtons[ 0 ] ); RemoveButton( guiChatLogScrollButtons[ 1 ] ); UnloadButtonImage( guiChatLogScrollButtonsImage[ 0 ] ); UnloadButtonImage( guiChatLogScrollButtonsImage[ 1 ] ); DeleteVideoObjectFromIndex( guiCHATLOGIMG ); DeleteChatLogSliderBar(); } #if 0 if (!gChatBox.fWasPaused) { // Unpause game.... UnLockPauseState(); UnPauseGame(); // UnPause timers as well.... PauseTime( FALSE ); } #endif // Restore mouse restriction region... RestrictMouseCursor( &gOldCursorLimitRectangle ); gfInChatBox = FALSE; // Call done callback! if ( gChatBox.ExitCallback != NULL ) { (*(gChatBox.ExitCallback))( ubExitCode ); } //if ur in a non gamescreen and DONT want the msg box to use the save buffer, unset gfDontOverRideSaveBuffer in ur callback if( ( ( gChatBox.uiExitScreen != GAME_SCREEN ) || ( fRestoreBackgroundForMessageBox == TRUE ) ) && gfDontOverRideSaveBuffer ) { // restore what we have under here... pSrcBuf = LockVideoSurface( gChatBox.uiSaveBuffer, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, gChatBox.sX , gChatBox.sY, 0, 0, gChatBox.usWidth, gChatBox.usHeight ); UnLockVideoSurface( gChatBox.uiSaveBuffer ); UnLockVideoSurface( FRAME_BUFFER ); InvalidateRegion( gChatBox.sX, gChatBox.sY, (INT16)( gChatBox.sX + gChatBox.usWidth ), (INT16)( gChatBox.sY + gChatBox.usHeight ) ); } fRestoreBackgroundForMessageBox = FALSE; gfDontOverRideSaveBuffer = TRUE; if( fCursorLockedToArea == TRUE ) { GetMousePos( &pPosition ); if( ( pPosition.iX > ChatBoxRestrictedCursorRegion.iRight ) || ( pPosition.iX > ChatBoxRestrictedCursorRegion.iLeft ) && ( pPosition.iY < ChatBoxRestrictedCursorRegion.iTop ) && ( pPosition.iY > ChatBoxRestrictedCursorRegion.iBottom ) ) { SimulateMouseMovement( pOldMousePosition.iX , pOldMousePosition.iY ); } fCursorLockedToArea = FALSE; RestrictMouseCursor( &ChatBoxRestrictedCursorRegion ); } // Remove region MSYS_RemoveRegion(&(gChatBox.BackRegion) ); // Remove save buffer! DeleteVideoSurfaceFromIndex( gChatBox.uiSaveBuffer ); switch( gChatBox.uiExitScreen ) { case GAME_SCREEN: if ( InOverheadMap( ) ) { gfOverheadMapDirty = TRUE; } else { SetRenderFlags( RENDER_FLAG_FULL ); } break; case MAP_SCREEN: fMapPanelDirty = TRUE; break; } if ( gfFadeInitialized ) { SetPendingNewScreen(FADE_SCREEN); return( FADE_SCREEN ); } return( gChatBox.uiExitScreen ); }
//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER, //and refreshing the screen with it. void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { VSURFACE_DESC vs_desc; HVSURFACE hVSurface; UINT32 uiLoadScreen; vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; switch( ubLoadScreenID ) { case LOADINGSCREEN_NOTHING: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); break; case LOADINGSCREEN_DAYGENERIC: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayGeneric.sti"); break; case LOADINGSCREEN_DAYTOWN1: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown1.sti"); break; case LOADINGSCREEN_DAYTOWN2: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown2.sti"); break; case LOADINGSCREEN_DAYWILD: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayWild.sti"); break; case LOADINGSCREEN_DAYTROPICAL: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTropical.sti"); break; case LOADINGSCREEN_DAYFOREST: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayForest.sti"); break; case LOADINGSCREEN_DAYDESERT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayDesert.sti"); break; case LOADINGSCREEN_DAYPALACE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPalace.sti"); break; case LOADINGSCREEN_NIGHTGENERIC: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightGeneric.sti"); break; case LOADINGSCREEN_NIGHTWILD: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightWild.sti"); break; case LOADINGSCREEN_NIGHTTOWN1: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown1.sti"); break; case LOADINGSCREEN_NIGHTTOWN2: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown2.sti"); break; case LOADINGSCREEN_NIGHTFOREST: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightForest.sti"); break; case LOADINGSCREEN_NIGHTTROPICAL: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTropical.sti"); break; case LOADINGSCREEN_NIGHTDESERT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightDesert.sti"); break; case LOADINGSCREEN_NIGHTPALACE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPalace.sti"); break; case LOADINGSCREEN_HELI: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); break; case LOADINGSCREEN_BASEMENT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Basement.sti"); break; case LOADINGSCREEN_MINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Mine.sti"); break; case LOADINGSCREEN_CAVE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Cave.sti"); break; case LOADINGSCREEN_DAYPINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPine.sti"); break; case LOADINGSCREEN_NIGHTPINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPine.sti"); break; case LOADINGSCREEN_DAYMILITARY: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMilitary.sti"); break; case LOADINGSCREEN_NIGHTMILITARY: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMilitary.sti"); break; case LOADINGSCREEN_DAYSAM: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DaySAM.sti"); break; case LOADINGSCREEN_NIGHTSAM: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightSAM.sti"); break; case LOADINGSCREEN_DAYPRISON: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPrison.sti"); break; case LOADINGSCREEN_NIGHTPRISON: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPrison.sti"); break; case LOADINGSCREEN_DAYHOSPITAL: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayHospital.sti"); break; case LOADINGSCREEN_NIGHTHOSPITAL: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightHospital.sti"); break; case LOADINGSCREEN_DAYAIRPORT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayAirport.sti"); break; case LOADINGSCREEN_NIGHTAIRPORT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightAirport.sti"); break; case LOADINGSCREEN_DAYLAB: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayLab.sti"); break; case LOADINGSCREEN_NIGHTLAB: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightLab.sti"); break; case LOADINGSCREEN_DAYOMERTA: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayOmerta.sti"); break; case LOADINGSCREEN_NIGHTOMERTA: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightOmerta.sti"); break; case LOADINGSCREEN_DAYCHITZENA: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayChitzena.sti"); break; case LOADINGSCREEN_NIGHTCHITZENA: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightChitzena.sti"); break; case LOADINGSCREEN_DAYMINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMine.sti" ); break; case LOADINGSCREEN_NIGHTMINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMine.sti" ); break; case LOADINGSCREEN_DAYBALIME: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayBalime.sti" ); break; case LOADINGSCREEN_NIGHTBALIME: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightBalime.sti" ); break; default: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); break; } if( gfSchedulesHosed ) { SetFont( FONT10ARIAL ); SetFontForeground( FONT_YELLOW ); SetFontShadow( FONT_NEARBLACK ); ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640, 480, 0 ); mprintf( 5, 5, L"Error loading save, attempting to patch save to version 1.02...", vs_desc.ImageFile ); } else if( AddVideoSurface( &vs_desc, &uiLoadScreen ) ) { //Blit the background image GetVideoSurface( &hVSurface, uiLoadScreen ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLoadScreen ); } else { //Failed to load the file, so use a black screen and print out message. SetFont( FONT10ARIAL ); SetFontForeground( FONT_YELLOW ); SetFontShadow( FONT_NEARBLACK ); ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640, 480, 0 ); mprintf( 5, 5, L"%S loadscreen data file not found...", vs_desc.ImageFile ); } gubLastLoadingScreenID = ubLoadScreenID; InvalidateScreen( ); ExecuteBaseDirtyRectQueue(); EndFrameBufferRender(); RefreshScreen( NULL ); }
void ClearEditorItemsInfo() { if( eInfo.uiBuffer ) { DeleteVideoSurfaceFromIndex( eInfo.uiBuffer ); eInfo.uiBuffer = 0; } if( eInfo.pusItemIndex ) { MemFree( eInfo.pusItemIndex ); eInfo.pusItemIndex = NULL; } DisableEditorRegion( ITEM_REGION_ID ); eInfo.fKill = 0; eInfo.fActive = 0; eInfo.sWidth = 0; eInfo.sHeight = 0; eInfo.sNumItems = 0; //save the highlighted selections switch( eInfo.uiItemType ) { case TBAR_MODE_ITEM_WEAPONS: eInfo.sSaveSelWeaponsIndex = eInfo.sSelItemIndex; eInfo.sSaveWeaponsScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_AMMO: eInfo.sSaveSelAmmoIndex = eInfo.sSelItemIndex; eInfo.sSaveAmmoScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_ARMOUR: eInfo.sSaveSelArmourIndex = eInfo.sSelItemIndex; eInfo.sSaveArmourScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_LBEGEAR: eInfo.sSaveSelLBEIndex = eInfo.sSelItemIndex; eInfo.sSaveLBEScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_EXPLOSIVES: eInfo.sSaveSelExplosivesIndex = eInfo.sSelItemIndex; eInfo.sSaveExplosivesScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_EQUIPMENT1: eInfo.sSaveSelEquipment1Index = eInfo.sSelItemIndex; eInfo.sSaveEquipment1ScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_EQUIPMENT2: eInfo.sSaveSelEquipment2Index = eInfo.sSelItemIndex; eInfo.sSaveEquipment2ScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_EQUIPMENT3: eInfo.sSaveSelEquipment3Index = eInfo.sSelItemIndex; eInfo.sSaveEquipment3ScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_TRIGGERS: eInfo.sSaveSelTriggersIndex = eInfo.sSelItemIndex; eInfo.sSaveTriggersScrollIndex = eInfo.sScrollIndex; break; case TBAR_MODE_ITEM_KEYS: eInfo.sSaveSelKeysIndex = eInfo.sSelItemIndex; eInfo.sSaveKeysScrollIndex = eInfo.sScrollIndex; break; } }
//Simply create videosurface, load image, and draw it to the screen. void InitJA2SplashScreen() { #ifdef ENGLISH ClearMainMenu(); #else UINT32 uiLogoID = 0; HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions # ifdef JA2TESTVERSION INT32 i = 0; memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK; sprintf( VSurfaceDesc.ImageFile, "LOADSCREENS\\Notification.sti" ); if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) { //AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } GetVideoSurface(&hVSurface, uiLogoID ); //BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); InvalidateScreen(); RefreshScreen( NULL ); guiSplashStartTime = GetJA2Clock(); while( i < 60 * 15 )//guiSplashStartTime + 15000 > GetJA2Clock() ) { //Allow the user to pick his bum. InvalidateScreen(); RefreshScreen( NULL ); i++; } # endif // JA2TESTVERSION memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK; GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH ); try { if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) { AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } } catch(std::exception &ex) { SGP_RETHROW(L"Failed loading splash screen", ex); } GetVideoSurface( &hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); #endif // ENGLISH InvalidateScreen(); RefreshScreen( NULL ); guiSplashStartTime = GetJA2Clock(); }
//Simply create videosurface, load image, and draw it to the screen. void InitJA2SplashScreen() { UINT32 uiLogoID = 0; STRING512 CurrentDir; STRING512 DataDir; HVSURFACE hVSurface; VSURFACE_DESC VSurfaceDesc; INT32 i = 0; InitializeJA2Clock(); //InitializeJA2TimerID(); // Get Executable Directory GetExecutableDirectory( CurrentDir ); // Adjust Current Dir sprintf( DataDir, "%s\\Data", CurrentDir ); if ( !SetFileManCurrentDirectory( DataDir ) ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not find data directory, shutting down"); return; } //Initialize the file database InitializeFileDatabase( gGameLibaries, NUMBER_OF_LIBRARIES ); #if !defined( ENGLISH ) && defined( JA2TESTVERSION ) memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; sprintf( VSurfaceDesc.ImageFile, "LOADSCREENS\\Notification.sti" ); if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) { AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } GetVideoSurface(&hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); InvalidateScreen(); RefreshScreen( NULL ); guiSplashStartTime = GetJA2Clock(); while( i < 60 * 15 )//guiSplashStartTime + 15000 > GetJA2Clock() ) { //Allow the user to pick his bum. InvalidateScreen(); RefreshScreen( NULL ); i++; } #endif #ifdef ENGLISH ClearMainMenu(); #else { memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH ); if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) { AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } GetVideoSurface( &hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); } #endif InvalidateScreen(); RefreshScreen( NULL ); guiSplashStartTime = GetJA2Clock(); }
UINT32 ExitMsgBox( INT8 ubExitCode ) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; UINT8 *pDestBuf, *pSrcBuf; SGPPoint pPosition; // Delete popup! RemoveMercPopupBoxFromIndex( gMsgBox.iBoxId ); gMsgBox.iBoxId = -1; //Delete buttons! if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { RemoveButton( gMsgBox.uiButton[0] ); RemoveButton( gMsgBox.uiButton[1] ); RemoveButton( gMsgBox.uiButton[2] ); RemoveButton( gMsgBox.uiButton[3] ); } else { if ( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKCONTRACT ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERIC ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOLIE ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKSKIP ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } } // Delete button images UnloadButtonImage( gMsgBox.iButtonImages ); // Unpause game.... UnLockPauseState(); UnPauseGame(); // UnPause timers as well.... PauseTime( FALSE ); // Restore mouse restriction region... RestrictMouseCursor( &gOldCursorLimitRectangle ); gfInMsgBox = FALSE; // Call done callback! if ( gMsgBox.ExitCallback != NULL ) { (*(gMsgBox.ExitCallback))( ubExitCode ); } //if ur in a non gamescreen and DONT want the msg box to use the save buffer, unset gfDontOverRideSaveBuffer in ur callback if( ( ( gMsgBox.uiExitScreen != GAME_SCREEN ) || ( fRestoreBackgroundForMessageBox == TRUE ) ) && gfDontOverRideSaveBuffer ) { // restore what we have under here... pSrcBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, gMsgBox.sX , gMsgBox.sY, 0, 0, gMsgBox.usWidth, gMsgBox.usHeight ); UnLockVideoSurface( gMsgBox.uiSaveBuffer ); UnLockVideoSurface( FRAME_BUFFER ); InvalidateRegion( gMsgBox.sX, gMsgBox.sY, (INT16)( gMsgBox.sX + gMsgBox.usWidth ), (INT16)( gMsgBox.sY + gMsgBox.usHeight ) ); } fRestoreBackgroundForMessageBox = FALSE; gfDontOverRideSaveBuffer = TRUE; if( fCursorLockedToArea == TRUE ) { GetMousePos( &pPosition ); if( ( pPosition.iX > MessageBoxRestrictedCursorRegion.iRight ) || ( pPosition.iX > MessageBoxRestrictedCursorRegion.iLeft ) && ( pPosition.iY < MessageBoxRestrictedCursorRegion.iTop ) && ( pPosition.iY > MessageBoxRestrictedCursorRegion.iBottom ) ) { SimulateMouseMovement( pOldMousePosition.iX , pOldMousePosition.iY ); } fCursorLockedToArea = FALSE; RestrictMouseCursor( &MessageBoxRestrictedCursorRegion ); } // Remove region MSYS_RemoveRegion(&(gMsgBox.BackRegion) ); // Remove save buffer! DeleteVideoSurfaceFromIndex( gMsgBox.uiSaveBuffer ); switch( gMsgBox.uiExitScreen ) { case GAME_SCREEN: if ( InOverheadMap( ) ) { gfOverheadMapDirty = TRUE; } else { SetRenderFlags( RENDER_FLAG_FULL ); } break; case MAP_SCREEN: fMapPanelDirty = TRUE; break; } if ( gfFadeInitialized ) { SetPendingNewScreen(FADE_SCREEN); return( FADE_SCREEN ); } return( gMsgBox.uiExitScreen ); }