void ProcessEditorRendering() { BOOLEAN fSaveBuffer = FALSE; if( gfRenderTaskbar ) //do a full taskbar render. { ClearTaskbarRegion( 0, 360, 640, 480 ); RenderTerrainTileButtons(); MarkButtonsDirty(); gfRenderTaskbar = FALSE; fSaveBuffer = TRUE; gfRenderDrawingMode = TRUE; gfRenderHilights = FALSE; gfRenderMercInfo = TRUE; } if( gfRenderDrawingMode ) { if( iCurrentTaskbar == TASK_BUILDINGS || iCurrentTaskbar == TASK_TERRAIN || iCurrentTaskbar == TASK_ITEMS ) { ShowCurrentDrawingMode(); gfRenderDrawingMode = FALSE; } } //render dynamically changed buttons only RenderButtons( ); if( gfSummaryWindowActive ) RenderSummaryWindow(); else if( !gfGotoGridNoUI && !InOverheadMap() ) RenderMercStrings(); if( gfEditingDoor ) RenderDoorEditingWindow(); if( TextInputMode() ) RenderAllTextFields(); RenderEditorInfo(); if( !gfSummaryWindowActive && !gfGotoGridNoUI && !InOverheadMap() ) { if( gpItem && gsItemGridNo != -1 ) RenderSelectedItemBlownUp(); if( iCurrentTaskbar == TASK_MAPINFO ) RenderMapEntryPointsAndLights(); if( iDrawMode == DRAW_MODE_PLACE_ITEM && eInfo.uiItemType == TBAR_MODE_ITEM_KEYS || iDrawMode == DRAW_MODE_DOORKEYS ) RenderDoorLockInfo(); } if( fSaveBuffer ) BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 360, 640, 120 ); //Make sure this is TRUE at all times. //It is set to false when before we save the buffer, so the buttons don't get //rendered with hilites, in case the mouse is over one. gfRenderHilights = TRUE; RenderButtonsFastHelp(); }
void ProcessEditorRendering() { BOOLEAN fSaveBuffer = FALSE; if( gfRenderTaskbar ) //do a full taskbar render. { if(iCurrentTaskbar == TASK_OPTIONS && !gfSummaryWindowActive)//dnl ch52 091009 { CHAR8 szNewText[4+1]; sprintf(szNewText, "%d", iNewMapWorldRows=WORLD_ROWS); SetInputFieldStringWith8BitString(1, szNewText); sprintf(szNewText, "%d", iNewMapWorldCols=WORLD_COLS); SetInputFieldStringWith8BitString(2, szNewText); DisableTextField(2); } ClearTaskbarRegion( 0, SCREEN_HEIGHT - 120, SCREEN_WIDTH, SCREEN_HEIGHT ); RenderTerrainTileButtons(); MarkButtonsDirty(); gfRenderTaskbar = FALSE; fSaveBuffer = TRUE; gfRenderDrawingMode = TRUE; gfRenderHilights = FALSE; gfRenderMercInfo = TRUE; } if( gfRenderDrawingMode ) { if( iCurrentTaskbar == TASK_BUILDINGS || iCurrentTaskbar == TASK_TERRAIN || iCurrentTaskbar == TASK_ITEMS ) { ShowCurrentDrawingMode(); gfRenderDrawingMode = FALSE; } } //render dynamically changed buttons only RenderButtons( ); if( gfSummaryWindowActive ) RenderSummaryWindow(); else if( !gfGotoGridNoUI && !gfKeyboardItemCreationUI && !InOverheadMap() && !gfEditingDoor )//dnl ch86 220214 RenderMercStrings(); if( gfEditingDoor ) RenderDoorEditingWindow(); if( TextInputMode() ) RenderAllTextFields(); RenderEditorInfo(); if( !gfSummaryWindowActive && !gfGotoGridNoUI && !gfKeyboardItemCreationUI && !InOverheadMap() && !gfEditingDoor )//dnl ch86 220214 { if( gpItem && gsItemGridNo != -1 ) RenderSelectedItemBlownUp(); if( iCurrentTaskbar == TASK_MAPINFO ) RenderMapEntryPointsAndLights(); if( iDrawMode == DRAW_MODE_PLACE_ITEM && eInfo.uiItemType == TBAR_MODE_ITEM_KEYS || iDrawMode == DRAW_MODE_DOORKEYS ) RenderDoorLockInfo(); } if( fSaveBuffer ) BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 2 * iScreenHeightOffset + 360, SCREEN_WIDTH, 120 ); //Make sure this is TRUE at all times. //It is set to false when before we save the buffer, so the buttons don't get //rendered with hilites, in case the mouse is over one. gfRenderHilights = TRUE; if(!gfSummaryWindowActive && !gfScrollInertia && !gfEditingDoor)//dnl ch77 131113 //dnl ch78 271113 //dnl ch86 210214 RenderButtonsFastHelp(); }
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 ); }
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 ); }