Пример #1
0
void DisplayNickNameStringCursor( 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, SCREEN_BUFFER_WIDTH, SCREEN_BUFFER_HEIGHT );

  // draw line in current state
	LineDraw(TRUE, (UINT16) uiNickNameCursorPosition, NICK_NAME_CURSOR_Y, (UINT16)uiNickNameCursorPosition, NICK_NAME_CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), 
	         pDestBuf );
	
  InvalidateRegion((UINT16) uiNickNameCursorPosition, NICK_NAME_CURSOR_Y, (UINT16)uiNickNameCursorPosition + 1, NICK_NAME_CURSOR_Y + CURSOR_HEIGHT + 1);
 
	// unlock frame buffer
	UnLockVideoSurface( FRAME_BUFFER );
	return;
}
Пример #2
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 );
}
Пример #3
0
void OptDisplayLine( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 EndY, INT16 iColor )
{
	UINT32 uiDestPitchBYTES;
	UINT8 *pDestBuf;

	pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );

	SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

	// draw the line
	LineDraw(FALSE, usStartX, usStartY, EndX, EndY, iColor, pDestBuf);

	// unlock frame buffer
	UnLockVideoSurface( FRAME_BUFFER );
}
Пример #4
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 ];
	}
}
Пример #5
0
void Missile::Update()
{
    short CenterSX = g_graphics->GetCenterX() - 16,
          CenterSY = g_graphics->GetCenterY() - 16;
    short MeX = (short)(g_game->m_me->GetX() - CenterSX),
          MeY = (short)(g_game->m_me->GetY() - CenterSY);
    float oldDist = m_dist;
    short newX = 0, newY = 0, newX2 = 0, newY2 = 0, j = 0, d;

    m_dist += (float)(5.0 * g_game->GetGameSpeed ());

    if ( m_dist > 500 ) {
        m_expired = true;
        return;
    }

    for ( d = (short)oldDist; d <= m_dist; d++ )
    {
        newX = (short)(cos ( m_angle * DIV360MULTPI ) * d + m_X);
        newY = (short)(sin ( m_angle * DIV360MULTPI ) * d + m_Y);
        j = Touch ( newX, newY );
        if ( j > 0 )
        {
            break;
        }
    }

    for ( short x = (short)oldDist; x < d; x += 7 )
    {
        if ( m_dist > 24 )
        {
            newX2 = (short)(cos ( m_angle * DIV360MULTPI ) * (x - 5) + m_X);
            newY2 = (short)(sin ( m_angle * DIV360MULTPI ) * (x - 5) + m_Y);
            g_interface->MissileSmokeTrail ( newX2, newY2, m_player->GetTeam() );
        }
    }

    newX2 = (short)(cos ( m_angle * DIV360MULTPI ) * (d - 14) + m_X);
    newY2 = (short)(sin ( m_angle * DIV360MULTPI ) * (d - 14) + m_Y);

    short missX = (short)(newX - MeX),
          missY = (short)(newY - MeY),
          missX2 = (short)(newX2 - MeX),
          missY2 = (short)(newY2 - MeY);
    if ( missX > -15 &&
         missY > -15 &&
         missX < g_graphics->GetScreenWidth() + 15 &&
         missY < g_graphics->GetScreenHeight() + 15 )
    {
        LineDraw ( 3, 6, 0, 0, missX, missY, missX2, missY2 );
        if ( j > 0 )
        {
            if ( j == 2 )
            {
                g_soundSystem->PlaySound ( "rockhits",
                    missX - g_graphics->GetCenterX(),
                    missY - g_graphics->GetCenterY() );
            } else {
                g_soundSystem->PlaySound ( "rockhitw",
                    missX - g_graphics->GetCenterX(),
                    missY - g_graphics->GetCenterY() );
            }

            newX = (short)(cos ( m_angle * DIV360MULTPI ) * (d - 1) + m_X);
            newY = (short)(sin ( m_angle * DIV360MULTPI ) * (d - 1) + m_Y);

            if ( j != 2 )
                g_interface->ExplodeShrapnel ( m_player, newX, newY, 2.4, 150, 6, 24 );
            g_interface->GrenadeSmokeTrail ( newX, newY, 5 );

            m_expired = true;
        }
    }
}