X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=cl_screen.c;h=c3d42edbccf78212e4ba1eee1dbf178e2838757a;hp=861eed77ccf6b58959142ea896573e859b682d71;hb=e9916cf8bef5f8c2aa8017433c427db196308664;hpb=987777618ad4de550ec9b6d79570cf282eb31590 diff --git a/cl_screen.c b/cl_screen.c index 861eed77..c3d42edb 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -14,6 +14,7 @@ cvar_t scr_centertime = {0, "scr_centertime","2"}; cvar_t scr_showram = {CVAR_SAVE, "showram","1"}; cvar_t scr_showturtle = {CVAR_SAVE, "showturtle","0"}; cvar_t scr_showpause = {CVAR_SAVE, "showpause","1"}; +cvar_t scr_showbrand = {0, "showbrand","0"}; cvar_t scr_printspeed = {0, "scr_printspeed","8"}; cvar_t vid_conwidth = {CVAR_SAVE, "vid_conwidth", "640"}; cvar_t vid_conheight = {CVAR_SAVE, "vid_conheight", "480"}; @@ -58,7 +59,10 @@ static vec4_t string_colors[] = {0.0, 0.0, 1.0, 1.0}, // blue {0.0, 1.0, 1.0, 1.0}, // cyan {1.0, 0.0, 1.0, 1.0}, // magenta - {1.0, 1.0, 1.0, 1.0} // white + {1.0, 1.0, 1.0, 1.0}, // white + // [515]'s BX_COLOREDTEXT extension + {1.0, 1.0, 1.0, 0.5}, // half transparent + {0.5, 0.5, 0.5, 1.0} // half brightness // Black's color table //{1.0, 1.0, 1.0, 1.0}, //{1.0, 0.0, 0.0, 1.0}, @@ -88,9 +92,9 @@ void DrawQ_ColoredString( float x, float y, const char *text, int maxlen, float color = string_colors[colorindex]; if( maxlen < 1) - len = strlen( text ); + len = (int)strlen( text ); else - len = min( maxlen, (signed) strlen( text ) ); + len = min( maxlen, (int) strlen( text ) ); start = current = text; while( len > 0 ) { @@ -114,7 +118,7 @@ void DrawQ_ColoredString( float x, float y, const char *text, int maxlen, float do { colorindex = colorindex * 10 + (*current - '0'); // only read as long as it makes a valid index - if( colorindex >= STRING_COLORS_COUNT ) { + if( colorindex >= (int)STRING_COLORS_COUNT ) { // undo the last operation colorindex /= 10; break; @@ -124,7 +128,7 @@ void DrawQ_ColoredString( float x, float y, const char *text, int maxlen, float } while( len > 0 && '0' <= *current && *current <= '9' ); // set the color color = string_colors[colorindex]; - // we jump over the color tag + // we jump over the color tag start = current; } } @@ -196,6 +200,7 @@ void SCR_DrawCenterString (void) int l; int x, y; int remaining; + int color; // the finale prints the characters one at a time if (cl.intermission) @@ -211,6 +216,7 @@ void SCR_DrawCenterString (void) else y = 48; + color = -1; do { // scan the width of the line @@ -222,7 +228,7 @@ void SCR_DrawCenterString (void) { if (remaining < l) l = remaining; - DrawQ_String(x, y, start, l, 8, 8, 1, 1, 1, 1, 0); + DrawQ_ColoredString(x, y, start, l, 8, 8, 1, 1, 1, 1, 0, &color); remaining -= l; if (remaining <= 0) return; @@ -325,9 +331,61 @@ void SCR_DrawPause (void) DrawQ_Pic ((vid_conwidth.integer - pic->width)/2, (vid_conheight.integer - pic->height)/2, "gfx/pause", 0, 0, 1, 1, 1, 1, 0); } +/* +============== +SCR_DrawBrand +============== +*/ +void SCR_DrawBrand (void) +{ + cachepic_t *pic; + float x, y; + + if (!scr_showbrand.value) + return; + pic = Draw_CachePic ("gfx/brand", true); + switch ((int)scr_showbrand.value) + { + case 1: // bottom left + x = 0; + y = vid_conheight.integer - pic->height; + break; + case 2: // bottom centre + x = (vid_conwidth.integer - pic->width) / 2; + y = vid_conheight.integer - pic->height; + break; + case 3: // bottom right + x = vid_conwidth.integer - pic->width; + y = vid_conheight.integer - pic->height; + break; + case 4: // centre right + x = vid_conwidth.integer - pic->width; + y = (vid_conheight.integer - pic->height) / 2; + break; + case 5: // top right + x = vid_conwidth.integer - pic->width; + y = 0; + break; + case 6: // top centre + x = (vid_conwidth.integer - pic->width) / 2; + y = 0; + break; + case 7: // top left + x = 0; + y = 0; + break; + case 8: // centre left + x = 0; + y = (vid_conheight.integer - pic->height) / 2; + break; + default: + return; + } + DrawQ_Pic (x, y, "gfx/brand", 0, 0, 1, 1, 1, 1, 0); +} //============================================================================= @@ -430,7 +488,7 @@ void R_TimeReport(char *desc) t = (int) ((r_timereport_current - r_timereport_temp) * 1000000.0); dpsnprintf(tempbuf, sizeof(tempbuf), "%8i %s", t, desc); - length = strlen(tempbuf); + length = (int)strlen(tempbuf); while (length < 20) tempbuf[length++] = ' '; tempbuf[length] = 0; @@ -564,6 +622,7 @@ void CL_Screen_Init(void) Cvar_RegisterVariable (&scr_showram); Cvar_RegisterVariable (&scr_showturtle); Cvar_RegisterVariable (&scr_showpause); + Cvar_RegisterVariable (&scr_showbrand); Cvar_RegisterVariable (&scr_centertime); Cvar_RegisterVariable (&scr_printspeed); Cvar_RegisterVariable (&vid_conwidth); @@ -607,7 +666,7 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float s if (alpha < (1.0f / 255.0f)) return; if (maxlen < 1) - len = strlen(string); + len = (int)strlen(string); else for (len = 0;len < maxlen && string[len];len++); for (;len > 0 && string[0] == ' ';string++, x += scalex, len--); @@ -940,7 +999,7 @@ void SCR_CaptureVideo_EndVideo(void) // finish the wave file if (cl_capturevideo_soundfile) { - i = FS_Tell (cl_capturevideo_soundfile); + i = (int)FS_Tell (cl_capturevideo_soundfile); //"RIFF", (int) unknown (chunk size), "WAVE", //"fmt ", (int) 16 (chunk size), (short) format 1 (uncompressed PCM), (short) 2 channels, (int) unknown rate, (int) unknown bytes per second, (short) 4 bytes per sample (channels * bytes per channel), (short) 16 bits per channel //"data", (int) unknown (chunk size) @@ -1084,7 +1143,7 @@ void SCR_CaptureVideo_SoundFrame(qbyte *bufstereo16le, size_t length, int rate) if (!cl_capturevideo_soundfile) return; cl_capturevideo_soundrate = rate; - if (FS_Write (cl_capturevideo_soundfile, bufstereo16le, 4 * length) < 4 * length) + if (FS_Write (cl_capturevideo_soundfile, bufstereo16le, 4 * length) < (fs_offset_t)(4 * length)) { Cvar_SetValueQuick(&cl_capturevideo, 0); Con_Printf("video sound saving failed on frame %i, out of disk space? stopping video capture.\n", cl_capturevideo_frame); @@ -1405,6 +1464,8 @@ void CL_UpdateScreen(void) SCR_DrawConsole(); + SCR_DrawBrand(); + SCR_UpdateScreen(); }