예제 #1
0
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();

}
예제 #2
0
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 );
}
예제 #3
0
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 ;
}
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();
}
예제 #5
0
파일: LoadScreen.c 프로젝트: bowlofstew/ja2
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 ;
}