Ejemplo n.º 1
0
void FadeFrameBufferSquare(  )
{
	INT32 iX1, iX2, iY1, iY2;
	INT16	sFadeXMove, sFadeYMove;

	sFadeXMove = SQUARE_STEP;
	sFadeYMove = (INT16)(sFadeXMove * .75);

	
	iX1 = giX1;
	iX2 = giX1 + sFadeXMove;
	iY1 = giY1;
	iY2 = giY1 + sFadeYMove;

	ColorFillVideoSurfaceArea( BACKBUFFER, iX1, 0, iX2, 480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
	ColorFillVideoSurfaceArea( BACKBUFFER, 0, iY1, 640, iY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );

	iX1 = giX2 - sFadeXMove;
	iX2 = giX2;
	iY1 = giY2 - sFadeYMove;
	iY2 = giY2;

	ColorFillVideoSurfaceArea( BACKBUFFER, iX1, 0, iX2, 480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
	ColorFillVideoSurfaceArea( BACKBUFFER, 0, iY1, 640, iY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );

	giX1 += sFadeXMove;
	giX2 -= sFadeXMove;
	giY1 += sFadeYMove;
	giY2 -= sFadeYMove;

}
Ejemplo n.º 2
0
//Kris:
//This is a new function which duplicates the older "yellow info boxes" that
//are common throughout the editor.  This draws the yellow box with the indentation
//look.
void DrawEditorInfoBox( UINT16 *str, UINT32 uiFont, UINT16 x, UINT16 y, UINT16 w, UINT16 h )
{
	UINT16 usFillColorDark, usFillColorLight, usFillColorBack;
	UINT16 x2, y2;
	UINT16 usStrWidth;

	x2 = x + w;
	y2 = y + h;

	usFillColorDark = Get16BPPColor(FROMRGB(24, 61, 81));
	usFillColorLight = Get16BPPColor(FROMRGB(136, 138, 135));
	usFillColorBack = Get16BPPColor(FROMRGB(250, 240, 188));

	ColorFillVideoSurfaceArea(ButtonDestBuffer, x, y, x2, y2, usFillColorDark);
	ColorFillVideoSurfaceArea(ButtonDestBuffer, x + 1, y + 1, x2, y2, usFillColorLight);
	ColorFillVideoSurfaceArea(ButtonDestBuffer, x + 1, y + 1, x2 - 1, y2 - 1, usFillColorBack);

	usStrWidth = StringPixLength( str, uiFont );
	if( usStrWidth > w )
	{ //the string is too long, so use the wrapped method
		y += 1;
		DisplayWrappedString( x, y, w, 2, uiFont, FONT_BLACK, str, FONT_BLACK, TRUE, CENTER_JUSTIFIED );
		return;
	}
	//center the string vertically and horizontally.
	SetFont( uiFont );
	SetFontForeground( FONT_BLACK );
	SetFontShadow( FONT_BLACK );
	x += (w - (UINT16)StringPixLength( str, uiFont )) / 2;
	y += (h - (UINT16)GetFontHeight( uiFont)) / 2;
	mprintf( x, y, L"%s", str );
	InvalidateRegion( x, y, x2, y2 );
}
Ejemplo n.º 3
0
BOOLEAN DisplayPaletteRep( PaletteRepID aPalRep, UINT8 ubXPos, UINT8 ubYPos, UINT32 uiDestSurface )
{
	UINT16										us16BPPColor;
	UINT32										cnt1;
	UINT8											ubSize, ubType;
	INT16											 sTLX, sTLY, sBRX, sBRY;
	UINT8											ubPaletteRep;

	// Create 16BPP Palette
	CHECKF( GetPaletteRepIndexFromID( aPalRep, &ubPaletteRep ) );

	SetFont( LARGEFONT1 );

	ubType = gpPalRep[ ubPaletteRep ].ubType;
	ubSize = gpPalRep[ ubPaletteRep ].ubPaletteSize;

	for ( cnt1 = 0; cnt1 < ubSize; cnt1++ )
	{
		sTLX = ubXPos + (UINT16)( ( cnt1 % 16 ) * 20 );
		sTLY = ubYPos + (UINT16)( ( cnt1 / 16 ) * 20 );
		sBRX = sTLX + 20;
		sBRY = sTLY + 20;

		us16BPPColor = Get16BPPColor( FROMRGB( gpPalRep[ ubPaletteRep ].r[ cnt1 ], gpPalRep[ ubPaletteRep ].g[ cnt1 ], gpPalRep[ ubPaletteRep ].b[ cnt1 ] ) );

		ColorFillVideoSurfaceArea( uiDestSurface, sTLX, sTLY, sBRX, sBRY, us16BPPColor );

	}

	gprintf( ubXPos + ( 16 * 20 ), ubYPos, L"%S", gpPalRep[ ubPaletteRep ].ID );

	return( TRUE );
}
Ejemplo n.º 4
0
void FadeFrameBufferVersionFaster( INT8 bFadeValue )
{
	INT32		cX, cY, iStartX, iStartY;
	UINT32	uiDestPitchBYTES;
	UINT16	*pBuf;
	INT16		bR, bG, bB;
	UINT32	uiRGBColor;
	UINT16		s16BPPSrc;


	pBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES);

	iStartX = gsFadeCount % 2;
	iStartY = 0;

	// LOCK FRAME BUFFER
	for ( cX = iStartX; cX < 640; cX+= 2 )
	{
		if ( iStartX == 1 )
		{
			iStartX = 0;
		}
		else
		{
			iStartX = 1;
		}

		for ( cY = iStartY; cY < 480; cY++ )
		{
			s16BPPSrc = pBuf[ ( cY * 640 ) + cX ];

			uiRGBColor = GetRGBColor( s16BPPSrc );

			bR = SGPGetRValue( uiRGBColor );
			bG = SGPGetGValue( uiRGBColor );
			bB = SGPGetBValue( uiRGBColor );

			// Fade down
			bR -= bFadeValue;
			if ( bR < 0 )
				bR = 0;

			bG -= bFadeValue;
			if ( bG < 0 )
				bG = 0;

			bB -= bFadeValue;
			if ( bB < 0 )
				bB = 0;

			// Set back info buffer
			pBuf[ ( cY * 640 ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) );

		}
	}

	UnLockVideoSurface(FRAME_BUFFER);

}
Ejemplo n.º 5
0
void ShutdownJA2(void)
{ 
  UINT32 uiIndex;

	// Clear screen....
	ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640,	480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
	InvalidateScreen( );
	// Remove cursor....
	SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );

	RefreshScreen( NULL );
		
	ShutdownStrategicLayer();

	// remove temp files built by laptop
	ClearOutTempLaptopFiles( );

	// Shutdown queue system
	ShutdownDialogueControl();

  // Shutdown Screens
  for (uiIndex = 0; uiIndex < MAX_SCREENS; uiIndex++)
  { 
    (*(GameScreens[uiIndex].ShutdownScreen))();
  }


	// Shutdown animation system
	DeInitAnimationSystem( );

	ShutdownLightingSystem();

	CursorDatabaseClear();

	ShutdownTacticalEngine( );

	// Shutdown Overhead
	ShutdownOverhead( );

	DeinitializeWorld( );

	DeleteTileCache( );

	ShutdownJA2Clock( );

	ShutdownFonts();

	ShutdownJA2Sound( );

	ShutdownEventManager( );

	ShutdownBaseDirtyRectQueue( );

	// Unload any text box images!
	RemoveTextMercPopupImages( );

	ClearOutVehicleList();
}
Ejemplo n.º 6
0
void FadeFrameBufferSide(  )
{
	INT32 iX1, iX2;
	INT16	sFadeMove;

	sFadeMove = gsFadeCount * 4;

	iX1 = 0;
	iX2 = sFadeMove;

	ColorFillVideoSurfaceArea( FRAME_BUFFER, iX1, 0, iX2, 480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );

	iX1 = 640 - sFadeMove;
	iX2 = 640;

	ColorFillVideoSurfaceArea( FRAME_BUFFER, iX1, 0, iX2, 480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );

}
Ejemplo n.º 7
0
DropDownBase::DropDownBase()
{
	// default settings
	musWidth = 100;						// width of text field
	musArrowWidth = 22;					// width of arrow (and thus scrollbar)

	mEntryVector.clear();

	swprintf( mHelpText, L"" );

	mSelectedEntry = 0;
	mFirstShownEntry = 0;

	mColorLine			= Get16BPPColor( FROMRGB( 231, 199,  90 ) );
	mColorLineShadow	= Get16BPPColor( FROMRGB(  33,  24,   8 ) );
	mColorMarked		= Get16BPPColor( FROMRGB( 200, 169,  87 ) );
	mColorHighLight		= Get16BPPColor( FROMRGB( 235, 222, 171 ) );
}
Ejemplo n.º 8
0
void DrawFileDialog(void)
{
    ColorFillVideoSurfaceArea(FRAME_BUFFER,	179, 69, (179+281), 261, Get16BPPColor(FROMRGB(136, 138, 135)) );
    ColorFillVideoSurfaceArea(FRAME_BUFFER,	180, 70, (179+281), 261, Get16BPPColor(FROMRGB(24, 61, 81)) );
    ColorFillVideoSurfaceArea(FRAME_BUFFER,	180, 70, (179+280), 260, Get16BPPColor(FROMRGB(65, 79, 94)) );

    ColorFillVideoSurfaceArea(FRAME_BUFFER, (179+4), (69+3), (179+4+240), (69+123), Get16BPPColor(FROMRGB(24, 61, 81)) );
    ColorFillVideoSurfaceArea(FRAME_BUFFER, (179+5), (69+4), (179+4+240), (69+123), Get16BPPColor(FROMRGB(136, 138, 135)) );
    ColorFillVideoSurfaceArea(FRAME_BUFFER, (179+5), (69+4), (179+3+240), (69+122), Get16BPPColor(FROMRGB(250, 240, 188)) );

    MarkButtonsDirty();
    RenderButtons();
    RenderButtonsFastHelp();

    SetFont( FONT10ARIAL );
    SetFontForeground( FONT_LTKHAKI );
    SetFontShadow( FONT_DKKHAKI );
    SetFontBackground( FONT_BLACK );
    mprintf( 183, 217, L"Filename" );

    if( iFileDlgButtons[6] != -1 )
    {
        mprintf( 200, 231, L"Update world info" );
    }
}
Ejemplo n.º 9
0
void FadeInBackBufferVersionOne( )
{
	INT32		cX, cY;
	UINT32	uiDestPitchBYTES, uiSrcPitchBYTES;
	UINT16	*pSrcBuf, *pDestBuf;
	INT16		bR, bG, bB;
	UINT32	uiRGBColor;
	UINT16		s16BPPSrc;
	INT16		bFadeVal = ( gsFadeLimit - gsFadeCount ) * gbFadeValue;

	pDestBuf = (UINT16*)LockVideoSurface(BACKBUFFER, &uiDestPitchBYTES);
	pSrcBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES);

	// LOCK FRAME BUFFER
	for ( cX = 0; cX < 640; cX++ )
	{
		for ( cY = 0; cY < 480; cY++ )
		{
			s16BPPSrc = pSrcBuf[ ( cY * 640 ) + cX ];

			uiRGBColor = GetRGBColor( s16BPPSrc );

			bR = SGPGetRValue( uiRGBColor );
			bG = SGPGetGValue( uiRGBColor );
			bB = SGPGetBValue( uiRGBColor );

			// Fade down
			bR -= bFadeVal;
			if ( bR < 0 )
				bR = 0;

			bG -= bFadeVal;
			if ( bG < 0 )
				bG = 0;

			bB -= bFadeVal;
			if ( bB < 0 )
				bB = 0;

			// Set back info dest buffer
			pDestBuf[ ( cY * 640 ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) );

		}
	}

	UnLockVideoSurface(FRAME_BUFFER);
	UnLockVideoSurface(BACKBUFFER);

}
Ejemplo n.º 10
0
void FadeFrameBufferVersionOne( )
{
	INT32		cX, cY;
	UINT32	uiDestPitchBYTES;
	UINT16	*pBuf;
	INT16		bR, bG, bB;
	UINT32	uiRGBColor;
	UINT16		s16BPPSrc;


	pBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES);

	// LOCK FRAME BUFFER
	for ( cX = 0; cX < 640; cX++ )
	{
		for ( cY = 0; cY < 480; cY++ )
		{
			s16BPPSrc = pBuf[ ( cY * 640 ) + cX ];

			uiRGBColor = GetRGBColor( s16BPPSrc );

			bR = SGPGetRValue( uiRGBColor );
			bG = SGPGetGValue( uiRGBColor );
			bB = SGPGetBValue( uiRGBColor );

			// Fade down
			bR -= gbFadeValue;
			if ( bR < 0 )
				bR = 0;

			bG -= gbFadeValue;
			if ( bG < 0 )
				bG = 0;

			bB -= gbFadeValue;
			if ( bB < 0 )
				bB = 0;

			// Set back info buffer
			pBuf[ ( cY * 640 ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) );

		}
	}

	UnLockVideoSurface(FRAME_BUFFER);

}
Ejemplo n.º 11
0
void RenderSelectedItemBlownUp()
{
	UINT32 uiVideoObjectIndex;
	HVOBJECT hVObject;
	INT16 sScreenX, sScreenY, xp, yp;
	ITEM_POOL	*pItemPool;
	UINT16 szItemName[ SIZE_ITEM_NAME ];
	INT32 i;
	INT16 sWidth, sHeight, sOffsetX, sOffsetY;

	GetGridNoScreenPos( gsItemGridNo, 0, &sScreenX, &sScreenY );

	if( sScreenY > 340 )
		return;

	//Display the enlarged item graphic
	uiVideoObjectIndex = GetInterfaceGraphicForItem( &Item[ gpItem->usItem ] );
	GetVideoObject( &hVObject, uiVideoObjectIndex );
	
	sWidth = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usWidth;
	sOffsetX = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetX;
	xp = sScreenX + (40 - sWidth - sOffsetX*2) / 2;
	
	sHeight = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usHeight;
	sOffsetY = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetY;
	yp = sScreenY + (20 - sHeight - sOffsetY*2) / 2;

	BltVideoObjectOutlineFromIndex( FRAME_BUFFER, uiVideoObjectIndex, Item[ gpItem->usItem ].ubGraphicNum, xp, yp, Get16BPPColor(FROMRGB(0, 140, 170)), TRUE );

	//Display the item name above it
	SetFont( FONT10ARIAL );
	SetFontForeground( FONT_YELLOW );
	SetFontShadow( FONT_NEARBLACK );
	if( gpItem->usItem == ACTION_ITEM || gpItem->usItem == SWITCH )
	{
		BuildTriggerName( gpItem, szItemName );
	}
	else if( Item[ gpItem->usItem ].usItemClass == IC_KEY )
	{
		swprintf( szItemName, L"%S", LockTable[ gpItem->ubKeyID ].ubEditorName );
	}
	else
	{
		LoadItemInfo( gpItem->usItem, szItemName, NULL );
	}
	xp = sScreenX - (StringPixLength( szItemName, FONT10ARIAL ) - 40) / 2;
	yp -= 10;
	mprintf( xp, yp, szItemName );

	if( gpItem->usItem == ACTION_ITEM )
	{
		UINT16 *pStr;
		pStr = GetActionItemName( gpItem );
		xp = sScreenX - (StringPixLength( pStr, FONT10ARIALBOLD ) - 40) / 2;
		yp += 10;
		SetFont( FONT10ARIALBOLD );
		SetFontForeground( FONT_LTKHAKI );
		mprintf( xp, yp, pStr );
		SetFontForeground( FONT_YELLOW );
	}

	//Count the number of items in the current pool, and display that.
	i = 0;
	GetItemPool( gsItemGridNo, &pItemPool, 0 );
	Assert( pItemPool );
	while( pItemPool )
	{
		i++;
		pItemPool = pItemPool->pNext;
	}
	xp = sScreenX;
	yp = sScreenY + 10;
	mprintf( xp, yp, L"%d", i );
	
	//If the item is hidden, render a blinking H (just like DG)
	if( gWorldItems[ gpItemPool->iItemIndex ].bVisible == HIDDEN_ITEM || 
			gWorldItems[ gpItemPool->iItemIndex ].bVisible == BURIED )
	{
		SetFont( FONT10ARIALBOLD );
		if( GetJA2Clock() % 1000 > 500 )
		{
			SetFontForeground( 249 );
		}
		mprintf( sScreenX + 16, sScreenY + 7, L"H" );
		InvalidateRegion( sScreenX + 16, sScreenY + 7, sScreenX + 24, sScreenY + 27 );
	}
}
Ejemplo n.º 12
0
void
DropDownBase::DrawGoldRectangle()
{
	UINT32 uiDestPitchBYTES;
	UINT8	*pDestBuf;
	UINT16 usWidth, usTempHeight, usTempPosY, usHeight;
	UINT16 usPosX, usPosY;

	UINT16 temp;
	
	usTempPosY = musStartY;
	usTempPosY += DEF_SCROLL_ARROW_HEIGHT;
	usPosX = musScrollAreaX;
	usWidth = musArrowWidth - 5;
	usTempHeight = ( musAreaHeight - DEF_SCROLL_ARROW_HEIGHT ) - 4;

	usHeight = usTempHeight / (mEntryVector.size() - 1);

	usPosY = usTempPosY + (UINT16)( ( usHeight * mSelectedEntry ) );

	temp = musStartY_Drop + musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - usHeight;

	if( usPosY >= temp )
		usPosY = musStartY_Drop + musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - usHeight - 5;

	// color everything black and then color te rectangle, that way we dont have to redraw the entire page
	ColorFillVideoSurfaceArea( FRAME_BUFFER, musScrollAreaX, usTempPosY, musScrollAreaX+usWidth, usTempPosY+usTempHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
	ColorFillVideoSurfaceArea( FRAME_BUFFER, musScrollAreaX, usPosY, musScrollAreaX+usWidth, usPosY+usHeight, mColorMarked );

	//display the line
	pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
	SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

	// draw the gold highlite line on the top and left
	LineDraw(FALSE, usPosX, usPosY, usPosX+usWidth, usPosY, mColorHighLight, pDestBuf);
	LineDraw(FALSE, usPosX, usPosY, usPosX, usPosY+usHeight, mColorHighLight, pDestBuf);

	// draw the shadow line on the bottom and right
	LineDraw(FALSE, usPosX, usPosY+usHeight, usPosX+usWidth, usPosY+usHeight, mColorLineShadow, pDestBuf);
	LineDraw(FALSE, usPosX+usWidth, usPosY, usPosX+usWidth, usPosY+usHeight, mColorLineShadow, pDestBuf);

	// unlock frame buffer
	UnLockVideoSurface( FRAME_BUFFER );
}
Ejemplo n.º 13
0
void
DropDownBase::DrawSelectedCity()
{
	UINT16 usPosY = musStartY_Drop;
	UINT16 usMaxY = 0;

	// make sure we dont go out of our array
	if( mFirstShownEntry+mNumDisplayedEntries > (UINT8)(mEntryVector.size() ) )
		mFirstShownEntry = mEntryVector.size() - mNumDisplayedEntries;
	
	for( UINT8 i = mFirstShownEntry; i < mFirstShownEntry+mNumDisplayedEntries; ++i)
	{
		usMaxY = min(usPosY+musFontHeight+2, musStartY_Drop + musAreaHeight - 4);

		if ( i == mSelectedEntry )
		{
			ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop+4, usPosY-2, musStartX_Drop+musWidth-4,	usMaxY, mColorMarked );
			SetFontShadow(NO_SHADOW);
			DrawTextToScreen( mEntryVector[i].second, musStartX_Drop+CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED	);
			SetFontShadow(DEFAULT_SHADOW);
		}
		else
		{
			ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop+4, usPosY-2, musStartX_Drop+musWidth-4,	usMaxY, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
			DrawTextToScreen( mEntryVector[i].second, musStartX_Drop+CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED	);
		}

		usPosY += musFontHeight + 4;
	}
}
Ejemplo n.º 14
0
void
DropDownBase::Display_Drop()
{
	if( !mfMouseRegionsCreated_Drop )
		return;

	HVOBJECT	hArrowHandle;
		
	//Display the background for the drop down window
	ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop, musStartY_Drop, musStartX_Drop+musWidth+musArrowWidth,	musStartY_Drop+musAreaHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );

	// top
	Display2Line2ShadowHorizontal( musStartX_Drop, musStartY_Drop-4, musStartX_Drop + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow );

	// left
	Display2Line2ShadowVertical( musStartX_Drop, musStartY_Drop-2, musStartY_Drop + musAreaHeight - 1, mColorLine, mColorLineShadow );

	// right between text and arrow
	Display2Line2ShadowVertical( musStartX_Drop + musWidth - 4, musStartY_Drop-2, musStartY_Drop + musAreaHeight - 1, mColorLine, mColorLineShadow );
		
	// bottom
	Display2Line2ShadowHorizontal( musStartX_Drop, musStartY_Drop + musAreaHeight - 4, musStartX_Drop + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow );
	
	// right
	Display2Line2ShadowVertical( musStartX_Drop + musWidth + musArrowWidth - 4, musStartY_Drop-4, musStartY_Drop + musAreaHeight - 3, mColorLine, mColorLineShadow );

	DrawSelectedCity();
	
	//get and display the up and down arrows
	GetVideoObject(&hArrowHandle, muiGoldArrowImages);
	// top arrow
	BltVideoObject(FRAME_BUFFER, hArrowHandle, 1, musUpArrowX, musUpArrowY, VO_BLT_SRCTRANSPARENCY,NULL);

	// down arrow
	BltVideoObject(FRAME_BUFFER, hArrowHandle, 0, musDownArrowX, musDownArrowY, VO_BLT_SRCTRANSPARENCY,NULL);

	//display the scroll rectangle
	DrawGoldRectangle();

	InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
}
Ejemplo n.º 15
0
void
DropDownBase::Display()
{
	if( !mfMouseRegionsCreated )
		return;

	HVOBJECT	hArrowHandle;
			
	//Display the background for the drop down window
	ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX, musStartY, musStartX + musWidth + musArrowWidth, musStartY + DEF_SCROLL_ARROW_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );

	// top
	Display2Line2ShadowHorizontal( musStartX, musStartY, musStartX + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow );

	// left
	Display2Line2ShadowVertical( musStartX, musStartY+2, musStartY + DEF_SCROLL_ARROW_HEIGHT - 1, mColorLine, mColorLineShadow );

	// right between text and arrow
	Display2Line2ShadowVertical( musStartX + musWidth - 4, musStartY+2, musStartY + DEF_SCROLL_ARROW_HEIGHT - 1, mColorLine, mColorLineShadow );
		
	// bottom
	Display2Line2ShadowHorizontal( musStartX, musStartY + DEF_SCROLL_ARROW_HEIGHT - 4, musStartX + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow );
	
	// right
	Display2Line2ShadowVertical( musStartX + musWidth + musArrowWidth - 4, musStartY, musStartY + DEF_SCROLL_ARROW_HEIGHT - 3, mColorLine, mColorLineShadow );
	
	DrawTopEntry();

	//get and display the up and down arrows
	GetVideoObject(&hArrowHandle, muiGoldArrowImages);
	//top arrow
	BltVideoObject(FRAME_BUFFER, hArrowHandle, 0, musUpArrowX, musUpArrowY, VO_BLT_SRCTRANSPARENCY,NULL);
		
	// Set region help text
	if ( StringPixLength ( mHelpText, DEF_DROPDOWN_FONT ) > 0 )
	{
		SetRegionFastHelpText( &mBubbleHelpRegion, mHelpText );
		SetRegionHelpEndCallback( &mBubbleHelpRegion, MSYS_NO_CALLBACK );
	}
	
	InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);

	// display dropped region if necessary
	Display_Drop();
}
Ejemplo n.º 16
0
INT32 DoChatBox( bool bIncludeChatLog, const STR16 zString, UINT32 uiExitScreen, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect )
{
	VSURFACE_DESC		vs_desc;
	UINT16	usTextBoxWidth;
	UINT16	usTextBoxHeight;
	UINT16	usYMargin;
	SGPRect	aRect;
	UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
	UINT8	*pDestBuf, *pSrcBuf;
	INT16	sButtonX, sButtonY;
	UINT8	ubMercBoxBackground = BASIC_MERC_POPUP_BACKGROUND, ubMercBoxBorder = BASIC_MERC_POPUP_BORDER;
	UINT8	ubFontColor, ubFontShadowColor;
	UINT16	usCursor;
	INT32 iId = -1;

	// clear the ouput string
	memset(gszChatBoxInputString,0,sizeof(CHAR16)*255);

	gIncludeChatLog = bIncludeChatLog;

	GetMousePos( &pOldMousePosition );

	if (bIncludeChatLog)
		usYMargin = CHATBOX_Y_MARGIN_LOG;
	else
		usYMargin = CHATBOX_Y_MARGIN_NOLOG;

	//this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer
	gfDontOverRideSaveBuffer = TRUE;

	SetCurrentCursorFromDatabase( CURSOR_NORMAL );

	if( gChatBox.BackRegion.uiFlags & MSYS_REGION_EXISTS )
	{
		return( 0 );
	}

	// set style
	ubMercBoxBackground = DIALOG_MERC_POPUP_BACKGROUND;
	ubMercBoxBorder			= DIALOG_MERC_POPUP_BORDER;

	// Add button images
	gChatBox.iButtonImages			= LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,0,-1,1,-1 );
	ubFontColor	= CHATBOX_FONT_COLOR;
	ubFontShadowColor = DEFAULT_SHADOW;
	usCursor = CURSOR_NORMAL;

			


	// Use default!
	aRect.iTop		= 	0;
	aRect.iLeft		= 	0;
	aRect.iBottom = 	SCREEN_HEIGHT;
	aRect.iRight	= 	SCREEN_WIDTH;

	// Set some values!
	//gChatBox.usFlags			= usFlags;
	gChatBox.uiExitScreen	= uiExitScreen;
	gChatBox.ExitCallback	= ReturnCallback;
	gChatBox.fRenderBox		= TRUE;
	gChatBox.bHandled		= 0;

	// Init message box
	if (bIncludeChatLog)
		// we need a string just long enough to give 1 line, but max length of the box, we render the chatlog over this string so well never see it. DONT DELETE ANY SPACES
		gChatBox.iBoxId = PrepareMercPopupBox( iId, ubMercBoxBackground, ubMercBoxBorder, L"A string that will be hidden,                          ", CHATBOX_WIDTH, CHATBOX_X_MARGIN, usYMargin, CHATBOX_Y_MARGIN_BOTTOM, &usTextBoxWidth, &usTextBoxHeight );
	else
		gChatBox.iBoxId = PrepareMercPopupBox( iId, ubMercBoxBackground, ubMercBoxBorder, zString, CHATBOX_WIDTH, CHATBOX_X_MARGIN, usYMargin, CHATBOX_Y_MARGIN_BOTTOM, &usTextBoxWidth, &usTextBoxHeight );

	if( gChatBox.iBoxId == -1 )
	{
		#ifdef JA2BETAVERSION
			AssertMsg( 0, "Failed in DoMessageBox().	Probable reason is because the string was too large to fit in max message box size." );
		#endif
		return 0;
	}

	// Save height,width
	gChatBox.usWidth = usTextBoxWidth;
	gChatBox.usHeight = usTextBoxHeight;

	// Determine position ( centered in rect )
	gChatBox.sX = (INT16)( ( ( ( aRect.iRight	- aRect.iLeft ) - usTextBoxWidth ) / 2 ) + aRect.iLeft );
	gChatBox.sY = (INT16)( ( ( ( aRect.iBottom - aRect.iTop ) - usTextBoxHeight ) / 2 ) + aRect.iTop );

	if ( guiCurrentScreen == GAME_SCREEN )
	{
		gfStartedFromGameScreen = TRUE;
	}

	if ( (fInMapMode == TRUE ) )
	{
//		fMapExitDueToMessageBox = TRUE;
		gfStartedFromMapScreen = TRUE;
		fMapPanelDirty = TRUE;
	}


	// Set pending screen
	SetPendingNewScreen( MP_CHAT_SCREEN);

	// Init save buffer
	vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE;
	vs_desc.usWidth = usTextBoxWidth;
	vs_desc.usHeight = usTextBoxHeight;
	vs_desc.ubBitDepth = 16;

	if( AddVideoSurface( &vs_desc, &gChatBox.uiSaveBuffer) == FALSE )
	{
		return( - 1 );
	}

	//Save what we have under here...
	pDestBuf = LockVideoSurface( gChatBox.uiSaveBuffer, &uiDestPitchBYTES);
	pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES);

	Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
				(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
				0 , 0,
				gChatBox.sX , gChatBox.sY,
				usTextBoxWidth, usTextBoxHeight );

	UnLockVideoSurface( gChatBox.uiSaveBuffer );
	UnLockVideoSurface( FRAME_BUFFER );

	// Create top-level mouse region
	MSYS_DefineRegion( &(gChatBox.BackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST,
						usCursor, MSYS_NO_CALLBACK, ChatBoxClickCallback );

	// Add region
	MSYS_AddRegion(&(gChatBox.BackRegion) );

	// findout if cursor locked, if so, store old params and store, restore when done
	if( IsCursorRestricted() )
	{
		fCursorLockedToArea = TRUE;
		GetRestrictedClipCursor( &ChatBoxRestrictedCursorRegion );
		FreeMouseCursor( );
	}

	// vars for positioning controls on the chatbox
	int usPosX = 0;
	int usPosY = gChatBox.sY + GetFontHeight(CHATBOX_FONT_TITLE) + CHATBOX_Y_GAP + 5;

	if (bIncludeChatLog)
	{
		// CREATE BUTTONS AND IMAGES FOR CHATLOG

		VOBJECT_DESC	VObjectDesc;
		// will create buttons for interface bottom
		VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
		FilenameForBPP( "INTERFACE\\mpchatbox.sti", VObjectDesc.ImageFile );
		if( !AddVideoObject( &VObjectDesc, &guiCHATLOGIMG ) )
			Assert( false );

		gChatMessageLogRegion.iTop = usPosY;
		gChatMessageLogRegion.iLeft = gChatBox.sX + (CHATBOX_X_MARGIN / 2);
		gChatMessageLogRegion.iBottom = usPosY + CHATBOX_LOG_HEIGHT;
		gChatMessageLogRegion.iRight =  gChatMessageLogRegion.iLeft + CHATBOX_LOG_WIDTH;

		// SETUP SCROLLING AREA BOUNDS
		CHATLOG_SCROLL_AREA_START_Y = gChatMessageLogRegion.iTop+20;
		CHATLOG_SCROLL_AREA_END_Y = gChatMessageLogRegion.iBottom-20;
		CHATLOG_SCROLL_AREA_HEIGHT = ( CHATLOG_SCROLL_AREA_END_Y - CHATLOG_SCROLL_AREA_START_Y + 1 );

		CHATLOG_SCROLL_AREA_START_X = gChatMessageLogRegion.iRight + CHATBOX_SLIDER_GAP + 1; 
		CHATLOG_SCROLL_AREA_END_X = gChatMessageLogRegion.iRight + CHATBOX_SLIDER_GAP + 1 + CHAT_SLIDER_WIDTH;
		CHATLOG_SCROLL_AREA_WIDTH = ( CHATLOG_SCROLL_AREA_END_X - CHATLOG_SCROLL_AREA_START_X + 1 );

		CHAT_SLIDER_BAR_RANGE = ( CHATLOG_SCROLL_AREA_HEIGHT - CHAT_SLIDER_HEIGHT );

		LoadChatLogSliderBar();

		// Load Scroll button images
		guiChatLogScrollButtonsImage[ CHAT_SCROLL_MESSAGE_UP ]=  LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 );
 
		guiChatLogScrollButtonsImage[ CHAT_SCROLL_MESSAGE_DOWN ]=  LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 );

		// Create buttons
		guiChatLogScrollButtons[ CHAT_SCROLL_MESSAGE_UP ] = QuickCreateButton( guiChatLogScrollButtonsImage[ CHAT_SCROLL_MESSAGE_UP ], gChatMessageLogRegion.iRight + CHATBOX_SLIDER_GAP + 2 , gChatMessageLogRegion.iTop + 1 ,
										BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST,
										(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageUpChatLogCallback);
		guiChatLogScrollButtons[ CHAT_SCROLL_MESSAGE_DOWN ] = QuickCreateButton( guiChatLogScrollButtonsImage[ CHAT_SCROLL_MESSAGE_DOWN ], gChatMessageLogRegion.iRight + CHATBOX_SLIDER_GAP + 2, gChatMessageLogRegion.iBottom - 16,
										BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST,
										(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageDownChatLogCallback);



		usPosY = gChatBox.sY + CHATBOX_Y_MARGIN_LOG + (CHATBOX_Y_GAP * 2) + GetFontHeight(FONT12ARIAL) + 5;
		// END CREATE CHATLOG
	}
	else
		usPosY = gChatBox.sY + CHATBOX_Y_MARGIN_NOLOG + (CHATBOX_Y_GAP * 2) + GetFontHeight(FONT12ARIAL);
	
	// get the middle of the box
	UINT16 middleBox = ( usTextBoxWidth / 2 );

	// CREATE SEND TO ALLIES / ALL TOGGLES
	// send to all
	int toggleWidth = 32 + StringPixLength( gzMPChatToggleText[ 0 ], CHATBOX_FONT_TOGGLE );
	usPosX = gChatBox.sX + ((middleBox - toggleWidth)/2);

	guiChatToggles[ 0 ] = CreateCheckBoxButton( usPosX, usPosY,
												"INTERFACE\\OptionsCheckBoxes_12x12.sti", MSYS_PRIORITY_HIGHEST,
												BtnChatTogglesCallback );
	MSYS_SetBtnUserData( guiChatToggles[ 0 ], 0, 0 );

	// send to allies
	toggleWidth = 32 + StringPixLength( gzMPChatToggleText[ 1 ], CHATBOX_FONT_TOGGLE );
	usPosX = gChatBox.sX + middleBox + ((middleBox - toggleWidth)/2);


	guiChatToggles[ 1 ] = CreateCheckBoxButton( usPosX, usPosY,
												"INTERFACE\\OptionsCheckBoxes_12x12.sti", MSYS_PRIORITY_HIGHEST,
												BtnChatTogglesCallback );
	MSYS_SetBtnUserData( guiChatToggles[ 1 ], 0, 1 );

	usPosY += CHATBOX_TOGGLE_HEIGHT + CHATBOX_Y_GAP;

	// SET DEFAULT FLAGGED

	if (gbChatSendToAll)
		ButtonList[ guiChatToggles[ 0 ] ]->uiFlags |= BUTTON_CLICKED_ON;
	else
		ButtonList[ guiChatToggles[ 1 ] ]->uiFlags |= BUTTON_CLICKED_ON;

	// END CREATE TOGGLES

	// CREATE TEXT INPUT BOX
	InitTextInputMode(); // API call to initialise text input mode for this screen
						 // does not mean we are inputting text right away

	// Player Name field
	SetTextInputCursor( CUROSR_IBEAM_WHITE );
	SetTextInputFont( (UINT16) FONT12ARIALFIXEDWIDTH ); //FONT12ARIAL //FONT12ARIALFIXEDWIDTH
	Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 0, 0, 0) ) );
	SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) );
	SetTextInputRegularColors( FONT_WHITE, 2 );
	SetTextInputHilitedColors( 2, FONT_WHITE, FONT_WHITE	);
	SetCursorColor( Get16BPPColor(FROMRGB(255, 255, 255) ) );

	usPosX = gChatBox.sX + (CHATBOX_X_MARGIN / 2);
	//Add Player Name textbox 
	AddTextInputField(	usPosX ,
						usPosY , 
						usTextBoxWidth - CHATBOX_X_MARGIN,
						20,
						MSYS_PRIORITY_HIGH+2,
						gszChatBoxInputString,
						255,
						INPUTTYPE_ASCII );//23

	gChatTextBoxRegion.iTop = usPosY;
	gChatTextBoxRegion.iLeft = usPosX;
	gChatTextBoxRegion.iBottom = usPosY+20;
	gChatTextBoxRegion.iRight = usPosX+usTextBoxWidth - CHATBOX_X_MARGIN;

	// exit text input mode in this screen and clean up text boxes
	SetActiveField( 0 );

	usPosY += CHATBOX_INPUT_HEIGHT + CHATBOX_Y_GAP;
	// END CREATE TEXT INPUT BOX

	// CREATE OK AND CANCEL BUTTONS

	// get the button width
	UINT16 btnWidth = GetChatBoxButtonWidth( gChatBox.iButtonImages );

	// Create OK Button
	sButtonX = middleBox + ((middleBox - btnWidth)/2);
	sButtonY = usTextBoxHeight - CHATBOX_BUTTON_HEIGHT - 10;

	gChatBox.uiOKButton = CreateIconAndTextButton( gChatBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL,
													CHATBOX_FONT_COLOR, ubFontShadowColor,
													CHATBOX_FONT_COLOR, ubFontShadowColor,
													TEXT_CJUSTIFIED,
													(INT16)(gChatBox.sX + sButtonX ), (INT16)(gChatBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
													DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKChatBoxCallback );
	SetButtonCursor(gChatBox.uiOKButton, usCursor);
	ForceButtonUnDirty( gChatBox.uiOKButton );

	// move the mouse over the ok button
	if( gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] == FALSE )
	{
		SimulateMouseMovement( ( gChatBox.sX + sButtonX + 27 ), ( gChatBox.sY + sButtonY + 10) );
	}
	
	// Create Cancel Button
	sButtonX = ((middleBox - btnWidth)/2);
	sButtonY = usTextBoxHeight - CHATBOX_BUTTON_HEIGHT - 10;

	gChatBox.uiNOButton = CreateIconAndTextButton( gChatBox.iButtonImages, pMessageStrings[ MSG_CANCEL ], FONT10ARIAL,
													CHATBOX_FONT_COLOR, ubFontShadowColor,
													CHATBOX_FONT_COLOR, ubFontShadowColor,
													TEXT_CJUSTIFIED,
													(INT16)(gChatBox.sX + sButtonX ), (INT16)(gChatBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
													DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)CancelChatBoxCallback );
	SetButtonCursor(gChatBox.uiNOButton, usCursor);
	ForceButtonUnDirty( gChatBox.uiNOButton );

	// END CREATE BUTTONS

#if 0
	gChatBox.fWasPaused = GamePaused();
	if (!gChatBox.fWasPaused)
	{
		InterruptTime();
		PauseGame();
		LockPauseState( 1 );
		// Pause timers as well....
		PauseTime( TRUE );
	}
#endif

	// Save mouse restriction region...
	GetRestrictedClipCursor( &gOldCursorLimitRectangle );
	FreeMouseCursor( );

	gfNewChatBox = TRUE;

	gfInChatBox			= TRUE;

	return( iId );
}
Ejemplo n.º 17
0
UINT32	FadeScreenHandle( )
{
	UINT32 uiTime;

	if ( !gfFadeInitialized )
	{
		SET_ERROR( "Fade Screen called but not intialized " );
		return( ERROR_SCREEN );
	}

	// ATE: Remove cursor
	SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );


	if ( gfFirstTimeInFade )
	{
		gfFirstTimeInFade = FALSE;

		// Calcuate delay
		guiTime = GetJA2Clock( );
	}

	// Get time
	uiTime = GetJA2Clock( );

	MusicPoll( TRUE );

	if ( ( uiTime - guiTime ) > guiFadeDelay )
	{
		// Fade!
		if ( !gfFadeIn )
		{
			//gFadeFunction( );
		}

		InvalidateScreen();

		if ( !gfFadeInVideo )
		{
			gFadeFunction( );
		}

		gsFadeCount++;

		if ( gsFadeCount > gsFadeLimit )
		{
			switch( gbFadeType )
			{
				case FADE_OUT_REALFADE:

					// Clear framebuffer
					ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640, 480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
					break;
			}

			//End!
			gfFadeInitialized = FALSE;
			gfFadeIn = FALSE;

			return( guiExitScreen );
		}
	}

	return( FADE_SCREEN );
}
Ejemplo n.º 18
0
void RenderPopupMenu()
{
	UINT16 usX, usY;
	UINT8 ubColumn, ubEntry, ubCounter;
	UINT8 *pDestBuf;
	UINT32 uiDestPitchBYTES;
	UINT16 usLineColor;
	UINT16 usStringWidth;
	UINT16 usStart;

	//Draw the menu
	ColorFillVideoSurfaceArea(FRAME_BUFFER, 
		gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, 
		Get16BPPColor(FROMRGB(128, 128, 128) ) );
	pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );			
	SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 );
	usLineColor = Get16BPPColor( FROMRGB( 64, 64, 64 ) );
	RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, 
		usLineColor, pDestBuf );
	if( gPopup.ubColumns > 1 )
	{ //draw a vertical line between each column
		usStart = gPopup.usLeft + gPopup.ubColumnWidth[ 0 ];
		for( ubColumn = 1; ubColumn < gPopup.ubColumns; ubColumn++ )
		{
			LineDraw( TRUE, usStart, gPopup.usTop, usStart, gPopup.usBottom, usLineColor, pDestBuf );
		}
		usStart += (UINT16)gPopup.ubColumnWidth[ ubColumn ];
	}
	UnLockVideoSurface( FRAME_BUFFER );

	//Set up the text attributes.
	SetFont( gPopup.usFont);
	SetFontBackground( FONT_MCOLOR_BLACK );
	SetFontForeground( FONT_MCOLOR_WHITE );
	
	usX = gPopup.usLeft + 1;
	ubCounter = 0;
	usStart = gPopup.usLeft;
	for( ubColumn = 0; ubColumn < gPopup.ubColumns; ubColumn++ )
	{
		for( ubEntry = 0; ubEntry < gPopup.ubMaxEntriesPerColumn; ubEntry++ )
		{
			if( ubCounter >= gPopup.ubNumEntries )
				return; //done
			//Calc current string's width in pixels.  Adding 14 pixels which is the width of
			//two padded gPopup.usFont spaces not stored in the string.
			usStringWidth = 14 + StringPixLength( GetPopupMenuString( ubCounter ), gPopup.usFont );
			//Horizontally center the string inside the popup menu
			usX = usStart + ( gPopup.ubColumnWidth[ ubColumn ] - usStringWidth ) / 2;
			usY = gPopup.usTop + 1 + ubEntry * gusEntryHeight;
			if( ubCounter == gPopup.ubSelectedIndex - 1 )
			{
				//This is the highlighted menu entry.
				SetFontForeground( FONT_MCOLOR_LTBLUE );
				mprintf( usX, usY, L" %s ", GetPopupMenuString( ubCounter ) );
				SetFontForeground( FONT_MCOLOR_WHITE );
			}
			else
			{
				mprintf( usX, usY, L" %s ", GetPopupMenuString( ubCounter ) );
			}
			ubCounter++;
		}
		usStart += gPopup.ubColumnWidth[ ubColumn ];
	}
}
Ejemplo n.º 19
0
void DisplayActivationStringCursor( void )
{
    // this procdure will draw the activation string cursor on the screen at position cursorx cursory
    UINT32 uiDestPitchBYTES;
    static UINT32 uiBaseTime = 0;
    UINT32 uiDeltaTime = 0;
    UINT8 *pDestBuf;
    static UINT32 iCurrentState = 0;
    static BOOLEAN fIncrement = TRUE;

    if(uiBaseTime == 0)
    {
        uiBaseTime = GetJA2Clock();
    }

    // get difference
    uiDeltaTime = GetJA2Clock() - uiBaseTime;

    // if difference is long enough, rotate colors
    if(uiDeltaTime > MIN_GLOW_DELTA)
    {
        if( iCurrentState == 10)
        {
            // start rotating downward
            fIncrement = FALSE;
        }
        if( iCurrentState == 0)
        {
            // rotate colors upward
            fIncrement = TRUE;
        }
        // if increment upward, increment iCurrentState
        if(fIncrement)
        {
            iCurrentState++;
        }
        else
        {
            // else downwards
            iCurrentState--;
        }
        // reset basetime to current clock
        uiBaseTime = GetJA2Clock( );
    }

    pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
    SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 );


    // draw line in current state
    LineDraw(TRUE, (UINT16) uiCursorPosition, CURSOR_Y, (UINT16)uiCursorPosition, CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ),
             pDestBuf );

    // unlock frame buffer
    UnLockVideoSurface( FRAME_BUFFER );

    InvalidateRegion((UINT16) uiCursorPosition , CURSOR_Y , (UINT16)uiCursorPosition + 1, CURSOR_Y + CURSOR_HEIGHT + 1);


    return;
}
Ejemplo n.º 20
0
void DrawBrokenLinkWhiteBackground()
{
    ColorFillVideoSurfaceArea( FRAME_BUFFER, LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y, Get16BPPColor( FROMRGB(  255,   255,   255) ) );
}
Ejemplo n.º 21
0
void FadeInBackBufferSquare(  )
{
	INT32 iX1, iX2, iY1, iY2;
	INT16	sFadeXMove, sFadeYMove;
	blt_vs_fx BltFx;

	sFadeXMove = SQUARE_STEP;
	sFadeYMove = (INT16)(sFadeXMove * .75);

	if ( gsFadeCount == 0 )
	{
		ColorFillVideoSurfaceArea( BACKBUFFER, 0, 0, 640, 480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
	}

	iX1 = giX1 - sFadeXMove;
	iX2 = giX1;
	iY1 = giY1 - sFadeYMove;
	iY2 = giY2 + sFadeYMove;

	BltFx.SrcRect.iLeft = iX1;
	BltFx.SrcRect.iTop  = iY1;
	BltFx.SrcRect.iRight = iX2;
	BltFx.SrcRect.iBottom = iY2;

	if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft  )
	{
		BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, 
																	 iX1, iY1, 
																	 VS_BLT_SRCSUBRECT, &BltFx );
	}

	iX1 = giX2;
	iX2 = giX2 + sFadeXMove;
	iY1 = giY1 - sFadeYMove;
	iY2 = giY2 + sFadeYMove;

	BltFx.SrcRect.iLeft = iX1;
	BltFx.SrcRect.iTop  = iY1;
	BltFx.SrcRect.iRight = iX2;
	BltFx.SrcRect.iBottom = iY2;

	if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft )
	{
		BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, 
																	 iX1, iY1, 
																	 VS_BLT_SRCSUBRECT, &BltFx );
	}

	iX1 = giX1;
	iX2 = giX2;
	iY1 = giY1 - sFadeYMove;
	iY2 = giY1;

	BltFx.SrcRect.iLeft = iX1;
	BltFx.SrcRect.iTop  = iY1;
	BltFx.SrcRect.iRight = iX2;
	BltFx.SrcRect.iBottom = iY2;

	if (  BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop )
	{
		BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, 
																	 iX1, iY1, 
																	 VS_BLT_SRCSUBRECT, &BltFx );
	}

	iX1 = giX1;
	iX2 = giX2;
	iY1 = giY2;
	iY2 = giY2 + sFadeYMove;

	BltFx.SrcRect.iLeft = iX1;
	BltFx.SrcRect.iTop  = iY1;
	BltFx.SrcRect.iRight = iX2;
	BltFx.SrcRect.iBottom = iY2;

	if ( BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop )
	{
		BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, 
																	 iX1, iY1, 
																	 VS_BLT_SRCSUBRECT, &BltFx );
	}

	giX1 -= sFadeXMove;
	giX2 += sFadeXMove;
	giY1 -= sFadeYMove;
	giY2 += sFadeYMove;

}
Ejemplo n.º 22
0
INT32	AddSlider( UINT8 ubStyle, UINT16 usCursor, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usNumberOfIncrements, INT8 sPriority, SLIDER_CHANGE_CALLBACK SliderChangeCallback, UINT32 uiFlags )
{
	SLIDER *pTemp = NULL;
	SLIDER *pNewSlider = NULL;

	AssertMsg( gfSliderInited, "Trying to Add a Slider Bar when the Slider System was never inited");

	//checks
	if( ubStyle >= NUM_SLIDER_STYLES )
		return( -1 );


	pNewSlider = (SLIDER *) MemAlloc( sizeof( SLIDER ) );
	if( pNewSlider == NULL )
	{
		return( -1 );
	}
	memset( pNewSlider, 0, sizeof( SLIDER ) );


	//Assign the settings to the current slider
	pNewSlider->ubStyle = ubStyle;
	pNewSlider->usPosX = usPosX;
	pNewSlider->usPosY = usPosY;
//	pNewSlider->usWidth = usWidth;
	pNewSlider->usNumberOfIncrements = usNumberOfIncrements;
	pNewSlider->SliderChangeCallback = SliderChangeCallback;
	pNewSlider->usCurrentIncrement = 0;
	pNewSlider->usBackGroundColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) );
	pNewSlider->uiFlags = uiFlags;

	//Get a new Identifier for the slider
	//Temp just increment for now
	pNewSlider->uiSliderID = guiCurrentSliderID;

	//increment counter
	guiCurrentSliderID++;


	//
	// Create the mouse regions for each increment in the slider
	//

	//add the region
	usPosX = pNewSlider->usPosX;
	usPosY = pNewSlider->usPosY;

	//Add the last one, the width will be whatever is left over
	switch( ubStyle )
	{
		case SLIDER_VERTICAL_STEEL:

			pNewSlider->uiFlags |= SLIDER_VERTICAL;
			pNewSlider->usWidth = STEEL_SLIDER_WIDTH;
			pNewSlider->usHeight = usWidth;
			pNewSlider->ubSliderWidth = STEEL_SLIDER_WIDTH;
			pNewSlider->ubSliderHeight = STEEL_SLIDER_HEIGHT;


			MSYS_DefineRegion( &pNewSlider->ScrollAreaMouseRegion, (UINT16)(usPosX-pNewSlider->usWidth/2), usPosY, (UINT16)(usPosX+pNewSlider->usWidth/2), (UINT16)(pNewSlider->usPosY+pNewSlider->usHeight), sPriority,
									usCursor, SelectedSliderMovementCallBack, SelectedSliderButtonCallBack );
			MSYS_SetRegionUserData( &pNewSlider->ScrollAreaMouseRegion, 1, pNewSlider->uiSliderID );
			break;

		case SLIDER_DEFAULT_STYLE:
		default:

			pNewSlider->uiFlags |= SLIDER_HORIZONTAL;
			pNewSlider->usWidth = usWidth;
			pNewSlider->usHeight = DEFUALT_SLIDER_SIZE;

			MSYS_DefineRegion( &pNewSlider->ScrollAreaMouseRegion, usPosX, (UINT16)(usPosY-DEFUALT_SLIDER_SIZE), (UINT16)(pNewSlider->usPosX+pNewSlider->usWidth), (UINT16)(usPosY+DEFUALT_SLIDER_SIZE), sPriority,
									usCursor, SelectedSliderMovementCallBack, SelectedSliderButtonCallBack );
			MSYS_SetRegionUserData( &pNewSlider->ScrollAreaMouseRegion, 1, pNewSlider->uiSliderID );
		break;
	}


	//
	//	Load the graphic image for the slider box
	//

	//add the slider into the list
	pTemp = pSliderHead;


	//if its the first time in
	if( pSliderHead == NULL )
	{
		pSliderHead = pNewSlider;
		pNewSlider->pNext = NULL;
	}
	else
	{
		while( pTemp->pNext != NULL )
		{
			pTemp = pTemp->pNext;
		}

		pTemp->pNext = pNewSlider;
		pNewSlider->pPrev = pTemp;
		pNewSlider->pNext = NULL;
	}

	CalculateNewSliderBoxPosition( pNewSlider );

	return( pNewSlider->uiSliderID );
}
Ejemplo n.º 23
0
void IMPPrejudiceDisplay()
{
	UINT16 usPosX, usPosY;	

	//Display the title
	DrawTextToScreen( szPersonalityTitleText[0], IMP_PREJUDICE__TITLE_X, LAPTOP_TITLE_Y, LAPTOP_TEXT_WIDTH, FONT14ARIAL, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );

	ColorFillVideoSurfaceArea( FRAME_BUFFER, LAPTOP_SCREEN_UL_X + 2, LAPTOP_SCREEN_WEB_UL_Y + 40, LAPTOP_SCREEN_LR_X - 2,	LAPTOP_SCREEN_WEB_UL_Y + 20 + 5 * DROPDOWN_MARKUP_Y, Get16BPPColor( FROMRGB( 100, 100, 100 ) ) );

	// only display if at least the first dropdown has been initialized (otherwise text will be written outside of the laptop)
	if ( DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().IsDisplayed() )
	{
		usPosX = LAPTOP_SCREEN_UL_X + 5;
		usPosY = LAPTOP_SCREEN_WEB_UL_Y + 50;
		
		// Appearance
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_YOULOOK], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		usPosX = 10 + DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().GetLastX();
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_ANDAPPEARANCEIS], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		usPosX = 10 + DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().GetLastX();
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_IMPORTANTTOYOU], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
				
		// Refinement
		usPosX = LAPTOP_SCREEN_UL_X + 5;
		usPosY += DROPDOWN_MARKUP_Y;
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_YOUHAVE], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		usPosX = 10 + DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().GetLastX();
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_ANDCARE], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		usPosX = 10 + DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().GetLastX();
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_ABOUTTHAT], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		// Hated Nations
		usPosX = LAPTOP_SCREEN_UL_X + 5;
		usPosY += DROPDOWN_MARKUP_Y;
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		usPosX = 10 + DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().GetLastX();
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_ADHATEEVERYONE], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		// Racism
		usPosX = LAPTOP_SCREEN_UL_X + 5;
		usPosY += DROPDOWN_MARKUP_Y;
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		usPosX = 10 + DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().GetLastX();
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_RACISTAGAINSTNON], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		usPosX = 10 + DropDownTemplate<DROPDOWNNR_RACE>::getInstance().GetLastX();
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_PEOPLE], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		// Sexism
		usPosX = LAPTOP_SCREEN_UL_X + 5;
		usPosY += DROPDOWN_MARKUP_Y;
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );

		usPosX = 10 + DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().GetLastX();
		DrawTextToScreen( szPersonalityDisplayText[PERSONALITYTEXT_DOT], usPosX, usPosY, 0, IMP_PREJUDICE__FONT, IMP_PREJUDICE__COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
	}
}
Ejemplo n.º 24
0
void RenderEditorItemsInfo()
{
	UINT8	*pDestBuf, *pSrcBuf;
	UINT32 uiSrcPitchBYTES, uiDestPitchBYTES;
	INVTYPE *item;
	HVOBJECT hVObject;
	UINT32 uiVideoObjectIndex;
	INT16 i;
	INT16 minIndex, maxIndex;
	INT16 sWidth, sOffset, sStart, x, y;
	UINT16 usNumItems;
	UINT16 usQuantity;

	if(!eInfo.fActive)
	{
		return;
	}

	if( gusMouseXPos < (iScreenWidthOffset + 110) || gusMouseXPos > (iScreenWidthOffset + 480) || gusMouseYPos < (2 * iScreenHeightOffset + 360) || gusMouseYPos > (2 * iScreenHeightOffset + 440) )
	{ //Mouse has moved out of the items display region -- so nothing can be highlighted.
		eInfo.sHilitedItemIndex = -1;
	}
	pDestBuf = LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES);
	pSrcBuf = LockVideoSurface(eInfo.uiBuffer, &uiSrcPitchBYTES);

	Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
				(UINT16 *)pSrcBuf, uiSrcPitchBYTES, iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 360, 60*eInfo.sScrollIndex, 0, 360, 80 );

	UnLockVideoSurface(eInfo.uiBuffer);
	UnLockVideoSurface(FRAME_BUFFER);

	//calculate the min and max index that is currently shown.	This determines
	//if the highlighted and/or selected items are drawn with the outlines.
	minIndex = eInfo.sScrollIndex * 2;
	maxIndex = minIndex + 11;

	//draw the hilighted item if applicable.
	if( eInfo.sHilitedItemIndex >= minIndex && eInfo.sHilitedItemIndex <= maxIndex )
	{
		if( eInfo.pusItemIndex )
		{
			item = &Item[eInfo.pusItemIndex[eInfo.sHilitedItemIndex]];
			uiVideoObjectIndex = GetInterfaceGraphicForItem( item );
			GetVideoObject( &hVObject, uiVideoObjectIndex );

			x = iScreenWidthOffset + (eInfo.sHilitedItemIndex/2 - eInfo.sScrollIndex)*60 + 110;
			y = 2 * iScreenHeightOffset + 360 + (eInfo.sHilitedItemIndex % 2) * 40;

			UINT16 usGraphicNum = g_bUsePngItemImages ? 0 : item->ubGraphicNum;
			sWidth = hVObject->pETRLEObject[usGraphicNum].usWidth;
			sOffset = hVObject->pETRLEObject[usGraphicNum].sOffsetX;
			sStart = x + (60 - sWidth - sOffset*2) / 2;
			if( sWidth )
			{
				BltVideoObjectOutlineFromIndex( FRAME_BUFFER, uiVideoObjectIndex, usGraphicNum, sStart, y+2, Get16BPPColor(FROMRGB(250, 250, 0)), TRUE );
			}
		}
	}
	//draw the selected item
	if( eInfo.sSelItemIndex >= minIndex && eInfo.sSelItemIndex <= maxIndex )
	{
		if( eInfo.pusItemIndex )
		{
			item = &Item[eInfo.pusItemIndex[eInfo.sSelItemIndex]];
			uiVideoObjectIndex = GetInterfaceGraphicForItem( item );
			GetVideoObject( &hVObject, uiVideoObjectIndex );

			x = iScreenWidthOffset + (eInfo.sSelItemIndex/2 - eInfo.sScrollIndex)*60 + 110;
			y = 2 * iScreenHeightOffset + 360 + (eInfo.sSelItemIndex % 2) * 40;

			UINT16 usGraphicNum = g_bUsePngItemImages ? 0 : item->ubGraphicNum;
			sWidth = hVObject->pETRLEObject[usGraphicNum].usWidth;
			sOffset = hVObject->pETRLEObject[usGraphicNum].sOffsetX;
			sStart = x + (60 - sWidth - sOffset*2) / 2;
			if( sWidth )
			{
				BltVideoObjectOutlineFromIndex( FRAME_BUFFER, uiVideoObjectIndex, usGraphicNum, sStart, y+2, Get16BPPColor(FROMRGB(250, 0, 0)), TRUE );
			}
		}
	}
	//draw the numbers of each visible item that currently resides in the world.
	maxIndex = min( maxIndex, eInfo.sNumItems-1 );
	for( i = minIndex; i <= maxIndex; i++ )
	{
		usNumItems = CountNumberOfEditorPlacementsInWorld( i, &usQuantity );
		if( usNumItems )
		{
			x = iScreenWidthOffset + (i/2 - eInfo.sScrollIndex)*60 + 110;
			y = 2 * iScreenHeightOffset + 360 + (i % 2) * 40;
			SetFont( FONT10ARIAL );
			SetFontForeground( FONT_YELLOW );
			SetFontShadow( FONT_NEARBLACK );
			if( usNumItems == usQuantity )
				mprintf( x + 12, y + 4, L"%d", usNumItems );
			else
				mprintf( x + 12, y + 4, L"%d(%d)", usNumItems, usQuantity );
		}
	}
}
Ejemplo n.º 25
0
void BeginFade( UINT32 uiExitScreen, INT8 bFadeValue, INT8 bType, UINT32 uiDelay )
{
	//Init some paramters
	guiExitScreen	= uiExitScreen;
	gbFadeValue		= bFadeValue;
	guiFadeDelay			= uiDelay;
	gfFadeIn = FALSE;
	gfFadeInVideo = TRUE;

	uiOldMusicMode = uiMusicHandle;


	// Calculate step;
	switch ( bType )
	{
			case FADE_IN_REALFADE:

				gsFadeRealCount = -1;
				gsFadeLimit			= 8;
				gFadeFunction = (FADE_FUNCTION)FadeInFrameBufferRealFade;		
				gfFadeInVideo   = FALSE;

				// Copy backbuffer to savebuffer
				UpdateSaveBufferWithBackbuffer( );

				// Clear framebuffer
				ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640, 480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
				break;

			case FADE_OUT_REALFADE:
				
				gsFadeRealCount = -1;
				gsFadeLimit			= 10;
				gFadeFunction = (FADE_FUNCTION)FadeFrameBufferRealFade;		
				gfFadeInVideo   = FALSE;

				// Clear framebuffer
				//ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640, 480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
				break;

			case FADE_OUT_VERSION_ONE:
				//gsFadeLimit = 255 / bFadeValue;
				//gFadeFunction = (FADE_FUNCTION)FadeFrameBufferVersionOne;
				//SetMusicFadeSpeed( 25 );
				//SetMusicMode( MUSIC_NONE );
				break;

			case FADE_OUT_SQUARE:
				gsFadeLimit = (640 / ( SQUARE_STEP * 2 ) );
				giX1 = 0;
				giX2 = 640;
				giY1 = 0;
				giY2 = 480;
				gFadeFunction = (FADE_FUNCTION)FadeFrameBufferSquare;

				// Zero frame buffer
				ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640,	480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
				//ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, 640,	480, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );

			//	SetMusicFadeSpeed( 25 );
				//SetMusicMode( MUSIC_NONE );
				break;

			case FADE_IN_VERSION_ONE:
				gsFadeLimit = 255 / bFadeValue;
				gFadeFunction = (FADE_FUNCTION)FadeInBackBufferVersionOne;
				break;

			case FADE_IN_SQUARE:
				gFadeFunction = (FADE_FUNCTION)FadeInBackBufferSquare;
				giX1 = 320;
				giX2 = 320;
				giY1 = 240;
				giY2 = 240;
				gsFadeLimit = (640 / ( SQUARE_STEP * 2 ) );
				gfFadeIn = TRUE;
				break;

			case FADE_OUT_VERSION_FASTER:
				gsFadeLimit = (255 / bFadeValue) * 2;
				gFadeFunction = (FADE_FUNCTION)FadeFrameBufferVersionFaster;

				//SetMusicFadeSpeed( 25 );
				//SetMusicMode( MUSIC_NONE );
				break;

			case FADE_OUT_VERSION_SIDE:
				// Copy frame buffer to save buffer
				gsFadeLimit = (640 / 8 );
				gFadeFunction = (FADE_FUNCTION)FadeFrameBufferSide;

				//SetMusicFadeSpeed( 25 );
				//SetMusicMode( MUSIC_NONE );
				break;

	}

	gfFadeInitialized = TRUE;
	gfFirstTimeInFade = TRUE;
	gsFadeCount				= 0;
	gbFadeType						= bType;

	SetPendingNewScreen(FADE_SCREEN);

}
Ejemplo n.º 26
0
void DrawFileDialog(void)
{
	//dnl ch36 150909
	ColorFillVideoSurfaceArea(FRAME_BUFFER,	iScreenWidthOffset+179, iScreenHeightOffset+69, iScreenWidthOffset+179+281, iScreenHeightOffset+261, Get16BPPColor(FROMRGB(136, 138, 135)));
	ColorFillVideoSurfaceArea(FRAME_BUFFER,	iScreenWidthOffset+180, iScreenHeightOffset+70, iScreenWidthOffset+179+281, iScreenHeightOffset+261, Get16BPPColor(FROMRGB(24, 61, 81)));
	ColorFillVideoSurfaceArea(FRAME_BUFFER,	iScreenWidthOffset+180, iScreenHeightOffset+70, iScreenWidthOffset+179+280, iScreenHeightOffset+260, Get16BPPColor(FROMRGB(65, 79, 94)));
	ColorFillVideoSurfaceArea(FRAME_BUFFER, iScreenWidthOffset+179+4, iScreenHeightOffset+69+3, iScreenWidthOffset+179+4+240, iScreenHeightOffset+69+123, Get16BPPColor(FROMRGB(24, 61, 81)));
	ColorFillVideoSurfaceArea(FRAME_BUFFER, iScreenWidthOffset+179+5, iScreenHeightOffset+69+4, iScreenWidthOffset+179+4+240, iScreenHeightOffset+69+123, Get16BPPColor(FROMRGB(136, 138, 135)));
	ColorFillVideoSurfaceArea(FRAME_BUFFER, iScreenWidthOffset+179+5, iScreenHeightOffset+69+4, iScreenWidthOffset+179+3+240, iScreenHeightOffset+69+122, Get16BPPColor(FROMRGB(250, 240, 188)));

	MarkButtonsDirty();
	RenderButtons();
	RenderButtonsFastHelp();

	SetFont( FONT10ARIAL );
	SetFontForeground( FONT_LTKHAKI );
	SetFontShadow( FONT_DKKHAKI );
	SetFontBackground( FONT_BLACK );
	mprintf( iScreenWidthOffset + 183, iScreenHeightOffset + 217, L"Filename" );
	
	if( iFileDlgButtons[6] != -1 ) 
	{
		mprintf( iScreenWidthOffset + 200, iScreenHeightOffset + 231, L"Update world info" );
	}
}
Ejemplo n.º 27
0
void EnterIMPPrejudice( void )
{
	RenderProfileBackGround();
				
	giIMPPrejudiceFinishButtonImage =	LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 );
	giIMPPrejudiceFinishButton = CreateIconAndTextButton( giIMPPrejudiceFinishButtonImage, pImpButtonText[ 24 ], FONT12ARIAL,
																FONT_WHITE, DEFAULT_SHADOW,
																FONT_WHITE, DEFAULT_SHADOW,
																TEXT_CJUSTIFIED,
																LAPTOP_SCREEN_UL_X +	( 350 ), LAPTOP_SCREEN_WEB_UL_Y + ( 340 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
																BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPrejudiceFinishCallback );
	
	SetButtonCursor( giIMPPrejudiceFinishButton, CURSOR_WWW);

	UINT16 usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOULOOK], FONT12ARIAL ) + 10;
	UINT16 usY = LAPTOP_SCREEN_WEB_UL_Y + 43;
	////////////////// DropDown_Appearance //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_Appearance;
	for(UINT8 i = 0; i < NUM_APPEARANCES; ++i)
		entryvecDropDown_Appearance.push_back( std::make_pair(i, szAppearanceText[i]) );
	
	DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().SetEntries(entryvecDropDown_Appearance);
	DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_APPEARANCE] );
	DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().Create(usX, usY);
	////////////////// DropDown_Appearance //////////////////////////

	usX = DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().GetLastX() + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_ANDAPPEARANCEIS], FONT12ARIAL ) + 20;
	////////////////// DropDown_AppearanceCare //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_AppearanceCare;
	for(UINT8 i = 0; i < NUM_CARELEVELS; ++i)
		entryvecDropDown_AppearanceCare.push_back( std::make_pair(i, szCareLevelText[i]) );
	
	DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().SetEntries(entryvecDropDown_AppearanceCare);
	DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_APPEARANCECARE] );
	DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) );
	DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().Create(usX, usY);
	////////////////// DropDown_AppearanceCare //////////////////////////

	usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOUHAVE], FONT12ARIAL ) + 10;
	usY += DROPDOWN_MARKUP_Y;
	////////////////// DropDown_Refinement //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_Refinement;
	for(UINT8 i = 0; i < NUM_REFINEMENT; ++i)
		entryvecDropDown_Refinement.push_back( std::make_pair(i, szRefinementText[i]) );

	DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().SetEntries(entryvecDropDown_Refinement);
	DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_REFINEMENT] );
	DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().Create(usX, usY);
	////////////////// DropDown_Refinement //////////////////////////

	usX = DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().GetLastX() + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_ANDCARE], FONT12ARIAL ) + 20;
	////////////////// DropDownTemplate<DROPDOWNNR_REFINEMENTCARE> //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_RefinementCare;
	for(UINT8 i = 0; i < NUM_CARELEVELS; ++i)
		entryvecDropDown_RefinementCare.push_back( std::make_pair(i, szCareLevelText[i]) );

	DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().SetEntries(entryvecDropDown_RefinementCare);
	DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_REFINEMENTCARE] );
	DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) );
	DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().Create(usX, usY);
	////////////////// DropDownTemplate<DROPDOWNNR_REFINEMENTCARE> //////////////////////////

	usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], FONT12ARIAL ) + 10;
	usY += DROPDOWN_MARKUP_Y;
	////////////////// DropDownTemplate<DROPDOWNNR_NATIONALITY> //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_Nationality;
	for(UINT8 i = 0; i < NUM_NATIONALITIES; ++i)
		entryvecDropDown_Nationality.push_back( std::make_pair(i, szNationalityText[i]) );

	DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().SetEntries(entryvecDropDown_Nationality);
	DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_NATIONALITY] );
	DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().Create(usX, usY);
	////////////////// DropDownTemplate<DROPDOWNNR_NATIONALITY> //////////////////////////

	usX = DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().GetLastX() + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_ADHATEEVERYONE], FONT12ARIAL ) + 20;
	////////////////// DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY> //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_HatedNationality;
	// we can also hate no nation at all...
	entryvecDropDown_HatedNationality.push_back( std::make_pair(-1, szNationalityText_Special[1]) );

	for(UINT8 i = 0; i < NUM_NATIONALITIES; ++i)
		entryvecDropDown_HatedNationality.push_back( std::make_pair(i, szNationalityText[i]) );

	DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY>::getInstance().SetEntries(entryvecDropDown_HatedNationality);
	DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_HATEDNATIONALITY] );
	DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY>::getInstance().Create(usX, usY);
	////////////////// DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY> //////////////////////////

	usX = DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY>::getInstance().GetLastX() + 5;
	////////////////// DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE> //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_HatedNationalityCare;
	for(UINT8 i = 0; i < NUM_CARELEVELS; ++i)
		entryvecDropDown_HatedNationalityCare.push_back( std::make_pair(i, szCareLevelText[i]) );

	DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE>::getInstance().SetEntries(entryvecDropDown_HatedNationalityCare);
	DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_HATEDNATIONALITYCARE] );
	DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) );
	DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE>::getInstance().Create(usX, usY);
	////////////////// DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE> //////////////////////////

	usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], FONT12ARIAL ) + 10;
	usY += DROPDOWN_MARKUP_Y;
	////////////////// DropDownTemplate<DROPDOWNNR_RACIST> //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_Racist;
	for(UINT8 i = 0; i < NUM_RACIST; ++i)
		entryvecDropDown_Racist.push_back( std::make_pair(i, szRacistText[i]) );

	DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().SetEntries(entryvecDropDown_Racist);
	DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_RACIST] );
	DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) );
	DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().Create(usX, usY);
	////////////////// DropDownTemplate<DROPDOWNNR_RACIST> //////////////////////////

	usX = DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().GetLastX() + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_RACISTAGAINSTNON], FONT12ARIAL ) + 10;
	////////////////// DropDownTemplate<DROPDOWNNR_RACE> //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_Race;
	for(UINT8 i = 0; i < NUM_RACES; ++i)
		entryvecDropDown_Race.push_back( std::make_pair(i, szRaceText[i]) );

	DropDownTemplate<DROPDOWNNR_RACE>::getInstance().SetEntries(entryvecDropDown_Race);
	DropDownTemplate<DROPDOWNNR_RACE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_RACE] );
	DropDownTemplate<DROPDOWNNR_RACE>::getInstance().Create(usX, usY);
	////////////////// DropDownTemplate<DROPDOWNNR_RACE> //////////////////////////

	usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], FONT12ARIAL ) + 10;
	usY += DROPDOWN_MARKUP_Y;
	////////////////// DropDownTemplate<DROPDOWNNR_SEXIST> //////////////////////////
	std::vector<std::pair<INT16, STR16> > entryvecDropDown_Sexist;
	for(UINT8 i = 0; i < NUM_SEXIST; ++i)
		entryvecDropDown_Sexist.push_back( std::make_pair(i, szSexistText[i]) );

	DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().SetEntries(entryvecDropDown_Sexist);
	DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_SEXIST] );
	DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) );
	DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().Create(usX, usY);
	////////////////// DropDownTemplate<DROPDOWNNR_SEXIST> //////////////////////////
}