Beispiel #1
0
//===============
//SCR_DrawRawString - Doesn't care about aligning. Returns drawn len.
// It can stop when reaching maximum width when a value has been parsed.
//===============
static int SCR_DrawRawString( int x, int y, const char *str, int maxwidth, struct mufont_s *font, vec4_t color )
{
	int xoffset = 0, yoffset = 0;
	vec4_t scolor;
	const char *s, *olds;
	int gc, colorindex;
	qwchar num;

	if( !str )
		return 0;

	if( !font )
		font = cls.fontSystemSmall;

	if( maxwidth < 0 )
		maxwidth = 0;

	Vector4Copy( color, scolor );

	s = str;

	while( s )
	{
		olds = s;
		gc = Q_GrabWCharFromColorString( &s, &num, &colorindex );
		if( gc == GRABCHAR_CHAR )
		{
			if( num == '\n' )
				break;
			if( num < ' ' )
				continue;
			if( num >= font->numchars || !( font->chars[num].height ) )
				num = REPLACEMENT_CHAR;

			if( maxwidth && ( ( xoffset + font->chars[num].width ) > maxwidth ) )
			{
				s = olds;
				break;
			}

			if( num != ' ' )
				R_DrawStretchPic( x+xoffset, y+yoffset, font->chars[num].width, font->chars[num].height,
			                  font->chars[num].s1, font->chars[num].t1, font->chars[num].s2, font->chars[num].t2,
			                  scolor, font->shader );

			xoffset += font->chars[num].width;
		}
		else if( gc == GRABCHAR_COLOR )
		{
			assert( ( unsigned )colorindex < MAX_S_COLORS );
			VectorCopy( color_table[colorindex], scolor );
		}
		else if( gc == GRABCHAR_END )
			break;
		else
			assert( 0 );
	}

	return ( s - str );
}
Beispiel #2
0
qboolean SCR_DrawCinematic (void)
{
	if (cl.cinematictime <= 0)
		return false;

	if (cin.isStaticPic) // Knightmare- HACK to show JPG endscreens
	{
		R_DrawStretchPic (0, 0, viddef.width, viddef.height, cin.picName, 1.0);
		return true;
	}

	// Knightmare- pause if reloading video
	if (cls.key_dest == key_menu || vid_ref->modified)
	{	// blank screen and pause if menu is up
		R_SetPalette(NULL);
		cl.cinematicpalette_active = false;
		return true;
	}

	if (!cl.cinematicpalette_active)
	{
		R_SetPalette(cl.cinematicpalette);
		cl.cinematicpalette_active = true;
	}

	if (!cin.pic)
		return true;

	// fix odd-colored lines at top and bottom of screen
	//R_DrawStretchRaw (0, 0, viddef.width, viddef.height,
	//	cin.width, cin.height, cin.pic);
	R_DrawStretchRaw (-2, -2, viddef.width +4, viddef.height +4,
		cin.width, cin.height, cin.pic);
	return true;
}
Beispiel #3
0
/*
 * =================
 * UI_Draw
 * =================
 */
void UI_Draw(void)
{
    if (cls.key_dest != key_menu)
    {
        return;
    }

    // dim everything behind it down
    if ((cl.cinematictime > 0) || (cls.state == ca_disconnected))
    {
        if (R_DrawFindPic("/gfx/ui/menu_background.pcx"))
        {
            R_DrawStretchPic(0, 0, viddef.width, viddef.height, "/gfx/ui/menu_background.pcx", 1.0);
        }
        else
        {
            R_DrawFill(0, 0, viddef.width, viddef.height, 0, 0, 0, 255);
        }
    }
    // ingame menu uses alpha
    else if (R_DrawFindPic("/gfx/ui/menu_background.pcx"))
    {
        R_DrawStretchPic(0, 0, viddef.width, viddef.height, "/gfx/ui/menu_background.pcx", menu_alpha->value);
    }
    else
    {
        R_DrawFill(0, 0, viddef.width, viddef.height, 0, 0, 0, (int)(menu_alpha->value * 255));
    }

    // Knigthmare- added Psychospaz's mouse support
    UI_RefreshCursorMenu();

    m_drawfunc();

    // delay playing the enter sound until after the
    // menu has been drawn, to avoid delay while
    // caching images
    if (m_entersound)
    {
        S_StartLocalSound(menu_in_sound);
        m_entersound = false;
    }

    // Knigthmare- added Psychospaz's mouse support
    //menu cursor for mouse usage :)
    UI_Draw_Cursor();
}
Beispiel #4
0
void SCR_DrawPlaque( void )
{
	int	levelshot;

	if(( cl_allow_levelshots->integer && !cls.changelevel ) || cl.background )
	{
		levelshot = GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE, NULL );
		GL_SetRenderMode( kRenderNormal );
		R_DrawStretchPic( 0, 0, scr_width->integer, scr_height->integer, 0, 0, 1, 1, levelshot );
		if( !cl.background ) CL_DrawHUD( CL_LOADING );
	}
}
Beispiel #5
0
//================
//SCR_DrawRawChar
//
//Draws one graphics character with 0 being transparent.
//It can be clipped to the top of the screen to allow the console to be
//smoothly scrolled off.
//================
void SCR_DrawRawChar( int x, int y, qwchar num, struct mufont_s *font, vec4_t color )
{
	if( !font )
		font = cls.fontSystemSmall;

	if( num <= ' ' )
		return;
	if( num >= font->numchars || !( font->chars[num].height ) )
		num = REPLACEMENT_CHAR;

	if( y <= -font->fontheight )
		return; // totally off screen

	R_DrawStretchPic( x, y, font->chars[num].width, font->fontheight,
	                  font->chars[num].s1, font->chars[num].t1, font->chars[num].s2, font->chars[num].t2,
	                  color, font->shader );
}
Beispiel #6
0
//=============
//SCR_DrawFillRect
//
//Fills a box of pixels with a single color
//=============
void SCR_DrawFillRect( int x, int y, int w, int h, vec4_t color )
{
	R_DrawStretchPic( x, y, w, h, 0, 0, 1, 1, color, cls.whiteShader );
}
Beispiel #7
0
static void SCR_DrawClampChar( int x, int y, qwchar num, int xmin, int ymin, int xmax, int ymax, struct mufont_s *font, vec4_t color )
{
	float pixelsize;
	float s1, s2, t1, t2;
	int sx, sy, sw, sh;
	int offset;

	if( !font )
		font = cls.fontSystemSmall;

	if( num <= ' ' )
		return;
	if( num >= font->numchars || !( font->chars[num].height ) )
		num = REPLACEMENT_CHAR;

	// ignore if completely out of the drawing space
	if( y + font->fontheight <= ymin || y >= ymax ||
	    x + font->chars[num].width <= xmin || x >= xmax )
		return;

	pixelsize = 1.0f / font->imageheight;

	s1 = font->chars[num].s1;
	t1 = font->chars[num].t1;
	s2 = font->chars[num].s2;
	t2 = font->chars[num].t2;

	sx = x;
	sy = y;
	sw = font->chars[num].width;
	sh = font->fontheight;

	// clamp xmin
	if( x < xmin && x + font->chars[num].width >= xmin )
	{
		offset = xmin - x;
		if( offset )
		{
			sx += offset;
			sw -= offset;
			s1 += ( pixelsize * offset );
		}
	}

	// clamp ymin
	if( y < ymin && y + font->chars[num].height >= ymin )
	{
		offset = ymin - y;
		if( offset )
		{
			sy += offset;
			sh -= offset;
			t1 += ( pixelsize * offset );
		}
	}

	// clamp xmax
	if( x < xmax && x + font->chars[num].width >= xmax )
	{
		offset = ( x + font->chars[num].width ) - xmax;
		if( offset != 0 )
		{
			sw -= offset;
			s2 -= ( pixelsize * offset );
		}
	}

	// clamp ymax
	if( y < ymax && y + font->chars[num].height >= ymax )
	{
		offset = ( y + font->chars[num].height ) - ymax;
		if( offset != 0 )
		{
			sh -= offset;
			t2 -= ( pixelsize * offset );
		}
	}

	R_DrawStretchPic( sx, sy, sw, sh, s1, t1, s2, t2, color, font->shader );
}