Exemple #1
0
void CBitmapUi::DrawCurrentScreenState() const
{
	EScreenState currentScreenState = GetScreenState();

	switch(currentScreenState)
	{
	case eSS_InGameScreen:
		DrawCrosshair();
		break;

	case eSS_LoadingScreen:
		DrawFullscreenQuad(m_iTexLoadingScreen);
		break;

	case eSS_StartScreen:
		DrawFullscreenQuad(m_iTexStartScreen);
		break;

	case eSS_PausedScreen:
		DrawFullscreenQuad(m_iTexPauseScreen);
		break;

	default:
		assert(false);
		break;
	}
}
//-----------------------------------------------------------------------------
// Renders hud elements
//-----------------------------------------------------------------------------
void C_ObjectBaseMannedGun::DrawHudElements( void )
{
	GetHudAmmo()->SetPrimaryAmmo( m_nAmmoType, m_nAmmoCount );
	GetHudAmmo()->SetSecondaryAmmo( -1, -1 );

	// Let the plasma gun operator see a crosshair
	DrawCrosshair();
}
Exemple #3
0
//-----------------------------------------------------------------------------
// Purpose: This weapon is the active weapon, and it should now draw anything
//			it wants to. This gets called every frame.
//-----------------------------------------------------------------------------
void C_BaseCombatWeapon::Redraw()
{
	if ( g_pClientMode->ShouldDrawCrosshair() )
	{
		DrawCrosshair();
	}

	// ammo drawing has been moved into hud_ammo.cpp
}
Exemple #4
0
int C_3dCrossProc(ClientData cl, Tcl_Interp *interp, int argc, char **argv)
{
  WindowType theWindow = theWindowArray[atoi(argv[1])];
  DataType theData = theWindow->data;

  if (!(Is_Irr_Surf(theData)) && !(Is_Scatter(theData))) {
    DrawCrosshair(theWindow, atoi(argv[2]), atoi(argv[3]));
  }
  return TCL_OK;
}
Exemple #5
0
void GLVideo::UpdateScreen (DCanvas *canvas)
{
   if(palettechanged)
   {
	   extern void UpdateShaderPalette(SDL_Color *colors);
	   UpdateShaderPalette(newPalette);
	   palettechanged = false;
   }

	SDL_GL_SwapBuffers();
	// viewheight or viewwidth not the same as screen?
	if(screenw != realviewheight || screenh != realviewheight)
		glViewport(viewwindowx, screenh - (realviewheight + viewwindowy), realviewwidth, realviewheight);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

	// make textures transparent where they are black?
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0);

	// Switch to 3D
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	float aspect = (float)realviewwidth/realviewheight;
	float fov = 70.0;

	gluPerspective(fov, aspect, 0.08f, 100.0f);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	// Render doom level
	if(gamestate == GS_LEVEL && !automapactive)
		RenderWorld();

	// Switch to 2D
	glDisable(GL_DEPTH_TEST);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	glOrtho(0.0f, 1, 1, 0.0f, -1.0f, 1.0f);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	if(gamestate == GS_LEVEL && !automapactive)
	{
		// Draw player weapon
		DrawScreenSprites();

		// Draw crosshair
		DrawCrosshair();
	}

	// Render menu/console/automap over whole screen
	if(screenw != realviewwidth || screenh != realviewheight)
	{
		glViewport(0, 0, screenw, screenh);
	}

	// Draw automap
	if(automapactive)
		RenderAutomap();

	// Render view border
	extern void R_DrawViewBorder();
	R_DrawViewBorder();

	// Draw status bar
	if(gamestate == GS_LEVEL)
	if(screenw != realviewwidth || screenh != realviewheight)
	{
		glColor4f(0,1,0,1);
		glDisable(GL_TEXTURE_2D);
		extern int ST_X, ST_Y, ST_WIDTH, ST_HEIGHT;
		DrawQuad((float)ST_X/screenw, (float)ST_Y/screenh, (float)ST_WIDTH/screenw, (float)ST_HEIGHT/screenh);
	}

	// Draw status bar border

	// Draw player redscreen, berserk, pickup
//	DrawTint();

	// Render the grayscale+colormap result to a texture
	extern void RenderToTexture(size_t screenw, size_t screenh);
	RenderToTexture(screenw, screenh);

	// Shader will convert this into RGB output
	extern void RenderedTextureToScreen(size_t screenw, size_t screenh);
	RenderedTextureToScreen(screenw, screenh);

	// Console
	DrawConsole(screenw, screenh);

	// Menu
	DrawMenu();
}
Exemple #6
0
int CHudAmmo::Draw(float flTime)
{
	wrect_t nullrc;
	int a, x, y, r, g, b;
	int AmmoWidth;

	if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
		return 1;

	if ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
		return 1;

	// Draw Weapon Menu
	DrawWList(flTime);

	// Draw ammo pickup history
	gHR.DrawAmmoHistory( flTime );

	if (!(m_iFlags & HUD_ACTIVE))
		return 0;

	if (!m_pWeapon)
		return 0;

	if( gHUD.m_iFOV > 40 )
	{
		SetCrosshair( 0, nullrc, 0, 0, 0);
		DrawCrosshair(flTime, m_pWeapon->iId); // draw a dynamic crosshair
	}
	else
	{
		SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
	}

	WEAPON *pw = m_pWeapon; // shorthand

	// SPR_Draw Ammo
	if ((pw->iAmmoType < 0) && (pw->iAmmo2Type < 0))
		return 0;

	int iFlags = DHN_DRAWZERO; // draw 0 values

	AmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;

	a = (int) max( MIN_ALPHA, m_fFade );

	if (m_fFade > 0)
		m_fFade -= (gHUD.m_flTimeDelta * 20);

	DrawUtils::DrawUtils::UnpackRGB(r,g,b, RGB_YELLOWISH);

	DrawUtils::DrawUtils::ScaleColors(r, g, b, a );

	// Does this weapon have a clip?
	y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight/2;

	// Does weapon have any ammo at all?
	if (m_pWeapon->iAmmoType > 0)
	{
		int iIconWidth = m_pWeapon->rcAmmo.right - m_pWeapon->rcAmmo.left;
		
		if (pw->iClip >= 0)
		{
			// room for the number and the '|' and the current ammo
			
			x = ScreenWidth - (8 * AmmoWidth) - iIconWidth;
			x = DrawUtils::DrawHudNumber(x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b);

			int iBarWidth =  AmmoWidth/10;

			x += AmmoWidth/2;

			DrawUtils::UnpackRGB(r,g,b, RGB_YELLOWISH);

			// draw the | bar
			FillRGBA(x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a);

			x += iBarWidth + AmmoWidth/2;;

			// GL Seems to need this
			DrawUtils::ScaleColors(r, g, b, a );
			x = DrawUtils::DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b);


		}
		else
		{
			// SPR_Draw a bullets only line
			x = ScreenWidth - 4 * AmmoWidth - iIconWidth;
			x = DrawUtils::DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b);
		}

		// Draw the ammo Icon
		int iOffset = (m_pWeapon->rcAmmo.bottom - m_pWeapon->rcAmmo.top)/8;
		SPR_Set(m_pWeapon->hAmmo, r, g, b);
		SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo);
	}

	// Does weapon have seconday ammo?
	if (pw->iAmmo2Type > 0) 
	{
		int iIconWidth = m_pWeapon->rcAmmo2.right - m_pWeapon->rcAmmo2.left;

		// Do we have secondary ammo?
		if ((pw->iAmmo2Type != 0) && (gWR.CountAmmo(pw->iAmmo2Type) > 0))
		{
			y -= gHUD.m_iFontHeight + gHUD.m_iFontHeight/4;
			x = ScreenWidth - 4 * AmmoWidth - iIconWidth;
			x = DrawUtils::DrawHudNumber(x, y, iFlags|DHN_3DIGITS, gWR.CountAmmo(pw->iAmmo2Type), r, g, b);

			// Draw the ammo Icon
			SPR_Set(m_pWeapon->hAmmo2, r, g, b);
			int iOffset = (m_pWeapon->rcAmmo2.bottom - m_pWeapon->rcAmmo2.top)/8;
			SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo2);
		}
	}

	return 1;
}