From 15498207a70b9a172aa4a0fe2844a5f4522a6740 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Wed, 30 Mar 2011 17:34:37 +0000 Subject: [PATCH] replace Draw_Fill/Draw_FillRGB -> Draw_FillBlock git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3758 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_screen.c | 28 +++++++++++++++--------- engine/client/cl_ui.c | 2 -- engine/client/console.c | 5 +++-- engine/client/m_items.c | 4 +++- engine/client/m_master.c | 45 ++++++++++++++++++++++++--------------- engine/client/merged.h | 2 ++ engine/client/r_2d.c | 6 +++--- engine/client/sbar.c | 45 ++++++++++++++++++++++++++------------- engine/gl/gl_draw.c | 1 - 9 files changed, 87 insertions(+), 51 deletions(-) diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 082f0692e..364a3382e 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -1480,13 +1480,17 @@ void SCR_DrawLoading (void) sizex = current_loading_size * 192 / total_loading_size; if (loading_stage == LS_SERVER) { - Draw_FillRGB(x, y, sizex, 16, 1.0, 0.0, 0.0); - Draw_FillRGB(x+sizex, y, 192-sizex, 16, 0.0, 0.0, 0.0); + Draw_ImageColours(1.0, 0.0, 0.0, 1.0); + Draw_FillBlock(x, y, sizex, 16); + Draw_ImageColours(0.0, 0.0, 0.0, 1.0); + Draw_FillBlock(x+sizex, y, 192-sizex, 16); } else { - Draw_FillRGB(x, y, sizex, 16, 1.0, 1.0, 0.0); - Draw_FillRGB(x+sizex, y, 192-sizex, 16, 1.0, 0.0, 0.0); + Draw_ImageColours(1.0, 1.0, 0.0, 1.0); + Draw_FillBlock(x, y, sizex, 16); + Draw_ImageColours(1.0, 0.0, 0.0, 1.0); + Draw_FillBlock(x+sizex, y, 192-sizex, 16); } Draw_FunString(x+8, y+4, va("Loading %s... %i%%", @@ -1522,18 +1526,22 @@ void SCR_DrawLoading (void) else count = 106; - Draw_Fill (offset+42, 87, count, 1, 136); - Draw_Fill (offset+42, 87+1, count, 4, 138); - Draw_Fill (offset+42, 87+5, count, 1, 136); + Draw_ImagePaletteColour (136, 1.0); + Draw_FillBlock (offset+42, 87, count, 1); + Draw_FillBlock (offset+42, 87+5, count, 1); + Draw_ImagePaletteColour (138, 1.0); + Draw_FillBlock (offset+42, 87+1, count, 4); if (loading_stage == LS_SERVER) count = size; else count = 0; - Draw_Fill (offset+42, 97, count, 1, 168); - Draw_Fill (offset+42, 97+1, count, 4, 170); - Draw_Fill (offset+42, 97+5, count, 1, 168); + Draw_ImagePaletteColour(168, 1.0); + Draw_FillBlock (offset+42, 97, count, 1); + Draw_FillBlock (offset+42, 97+5, count, 1); + Draw_ImagePaletteColour(170, 1.0); + Draw_FillBlock (offset+42, 97+1, count, 4); y = 104; } diff --git a/engine/client/cl_ui.c b/engine/client/cl_ui.c index 232fc629b..23493b30f 100644 --- a/engine/client/cl_ui.c +++ b/engine/client/cl_ui.c @@ -282,9 +282,7 @@ static vm_t *uivm; static char *scr_centerstring; void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic); -void SWDraw_Image (float xp, float yp, float wp, float hp, float s1, float t1, float s2, float t2, qpic_t *pic); char *Get_Q2ConfigString(int i); -void SWDraw_ImageColours (float r, float g, float b, float a); #define MAX_PINGREQUESTS 16 diff --git a/engine/client/console.c b/engine/client/console.c index 0824713cd..6bacfe961 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -1378,8 +1378,9 @@ void Con_DrawConsole (int lines, qboolean noback) else selstartoffset = 0; } - - Draw_Fill((sstart*vid.width)/vid.rotpixelwidth, (y*vid.height)/vid.rotpixelheight, ((send - sstart)*vid.width)/vid.rotpixelwidth, (Font_CharHeight()*vid.height)/vid.rotpixelheight, 0); + Draw_ImagePaletteColour(0, 1.0); + Draw_FillBlock((sstart*vid.width)/vid.rotpixelwidth, (y*vid.height)/vid.rotpixelheight, ((send - sstart)*vid.width)/vid.rotpixelwidth, (Font_CharHeight()*vid.height)/vid.rotpixelheight); + Draw_ImageColours(1.0, 1.0, 1.0, 1.0); } } } diff --git a/engine/client/m_items.c b/engine/client/m_items.c index a17b116b6..a4c9254f2 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -24,7 +24,9 @@ void Draw_TextBox (int x, int y, int width, int lines) if (!p) //assume none exist { - Draw_FillRGB(x, y, width + 16, 8 * (2 + lines), 0.0, 0.0, 0.0); + Draw_ImageColours(0.0, 0.0, 0.0, 1.0); + Draw_FillBlock(x, y, width + 16, 8 * (2 + lines)); + Draw_ImageColours(1.0, 1.0, 1.0, 1.0); return; } diff --git a/engine/client/m_master.c b/engine/client/m_master.c index 36004f736..e4cfe7853 100644 --- a/engine/client/m_master.c +++ b/engine/client/m_master.c @@ -237,8 +237,11 @@ void M_DrawOneServer (int inity) { if (y>=miny) { - Draw_Fill (12, y, 28, 4, Sbar_ColorForMap(selectedserver.detail->players[i].topc)); - Draw_Fill (12, y+4, 28, 4, Sbar_ColorForMap(selectedserver.detail->players[i].botc)); + Draw_ImagePaletteColour(Sbar_ColorForMap(selectedserver.detail->players[i].topc), 1.0); + Draw_FillBlock (12, y, 28, 4); + Draw_ImagePaletteColour(Sbar_ColorForMap(selectedserver.detail->players[i].botc), 1.0); + Draw_FillBlock (12, y+4, 28, 4); + Draw_ImageColours(1.0, 1.0, 1.0, 1.0); NM_PrintWhite (12, y, va("%3i", selectedserver.detail->players[i].frags)); NM_Print (12+8*4, y, selectedserver.detail->players[i].name); } @@ -413,7 +416,10 @@ void M_DrawServerList(void) // make sure we have a highlighted background if (highlight >= 0) - Draw_FillRGB(8, y, vid.width-16, 8, consolecolours[highlight].fr, consolecolours[highlight].fg, consolecolours[highlight].fb); + { + Draw_ImageColours(consolecolours[highlight].fr, consolecolours[highlight].fg, consolecolours[highlight].fb, 1.0); + Draw_FillBlock(8, y, vid.width-16, 8); + } if (sb_showtimelimit.value) x = M_AddColumn(x, y, va("%i", server->tl), 3, colour, highlight); //time limit @@ -909,7 +915,8 @@ void SL_DrawColumnTitle (int *x, int y, int xlen, int mx, char *str, qboolean re if (mx >= xmin && !(*filldraw)) { *filldraw = true; - Draw_FillRGB(xmin, y, xlen, 8, (sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08); + Draw_ImageColours((sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08, 1.0); + Draw_FillBlock(xmin, y, xlen, 8); } Draw_FunStringWidth(xmin, y, str, xlen); @@ -1055,24 +1062,25 @@ void SL_ServerDraw (int x, int y, menucustom_t *ths, menu_t *menu) stype = flagstoservertype(si->special); if (thisone == info->selectedpos) { - Draw_FillRGB(0, y, ths->common.width, 8, + Draw_ImageColours( serverhighlight[(int)stype][0], serverhighlight[(int)stype][1], - serverhighlight[(int)stype][2]); + serverhighlight[(int)stype][2], + 1.0); } else if (thisone == info->scrollpos + (mousecursor_y-16)/8 && mousecursor_x < x) - Draw_FillRGB(0, y, ths->common.width, 8, (sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08); + Draw_ImageColours((sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08, 1.0); else if (selectedserver.inuse && NET_CompareAdr(si->adr, selectedserver.adr)) - { - Draw_FillRGB(0, y, ths->common.width, 8, ((sin(realtime*4.4)*0.25)+0.5) * 0.5, ((sin(realtime*4.4)*0.25)+0.5)*0.5, 0.08*0.5); - } + Draw_ImageColours(((sin(realtime*4.4)*0.25)+0.5) * 0.5, ((sin(realtime*4.4)*0.25)+0.5)*0.5, 0.08*0.5, 1.0); else { - Draw_FillRGB(0, y, ths->common.width, 8, + Draw_ImageColours( serverbackcolor[(int)stype * 2 + (thisone & 1)][0], serverbackcolor[(int)stype * 2 + (thisone & 1)][1], - serverbackcolor[(int)stype * 2 + (thisone & 1)][2]); + serverbackcolor[(int)stype * 2 + (thisone & 1)][2], + 1.0); } + Draw_FillBlock(0, y, ths->common.width, 8); if (sb_showtimelimit.value) {Draw_FunStringWidth((x-3*8), y, va("%i", si->tl), 3*8); x-=4*8;} if (sb_showfraglimit.value) {Draw_FunStringWidth((x-3*8), y, va("%i", si->fl), 3*8); x-=4*8;} @@ -1238,8 +1246,10 @@ void SL_ServerPlayer (int x, int y, menucustom_t *ths, menu_t *menu) if ((int)ths->data < selectedserver.detail->numplayers) { int i = (int)ths->data; - Draw_Fill (x, y, 28, 4, Sbar_ColorForMap(selectedserver.detail->players[i].topc)); - Draw_Fill (x, y+4, 28, 4, Sbar_ColorForMap(selectedserver.detail->players[i].botc)); + Draw_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].topc), 1.0); + Draw_FillBlock (x, y, 28, 4); + Draw_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].botc), 1.0); + Draw_FillBlock (x, y+4, 28, 4); NM_PrintWhite (x, y, va("%3i", selectedserver.detail->players[i].frags)); Draw_FunStringWidth (x+28, y, selectedserver.detail->players[i].name, 12*8); @@ -1273,12 +1283,13 @@ void SL_SliderDraw (int x, int y, menucustom_t *ths, menu_t *menu) } else { - - Draw_FillRGB(x, y, ths->common.width, ths->common.height, 0.1, 0.1, 0.2); + Draw_ImageColours(0.1, 0.1, 0.2, 1.0); + Draw_FillBlock(x, y, ths->common.width, ths->common.height); y += ((info->scrollpos) / ((float)info->numslots - info->visibleslots)) * (ths->common.height-8); - Draw_FillRGB(x, y, 8, 8, 0.35, 0.35, 0.55); + Draw_ImageColours(0.35, 0.35, 0.55, 1.0); + Draw_FillBlock(x, y, 8, 8); } if (info->sliderpressed) diff --git a/engine/client/merged.h b/engine/client/merged.h index 1ae403cd4..ee44b4c87 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -78,6 +78,8 @@ extern void (*Draw_Image) (float x, float y, float w, float h, float s1, f extern void (*Draw_ImageColours) (float r, float g, float b, float a); void R2D_FillBlock(int x, int y, int w, int h); #define Draw_FillBlock R2D_FillBlock +void R2D_ImagePaletteColour(unsigned int i, float a); +#define Draw_ImagePaletteColour R2D_ImagePaletteColour extern void (*R_Init) (void); extern void (*R_DeInit) (void); diff --git a/engine/client/r_2d.c b/engine/client/r_2d.c index fdb88fbb8..68917c96b 100644 --- a/engine/client/r_2d.c +++ b/engine/client/r_2d.c @@ -229,9 +229,9 @@ void R2D_ImageColours(float r, float g, float b, float a) } void R2D_ImagePaletteColour(unsigned int i, float a) { - draw_mesh_colors[0][0] = host_basepal[i*3+0]/255; - draw_mesh_colors[0][1] = host_basepal[i*3+1]/255; - draw_mesh_colors[0][2] = host_basepal[i*3+2]/255; + draw_mesh_colors[0][0] = host_basepal[i*3+0]/255.0; + draw_mesh_colors[0][1] = host_basepal[i*3+1]/255.0; + draw_mesh_colors[0][2] = host_basepal[i*3+2]/255.0; draw_mesh_colors[0][3] = a; Vector4Copy(draw_mesh_colors[0], draw_mesh_colors[1]); Vector4Copy(draw_mesh_colors[0], draw_mesh_colors[2]); diff --git a/engine/client/sbar.c b/engine/client/sbar.c index e5d46ffd1..9656496f7 100644 --- a/engine/client/sbar.c +++ b/engine/client/sbar.c @@ -1038,24 +1038,26 @@ void Sbar_FillPC (int x, int y, int w, int h, unsigned int pcolour) { if (pcolour >= 16) { - Draw_FillRGB (x, y, w, h, ((pcolour&0xff0000)>>16)/255.0f, ((pcolour&0xff00)>>8)/255.0f, (pcolour&0xff)/255.0f); + Draw_ImageColours (((pcolour&0xff0000)>>16)/255.0f, ((pcolour&0xff00)>>8)/255.0f, (pcolour&0xff)/255.0f, 1.0); + Draw_FillBlock (x, y, w, h); } else { - pcolour = Sbar_ColorForMap(pcolour); - Draw_Fill (x, y, w, h, pcolour); + Draw_ImagePaletteColour(Sbar_ColorForMap(pcolour), 1.0); + Draw_FillBlock (x, y, w, h); } } static void Sbar_FillPCDark (int x, int y, int w, int h, unsigned int pcolour) { if (pcolour >= 16) { - Draw_FillRGB (x, y, w, h, (pcolour&0xff)/1024.0f, ((pcolour&0xff00)>>8)/1024.0f, ((pcolour&0xff0000)>>17)/1024.0f); + Draw_ImageColours (((pcolour&0xff0000)>>16)/1024.0f, ((pcolour&0xff00)>>8)/1024.0f, (pcolour&0xff)/1024.0f, 1.0); + Draw_FillBlock (x, y, w, h); } else { - pcolour = Sbar_ColorForMap(pcolour)-1; - Draw_Fill (x, y, w, h, pcolour); + Draw_ImagePaletteColour(Sbar_ColorForMap(pcolour)-1, 1.0); + Draw_FillBlock (x, y, w, h); } } @@ -1667,6 +1669,7 @@ void Sbar_DrawFrags (void) } x+=4; } + Draw_ImageColours(1.0, 1.0, 1.0, 1.0); } //============================================================================= @@ -2829,10 +2832,12 @@ void Sbar_DeathmatchOverlay (int start) if (scr_scoreboard_newstyle.ival) { // Electro's scoreboard eyecandy: Draw top border - Draw_Fill(startx - 3, y - 1, rank_width - 1, 1, 0); + Draw_ImagePaletteColour (0, 1.0); + Draw_FillBlock(startx - 3, y - 1, rank_width - 1, 1); // Electro's scoreboard eyecandy: Draw the title row background - Draw_Fill(startx - 2, y, rank_width - 3, 9, 1); + Draw_ImagePaletteColour (1, 1.0); + Draw_FillBlock(startx - 2, y, rank_width - 3, 9); } x = startx; @@ -2863,13 +2868,14 @@ if (showcolumns & (1<= vid.height-10) // we ran over the screen size, squish largegame = true; + + Draw_ImageColours(1.0, 1.0, 1.0, 1.0); } void Sbar_ChatModeOverlay(void) diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index b59e41361..ffa3a5f36 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -32,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //#define GL_USE8BITTEX -void GLDraw_ImageColours(float r, float g, float b, float a); static void GL_Upload32 (char *name, unsigned *data, int width, int height, unsigned int flags); static void GL_Upload32_BGRA (char *name, unsigned *data, int width, int height, unsigned int flags); static void GL_Upload24BGR_Flip (char *name, qbyte *framedata, int inwidth, int inheight, unsigned int flags);