From a0f34820937470736ad8a7261396427973605658 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Thu, 31 Mar 2011 01:14:01 +0000 Subject: [PATCH] change out "renderer specific" draw_* calls for r2d_* and trim rendererinfo struct git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3760 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_cg.c | 12 ++- engine/client/cl_plugin.inc | 78 ++++------------- engine/client/cl_screen.c | 88 +++++++++---------- engine/client/cl_ui.c | 7 +- engine/client/clhl_game.c | 12 +-- engine/client/console.c | 8 +- engine/client/m_items.c | 104 +++++++++++----------- engine/client/m_master.c | 68 +++++++-------- engine/client/m_mp3.c | 8 +- engine/client/m_multi.c | 16 ++-- engine/client/m_script.c | 2 +- engine/client/m_single.c | 2 +- engine/client/menu.c | 30 +++---- engine/client/merged.h | 54 ++++-------- engine/client/pr_menu.c | 26 +++--- engine/client/r_2d.c | 4 +- engine/client/renderer.c | 44 ---------- engine/client/sbar.c | 168 ++++++++++++++++++------------------ engine/client/textedit.c | 2 +- engine/common/fs.c | 11 --- engine/common/plugin.c | 9 +- engine/d3d/vid_d3d.c | 31 +------ engine/gl/gl_draw.c | 80 +---------------- engine/gl/gl_draw.h | 4 - engine/gl/gl_font.c | 2 - engine/gl/gl_screen.c | 9 +- engine/gl/gl_shader.c | 1 + engine/gl/gl_shadow.c | 6 +- engine/gl/gl_vidcommon.c | 15 ---- 29 files changed, 324 insertions(+), 577 deletions(-) diff --git a/engine/client/cl_cg.c b/engine/client/cl_cg.c index a24075558..546c0b52e 100644 --- a/engine/client/cl_cg.c +++ b/engine/client/cl_cg.c @@ -446,8 +446,6 @@ int CG_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projecti return numtris; } - -void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic); int VM_LerpTag(void *out, model_t *model, int f1, int f2, float l2, char *tagname); @@ -803,14 +801,14 @@ static qintptr_t CG_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con { float *f = VM_POINTER(arg[0]); if (f) - Draw_ImageColours(f[0], f[1], f[2], f[3]); + R2D_ImageColours(f[0], f[1], f[2], f[3]); else - Draw_ImageColours(1, 1, 1, 1); + R2D_ImageColours(1, 1, 1, 1); } break; case CG_R_DRAWSTRETCHPIC: - Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), VM_FROMSHANDLE(VM_LONG(arg[8]))); + R2D_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), VM_FROMSHANDLE(VM_LONG(arg[8]))); break; case CG_R_LERPTAG: //Lerp tag... @@ -1099,7 +1097,7 @@ int CG_Refresh(void) time = ccs.serverTime; VM_Call(cgvm, CG_DRAW_ACTIVE_FRAME, time, 0, false); - Draw_ImageColours(1, 1, 1, 1); + R2D_ImageColours(1, 1, 1, 1); return true; } @@ -1127,7 +1125,7 @@ void CG_Start (void) return; } - if (!Draw_SafeCachePic) //no renderer loaded + if (!R2D_SafeCachePic) //no renderer loaded { CG_Stop(); return; diff --git a/engine/client/cl_plugin.inc b/engine/client/cl_plugin.inc index 481042dc3..a1a8ac7ec 100644 --- a/engine/client/cl_plugin.inc +++ b/engine/client/cl_plugin.inc @@ -109,15 +109,10 @@ qintptr_t VARGS Plug_Draw_LoadImage(void *offset, quintptr_t mask, const qintptr if (qrenderer != QR_NONE) { - if (fromwad && Draw_SafePicFromWad) - pic = Draw_SafePicFromWad(name); + if (fromwad) + pic = R2D_SafePicFromWad(name); else - { - if (Draw_SafeCachePic) - pic = Draw_SafeCachePic(name); - else - pic = NULL; - } + pic = R2D_SafeCachePic(name); } else pic = NULL; @@ -140,12 +135,9 @@ void Plug_DrawReloadImages(void) continue; } - if (Draw_SafePicFromWad) - pluginimagearray[i].pic = Draw_SafePicFromWad(pluginimagearray[i].name); - else if (Draw_SafeCachePic) - pluginimagearray[i].pic = Draw_SafeCachePic(pluginimagearray[i].name); - else - pluginimagearray[i].pic = NULL; + pluginimagearray[i].pic = R2D_SafePicFromWad(pluginimagearray[i].name); + //pluginimagearray[i].pic = R2D_SafeCachePic(pluginimagearray[i].name); + //pluginimagearray[i].pic = NULL; } } @@ -163,15 +155,13 @@ void Plug_FreePlugImages(plugin_t *plug) } } -//int Draw_Image (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t image) +//int R2D_Image (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t image) qintptr_t VARGS Plug_Draw_Image(void *offset, quintptr_t mask, const qintptr_t *arg) { mpic_t *pic; int i; if (qrenderer == QR_NONE) return 0; - if (!Draw_Image) - return 0; i = VM_LONG(arg[8]); if (i <= 0 || i > pluginimagearraylen) @@ -186,12 +176,12 @@ qintptr_t VARGS Plug_Draw_Image(void *offset, quintptr_t mask, const qintptr_t * return 0; //wasn't loaded. else { - pic = Draw_SafeCachePic(pluginimagearray[i].name); + pic = R2D_SafeCachePic(pluginimagearray[i].name); if (!pic) return -1; } - Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), pic); + R2D_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), pic); return 1; } //x1,y1,x2,y2 @@ -224,7 +214,7 @@ qintptr_t VARGS Plug_Draw_Character(void *offset, quintptr_t mask, const qintptr Font_EndString(font_conchar); return 0; } -void (D3D_Draw_Fill_Colours) (int x, int y, int w, int h); + qintptr_t VARGS Plug_Draw_Fill(void *offset, quintptr_t mask, const qintptr_t *arg) { float x, y, width, height; @@ -234,59 +224,27 @@ qintptr_t VARGS Plug_Draw_Fill(void *offset, quintptr_t mask, const qintptr_t *a y = VM_FLOAT(arg[1]); width = VM_FLOAT(arg[2]); height = VM_FLOAT(arg[3]); - switch(qrenderer) //FIXME: I don't want qrenderer seen outside the refresh - { -#ifdef GLQUAKE - case QR_OPENGL: - qglDisable(GL_TEXTURE_2D); - qglBegin(GL_QUADS); - qglVertex2f(x, y); - qglVertex2f(x+width, y); - qglVertex2f(x+width, y+height); - qglVertex2f(x, y+height); - qglEnd(); - qglEnable(GL_TEXTURE_2D); - return 1; -#endif - case QR_DIRECT3D: -// D3D_Draw_Fill_Colours(x, y, width, height); - break; - default: - break; - } + + R2D_FillBlock(x, y, width, height); return 0; } qintptr_t VARGS Plug_Draw_ColourP(void *offset, quintptr_t mask, const qintptr_t *arg) { - qbyte *pal = host_basepal + VM_LONG(arg[0])*3; - if (arg[0]<0 || arg[0]>255) return false; - if (Draw_ImageColours) - { - Draw_ImageColours(pal[0]/255.0f, pal[1]/255.0f, pal[2]/255.0f, 1); - return 1; - } - return 0; + R2D_ImagePaletteColour(arg[0], 1); + return 1; } qintptr_t VARGS Plug_Draw_Colour3f(void *offset, quintptr_t mask, const qintptr_t *arg) { - if (Draw_ImageColours) - { - Draw_ImageColours(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), 1); - return 1; - } - return 0; + R2D_ImageColours(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), 1); + return 1; } qintptr_t VARGS Plug_Draw_Colour4f(void *offset, quintptr_t mask, const qintptr_t *arg) { - if (Draw_ImageColours) - { - Draw_ImageColours(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3])); - return 1; - } - return 0; + R2D_ImageColours(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3])); + return 1; } diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 364a3382e..376fe5405 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -424,7 +424,7 @@ void SCR_EraseCenterString (void) } y = vid.height>>1; - Draw_TileClear (0, y, vid.width, min(8*p->erase_lines, vid.height - y - 1)); + R2D_TileClear (0, y, vid.width, min(8*p->erase_lines, vid.height - y - 1)); } } @@ -577,13 +577,13 @@ void SCR_DrawCursor(int prydoncursornum) extern int mousecursor_x, mousecursor_y; mpic_t *p; if (!*cl_cursor.string || prydoncursornum>1) - p = Draw_SafeCachePic(va("gfx/prydoncursor%03i.lmp", prydoncursornum)); + p = R2D_SafeCachePic(va("gfx/prydoncursor%03i.lmp", prydoncursornum)); else - p = Draw_SafeCachePic(cl_cursor.string); + p = R2D_SafeCachePic(cl_cursor.string); if (p) { - Draw_ImageColours(1, 1, 1, 1); - Draw_Image(mousecursor_x-cl_cursorbias.value, mousecursor_y-cl_cursorbias.value, cl_cursorsize.value, cl_cursorsize.value, 0, 0, 1, 1, p); + R2D_ImageColours(1, 1, 1, 1); + R2D_Image(mousecursor_x-cl_cursorbias.value, mousecursor_y-cl_cursorbias.value, cl_cursorsize.value, cl_cursorsize.value, 0, 0, 1, 1, p); // Draw_TransPic(mousecursor_x-4, mousecursor_y-4, p); } else @@ -683,10 +683,10 @@ void SCR_ShowPics_Draw(void) if (failed) continue; - p = Draw_SafeCachePic(sp->picname); + p = R2D_SafeCachePic(sp->picname); if (!p) continue; - Draw_ScalePic(x, y, p->width, p->height, p); + R2D_ScalePic(x, y, p->width, p->height, p); } } @@ -1123,8 +1123,8 @@ void SCR_Init (void) Cmd_AddRemCommand ("sizeup",SCR_SizeUp_f); Cmd_AddRemCommand ("sizedown",SCR_SizeDown_f); - scr_net = Draw_SafePicFromWad ("net"); - scr_turtle = Draw_SafePicFromWad ("turtle"); + scr_net = R2D_SafePicFromWad ("net"); + scr_turtle = R2D_SafePicFromWad ("turtle"); scr_initialized = true; } @@ -1164,7 +1164,7 @@ void SCR_DrawTurtle (void) if (count < 3) return; - Draw_ScalePic (scr_vrect.x, scr_vrect.y, 64, 64, scr_turtle); + R2D_ScalePic (scr_vrect.x, scr_vrect.y, 64, 64, scr_turtle); } /* @@ -1179,7 +1179,7 @@ void SCR_DrawNet (void) if (cls.demoplayback || !scr_net) return; - Draw_ScalePic (scr_vrect.x+64, scr_vrect.y, 64, 64, scr_net); + R2D_ScalePic (scr_vrect.x+64, scr_vrect.y, 64, 64, scr_net); } void SCR_StringXY(char *str, float x, float y) @@ -1410,10 +1410,10 @@ void SCR_DrawPause (void) if (key_dest == key_menu) return; - pic = Draw_SafeCachePic ("gfx/pause.lmp"); + pic = R2D_SafeCachePic ("gfx/pause.lmp"); if (pic) { - Draw_ScalePic ( (vid.width - pic->width)/2, + R2D_ScalePic ( (vid.width - pic->width)/2, (vid.height - 48 - pic->height)/2, pic->width, pic->height, pic); } else @@ -1456,12 +1456,12 @@ void SCR_DrawLoading (void) if (qdepth < h2depth || h2depth > 0xffffff) { //quake files - pic = Draw_SafeCachePic ("gfx/loading.lmp"); + pic = R2D_SafeCachePic ("gfx/loading.lmp"); if (pic) { x = (vid.width - pic->width)/2; y = (vid.height - 48 - pic->height)/2; - Draw_ScalePic (x, y, pic->width, pic->height, pic); + R2D_ScalePic (x, y, pic->width, pic->height, pic); x = (vid.width/2) - 96; y += pic->height + 8; } @@ -1480,17 +1480,17 @@ void SCR_DrawLoading (void) sizex = current_loading_size * 192 / total_loading_size; if (loading_stage == LS_SERVER) { - 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); + R2D_ImageColours(1.0, 0.0, 0.0, 1.0); + R2D_FillBlock(x, y, sizex, 16); + R2D_ImageColours(0.0, 0.0, 0.0, 1.0); + R2D_FillBlock(x+sizex, y, 192-sizex, 16); } else { - 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); + R2D_ImageColours(1.0, 1.0, 0.0, 1.0); + R2D_FillBlock(x, y, sizex, 16); + R2D_ImageColours(1.0, 0.0, 0.0, 1.0); + R2D_FillBlock(x+sizex, y, 192-sizex, 16); } Draw_FunString(x+8, y+4, va("Loading %s... %i%%", @@ -1502,7 +1502,7 @@ void SCR_DrawLoading (void) } else { //hexen2 files - pic = Draw_SafeCachePic ("gfx/menu/loading.lmp"); + pic = R2D_SafeCachePic ("gfx/menu/loading.lmp"); if (pic) { int size, count, offset; @@ -1511,7 +1511,7 @@ void SCR_DrawLoading (void) return; offset = (vid.width - pic->width)/2; - Draw_ScalePic (offset, 0, pic->width, pic->height, pic); + R2D_ScalePic (offset, 0, pic->width, pic->height, pic); if (loading_stage == LS_NONE) return; @@ -1526,22 +1526,22 @@ void SCR_DrawLoading (void) else count = 106; - 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); + R2D_ImagePaletteColour (136, 1.0); + R2D_FillBlock (offset+42, 87, count, 1); + R2D_FillBlock (offset+42, 87+5, count, 1); + R2D_ImagePaletteColour (138, 1.0); + R2D_FillBlock (offset+42, 87+1, count, 4); if (loading_stage == LS_SERVER) count = size; else count = 0; - 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); + R2D_ImagePaletteColour(168, 1.0); + R2D_FillBlock (offset+42, 97, count, 1); + R2D_FillBlock (offset+42, 97+5, count, 1); + R2D_ImagePaletteColour(170, 1.0); + R2D_FillBlock (offset+42, 97+1, count, 4); y = 104; } @@ -1635,7 +1635,7 @@ void SCR_ImageName (char *mapname) #ifdef GLQUAKE if (qrenderer == QR_OPENGL) { - if (!Draw_SafeCachePic (levelshotname)) + if (!R2D_SafeCachePic (levelshotname)) { *levelshotname = '\0'; return; @@ -2145,20 +2145,20 @@ void SCR_TileClear (void) if (scr_vrect.x > 0) { // left - Draw_TileClear (0, 0, scr_vrect.x, vid.height); + R2D_TileClear (0, 0, scr_vrect.x, vid.height); // right - Draw_TileClear (scr_vrect.x + scr_vrect.width, 0, + R2D_TileClear (scr_vrect.x + scr_vrect.width, 0, vid.width - scr_vrect.x + scr_vrect.width, vid.height); } if (scr_vrect.y > 0 || scr_vrect.height != vid.height) { // top - Draw_TileClear (scr_vrect.x, 0, + R2D_TileClear (scr_vrect.x, 0, scr_vrect.width, scr_vrect.y); // bottom - Draw_TileClear (scr_vrect.x, + R2D_TileClear (scr_vrect.x, scr_vrect.y + scr_vrect.height, scr_vrect.width, vid.height); @@ -2170,20 +2170,20 @@ void SCR_TileClear (void) if (scr_vrect.x > 0) { // left - Draw_TileClear (0, 0, scr_vrect.x, vid.height - sb_lines); + R2D_TileClear (0, 0, scr_vrect.x, vid.height - sb_lines); // right - Draw_TileClear (scr_vrect.x + scr_vrect.width, 0, + R2D_TileClear (scr_vrect.x + scr_vrect.width, 0, vid.width - scr_vrect.x + scr_vrect.width, vid.height - sb_lines); } if (scr_vrect.y > 0) { // top - Draw_TileClear (scr_vrect.x, 0, + R2D_TileClear (scr_vrect.x, 0, scr_vrect.width, scr_vrect.y); // bottom - Draw_TileClear (scr_vrect.x, + R2D_TileClear (scr_vrect.x, scr_vrect.y + scr_vrect.height, scr_vrect.width, vid.height - cl_sbar.value?sb_lines:0 - diff --git a/engine/client/cl_ui.c b/engine/client/cl_ui.c index 23493b30f..d134566e2 100644 --- a/engine/client/cl_ui.c +++ b/engine/client/cl_ui.c @@ -281,7 +281,6 @@ 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); char *Get_Q2ConfigString(int i); @@ -899,14 +898,14 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con { float *fl =VM_POINTER(arg[0]); if (!fl) - Draw_ImageColours(1, 1, 1, 1); + R2D_ImageColours(1, 1, 1, 1); else - Draw_ImageColours(fl[0], fl[1], fl[2], fl[3]); + R2D_ImageColours(fl[0], fl[1], fl[2], fl[3]); } break; case UI_R_DRAWSTRETCHPIC: - Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), VM_FROMSHANDLE(VM_LONG(arg[8]))); + R2D_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), VM_FROMSHANDLE(VM_LONG(arg[8]))); break; case UI_CM_LERPTAG: //Lerp tag... diff --git a/engine/client/clhl_game.c b/engine/client/clhl_game.c index 7cc24da87..26f44768a 100644 --- a/engine/client/clhl_game.c +++ b/engine/client/clhl_game.c @@ -344,7 +344,7 @@ int hl_viewmodelsequencebody; HLPIC QDECL CLGHL_pic_load (char *picname) { return Mod_ForName(picname, false); -// return Draw_SafeCachePic(picname); +// return R2D_SafeCachePic(picname); } int QDECL CLGHL_pic_getnumframes (HLPIC pic) { @@ -404,7 +404,7 @@ int QDECL CLGHL_pic_getwidth (HLPIC pic, int frame) void QDECL CLGHL_pic_select (HLPIC pic, int r, int g, int b) { selectedpic = pic; - Draw_ImageColours(r/255.0f, g/255.0f, b/255.0f, 1); + R2D_ImageColours(r/255.0f, g/255.0f, b/255.0f, 1); } void QDECL CLGHL_pic_drawcuropaque (int frame, int x, int y, hlsubrect_t *loc) { @@ -415,7 +415,7 @@ void QDECL CLGHL_pic_drawcuropaque (int frame, int x, int y, hlsubrect_t *loc) //faster SW render: no blends/holes pic->flags &= ~1; - Draw_Image(x, y, + R2D_Image(x, y, loc->r-loc->l, loc->b-loc->t, (float)loc->l/pic->width, (float)loc->t/pic->height, (float)loc->r/pic->width, (float)loc->b/pic->height, @@ -429,7 +429,7 @@ void QDECL CLGHL_pic_drawcuralphtest (int frame, int x, int y, hlsubrect_t *loc) //use some kind of alpha pic->flags |= 1; - Draw_Image(x, y, + R2D_Image(x, y, loc->r-loc->l, loc->b-loc->t, (float)loc->l/pic->width, (float)loc->t/pic->height, (float)loc->r/pic->width, (float)loc->b/pic->height, @@ -448,7 +448,7 @@ void QDECL CLGHL_pic_drawcuradditive (int frame, int x, int y, hlsubrect_t *loc) pic->flags |= 1; if (loc) { - Draw_Image(x, y, + R2D_Image(x, y, loc->r-loc->l, loc->b-loc->t, (float)loc->l/pic->width, (float)loc->t/pic->height, (float)loc->r/pic->width, (float)loc->b/pic->height, @@ -456,7 +456,7 @@ void QDECL CLGHL_pic_drawcuradditive (int frame, int x, int y, hlsubrect_t *loc) } else { - Draw_Image(x, y, + R2D_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, diff --git a/engine/client/console.c b/engine/client/console.c index 6bacfe961..48c175fcc 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -1211,7 +1211,7 @@ void Con_DrawConsole (int lines, qboolean noback) // draw the background if (!noback) - Draw_ConsoleBackground (0, lines, scr_con_forcedraw); + R2D_ConsoleBackground (0, lines, scr_con_forcedraw); con_current->unseentext = false; @@ -1378,12 +1378,12 @@ void Con_DrawConsole (int lines, qboolean noback) else selstartoffset = 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); + R2D_ImagePaletteColour(0, 1.0); + R2D_FillBlock((sstart*vid.width)/vid.rotpixelwidth, (y*vid.height)/vid.rotpixelheight, ((send - sstart)*vid.width)/vid.rotpixelwidth, (Font_CharHeight()*vid.height)/vid.rotpixelheight); } } } + R2D_ImageColours(1.0, 1.0, 1.0, 1.0); x = sx; Font_LineDraw(x, y, s, s+linelength); diff --git a/engine/client/m_items.c b/engine/client/m_items.c index a4c9254f2..8f89e2f4a 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -20,68 +20,68 @@ void Draw_TextBox (int x, int y, int width, int lines) // draw left side cx = x; cy = y; - p = Draw_SafeCachePic ("gfx/box_tl.lmp"); + p = R2D_SafeCachePic ("gfx/box_tl.lmp"); if (!p) //assume none exist { - 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); + R2D_ImageColours(0.0, 0.0, 0.0, 1.0); + R2D_FillBlock(x, y, width + 16, 8 * (2 + lines)); + R2D_ImageColours(1.0, 1.0, 1.0, 1.0); return; } if (p) - Draw_ScalePic (cx, cy, 8, 8, p); - p = Draw_SafeCachePic ("gfx/box_ml.lmp"); + R2D_ScalePic (cx, cy, 8, 8, p); + p = R2D_SafeCachePic ("gfx/box_ml.lmp"); for (n = 0; n < lines; n++) { cy += 8; if (p) - Draw_ScalePic (cx, cy, 8, 8, p); + R2D_ScalePic (cx, cy, 8, 8, p); } - p = Draw_SafeCachePic ("gfx/box_bl.lmp"); + p = R2D_SafeCachePic ("gfx/box_bl.lmp"); if (p) - Draw_ScalePic (cx, cy+8, 8, 8, p); + R2D_ScalePic (cx, cy+8, 8, 8, p); // draw middle cx += 8; while (width > 0) { cy = y; - p = Draw_SafeCachePic ("gfx/box_tm.lmp"); + p = R2D_SafeCachePic ("gfx/box_tm.lmp"); if (p) - Draw_ScalePic (cx, cy, 16, 8, p); - p = Draw_SafeCachePic ("gfx/box_mm.lmp"); + R2D_ScalePic (cx, cy, 16, 8, p); + p = R2D_SafeCachePic ("gfx/box_mm.lmp"); for (n = 0; n < lines; n++) { cy += 8; if (n == 1) - p = Draw_SafeCachePic ("gfx/box_mm2.lmp"); + p = R2D_SafeCachePic ("gfx/box_mm2.lmp"); if (p) - Draw_ScalePic (cx, cy, 16, 8, p); + R2D_ScalePic (cx, cy, 16, 8, p); } - p = Draw_SafeCachePic ("gfx/box_bm.lmp"); + p = R2D_SafeCachePic ("gfx/box_bm.lmp"); if (p) - Draw_ScalePic (cx, cy+8, 16, 8, p); + R2D_ScalePic (cx, cy+8, 16, 8, p); width -= 2; cx += 16; } // draw right side cy = y; - p = Draw_SafeCachePic ("gfx/box_tr.lmp"); + p = R2D_SafeCachePic ("gfx/box_tr.lmp"); if (p) - Draw_ScalePic (cx, cy, 8, 8, p); - p = Draw_SafeCachePic ("gfx/box_mr.lmp"); + R2D_ScalePic (cx, cy, 8, 8, p); + p = R2D_SafeCachePic ("gfx/box_mr.lmp"); for (n = 0; n < lines; n++) { cy += 8; if (p) - Draw_ScalePic (cx, cy, 8, 8, p); + R2D_ScalePic (cx, cy, 8, 8, p); } - p = Draw_SafeCachePic ("gfx/box_br.lmp"); + p = R2D_SafeCachePic ("gfx/box_br.lmp"); if (p) - Draw_ScalePic (cx, cy+8, 8, 8, p); + R2D_ScalePic (cx, cy+8, 8, 8, p); } void Draw_Hexen2BigFontString(int x, int y, const char *text) @@ -91,7 +91,7 @@ void Draw_Hexen2BigFontString(int x, int y, const char *text) unsigned int hack; hack = d_8to24rgbtable[0]; d_8to24rgbtable[0] = 0; - p = Draw_SafeCachePic ("gfx/menu/bigfont.lmp"); + p = R2D_SafeCachePic ("gfx/menu/bigfont.lmp"); d_8to24rgbtable[0] = hack; while(*text) @@ -112,7 +112,7 @@ void Draw_Hexen2BigFontString(int x, int y, const char *text) sy=-1; } if(sx>=0) - Draw_SubPic(x, y, 20, 20, p, sx, sy, 20*8, 20*4); + R2D_SubPic(x, y, 20, 20, p, sx, sy, 20*8, 20*4); x+=20; text++; } @@ -121,16 +121,16 @@ void Draw_Hexen2BigFontString(int x, int y, const char *text) mpic_t *QBigFontWorks(void) { mpic_t *p; - p = Draw_SafeCachePic ("gfx/mcharset.lmp"); + p = R2D_SafeCachePic ("gfx/mcharset.lmp"); if (p) return p; - p = Draw_SafeCachePic ("mcharset.lmp"); + p = R2D_SafeCachePic ("mcharset.lmp"); if (p) return p; - p = Draw_SafeCachePic ("textures/gfx/mcharset.lmp"); + p = R2D_SafeCachePic ("textures/gfx/mcharset.lmp"); if (p) return p; - p = Draw_SafeCachePic ("textures/mcharset.lmp"); + p = R2D_SafeCachePic ("textures/mcharset.lmp"); if (p) return p; return NULL; @@ -182,7 +182,7 @@ void Draw_BigFontString(int x, int y, const char *text) sy=-1; } if(sx>=0) - Draw_SubPic(x, y, 20, 20, p, sx, sy, 20*8, 20*8); + R2D_SubPic(x, y, 20, 20, p, sx, sy, 20*8, 20*8); x+=(p->width>>3); text++; } @@ -399,8 +399,8 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu) break; case mt_menudot: i = (int)(realtime * 10)%maxdots; - p = Draw_SafeCachePic(va(menudotstyle, i+mindot )); - Draw_ScalePic(xpos+option->common.posx, ypos+option->common.posy+dotofs, 20, 20, p); + p = R2D_SafeCachePic(va(menudotstyle, i+mindot )); + R2D_ScalePic(xpos+option->common.posx, ypos+option->common.posy+dotofs, 20, 20, p); break; case mt_picturesel: p = NULL; @@ -410,16 +410,16 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu) Q_strncpyz(selname, option->picture.picturename, sizeof(selname)); COM_StripExtension(selname, selname, sizeof(selname)); Q_strncatz(selname, "_sel", sizeof(selname)); - p = Draw_SafeCachePic(selname); + p = R2D_SafeCachePic(selname); } if (!p) - p = Draw_SafeCachePic(option->picture.picturename); + p = R2D_SafeCachePic(option->picture.picturename); - Draw_ScalePic(xpos+option->common.posx, ypos+option->common.posy, option->common.width?option->common.width:p->width, option->common.height?option->common.height:p->height, p); + R2D_ScalePic(xpos+option->common.posx, ypos+option->common.posy, option->common.width?option->common.width:p->width, option->common.height?option->common.height:p->height, p); break; case mt_picture: - p = Draw_SafeCachePic(option->picture.picturename); - if (p) Draw_ScalePic(xpos+option->common.posx, ypos+option->common.posy, option->common.width, option->common.height, p); + p = R2D_SafeCachePic(option->picture.picturename); + if (p) R2D_ScalePic(xpos+option->common.posx, ypos+option->common.posy, option->common.width, option->common.height, p); break; case mt_childwindow: MenuDrawItems(xpos+option->common.posx, ypos+option->common.posy, ((menu_t *)option->custom.data)->options, (menu_t *)option->custom.data); @@ -716,8 +716,8 @@ menupicture_t *MC_AddSelectablePicture(menu_t *menu, int x, int y, char *picname COM_StripExtension(selname, selname, sizeof(selname)); Q_strncatz(selname, "_sel", sizeof(selname)); - Draw_SafeCachePic(picname); - Draw_SafeCachePic(selname); + R2D_SafeCachePic(picname); + R2D_SafeCachePic(selname); n = Z_Malloc(sizeof(menupicture_t) + strlen(picname)+1); n->common.type = mt_picturesel; @@ -738,7 +738,7 @@ menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, int width, int height, if (qrenderer == QR_NONE) return NULL; - Draw_SafeCachePic(picname); + R2D_SafeCachePic(picname); n = Z_Malloc(sizeof(menupicture_t) + strlen(picname)+1); n->common.type = mt_picture; @@ -763,7 +763,7 @@ menupicture_t *MC_AddCenterPicture(menu_t *menu, int y, int height, char *picnam if (qrenderer == QR_NONE) return NULL; - p = Draw_SafeCachePic(picname); + p = R2D_SafeCachePic(picname); if (!p) { x = 320/2; @@ -1455,11 +1455,11 @@ void DrawCursor(int prydoncursornum) if (!*cl_cursor.string) p = NULL; else - p = Draw_SafeCachePic(cl_cursor.string); + p = R2D_SafeCachePic(cl_cursor.string); if (p) { - Draw_ImageColours(1, 1, 1, 1); - Draw_Image(mousecursor_x-cl_cursorbias.value, mousecursor_y-cl_cursorbias.value, cl_cursorsize.value, cl_cursorsize.value, 0, 0, 1, 1, p); + R2D_ImageColours(1, 1, 1, 1); + R2D_Image(mousecursor_x-cl_cursorbias.value, mousecursor_y-cl_cursorbias.value, cl_cursorsize.value, cl_cursorsize.value, 0, 0, 1, 1, p); // Draw_TransPic(mousecursor_x-4, mousecursor_y-4, p); } else @@ -1830,12 +1830,6 @@ void M_Menu_Main_f (void) SCR_EndLoadingPlaque(); //just in case... - if (!Draw_SafeCachePic) - { - Con_ToggleConsole_f(); - return; - } - /* if (0) { @@ -1866,7 +1860,7 @@ void M_Menu_Main_f (void) mgt = M_GameType(); if (mgt == MGT_QUAKE2) //quake2 main menu. { - if (Draw_SafeCachePic("pics/m_main_game")) + if (R2D_SafeCachePic("pics/m_main_game")) { m_state = m_complex; key_dest = key_menu; @@ -1875,7 +1869,7 @@ void M_Menu_Main_f (void) mainm->key = MC_Main_Key; MC_AddPicture(mainm, 0, 4, 38, 166, "pics/m_main_plaque"); - p = Draw_SafeCachePic("pics/m_main_logo"); + p = R2D_SafeCachePic("pics/m_main_logo"); if (!p) return; MC_AddPicture(mainm, 0, 173, 36, 42, "pics/m_main_logo"); @@ -1921,7 +1915,7 @@ void M_Menu_Main_f (void) mainm->key = MC_Main_Key; MC_AddPicture(mainm, 16, 0, 35, 176, "gfx/menu/hplaque.lmp"); - p = Draw_SafeCachePic("gfx/menu/title0.lmp"); + p = R2D_SafeCachePic("gfx/menu/title0.lmp"); if (!p) return; MC_AddCenterPicture(mainm, 0, 60, "gfx/menu/title0.lmp"); @@ -1959,7 +1953,7 @@ void M_Menu_Main_f (void) key_dest = key_menu; mainm = M_CreateMenu(0); - p = Draw_SafeCachePic("gfx/ttl_main.lmp"); + p = R2D_SafeCachePic("gfx/ttl_main.lmp"); if (!p) { MC_AddRedText(mainm, 16, 0, "MAIN MENU", false); @@ -1993,7 +1987,7 @@ void M_Menu_Main_f (void) key_dest = key_menu; mainm = M_CreateMenu(0); - p = Draw_SafeCachePic("gfx/ttl_main.lmp"); + p = R2D_SafeCachePic("gfx/ttl_main.lmp"); if (!p) { MC_AddRedText(mainm, 16, 0, "MAIN MENU", false); @@ -2011,7 +2005,7 @@ void M_Menu_Main_f (void) MC_AddPicture(mainm, 72, 32, 240, 112, "gfx/mainmenu.lmp"); - p = Draw_SafeCachePic("gfx/mainmenu.lmp"); + p = R2D_SafeCachePic("gfx/mainmenu.lmp"); b=MC_AddConsoleCommand (mainm, 72, 32, "", "menu_single\n"); mainm->selecteditem = (menuoption_t *)b; diff --git a/engine/client/m_master.c b/engine/client/m_master.c index e4cfe7853..6b499789a 100644 --- a/engine/client/m_master.c +++ b/engine/client/m_master.c @@ -237,11 +237,11 @@ void M_DrawOneServer (int inity) { if (y>=miny) { - 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); + R2D_ImagePaletteColour(Sbar_ColorForMap(selectedserver.detail->players[i].topc), 1.0); + R2D_FillBlock (12, y, 28, 4); + R2D_ImagePaletteColour(Sbar_ColorForMap(selectedserver.detail->players[i].botc), 1.0); + R2D_FillBlock (12, y+4, 28, 4); + R2D_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); } @@ -417,8 +417,8 @@ void M_DrawServerList(void) // make sure we have a highlighted background if (highlight >= 0) { - Draw_ImageColours(consolecolours[highlight].fr, consolecolours[highlight].fg, consolecolours[highlight].fb, 1.0); - Draw_FillBlock(8, y, vid.width-16, 8); + R2D_ImageColours(consolecolours[highlight].fr, consolecolours[highlight].fg, consolecolours[highlight].fb, 1.0); + R2D_FillBlock(8, y, vid.width-16, 8); } if (sb_showtimelimit.value) @@ -915,8 +915,8 @@ void SL_DrawColumnTitle (int *x, int y, int xlen, int mx, char *str, qboolean re if (mx >= xmin && !(*filldraw)) { *filldraw = true; - 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); + R2D_ImageColours((sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08, 1.0); + R2D_FillBlock(xmin, y, xlen, 8); } Draw_FunStringWidth(xmin, y, str, xlen); @@ -1062,25 +1062,25 @@ void SL_ServerDraw (int x, int y, menucustom_t *ths, menu_t *menu) stype = flagstoservertype(si->special); if (thisone == info->selectedpos) { - Draw_ImageColours( + R2D_ImageColours( serverhighlight[(int)stype][0], serverhighlight[(int)stype][1], serverhighlight[(int)stype][2], 1.0); } else if (thisone == info->scrollpos + (mousecursor_y-16)/8 && mousecursor_x < x) - Draw_ImageColours((sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08, 1.0); + R2D_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_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); + R2D_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_ImageColours( + R2D_ImageColours( serverbackcolor[(int)stype * 2 + (thisone & 1)][0], serverbackcolor[(int)stype * 2 + (thisone & 1)][1], serverbackcolor[(int)stype * 2 + (thisone & 1)][2], 1.0); } - Draw_FillBlock(0, y, ths->common.width, 8); + R2D_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;} @@ -1114,7 +1114,7 @@ qboolean SL_ServerKey (menucustom_t *ths, menu_t *menu, int key) if (server) { snprintf(info->mappic->picturename, 32, "levelshots/%s", server->map); - if (!Draw_SafeCachePic(info->mappic->picturename)) + if (!R2D_SafeCachePic(info->mappic->picturename)) snprintf(info->mappic->picturename, 32, "levelshots/nomap"); } else @@ -1217,7 +1217,7 @@ qboolean SL_Key (int key, menu_t *menu) if (server) { snprintf(info->mappic->picturename, 32, "levelshots/%s", server->map); - if (!Draw_SafeCachePic(info->mappic->picturename)) + if (!R2D_SafeCachePic(info->mappic->picturename)) snprintf(info->mappic->picturename, 32, "levelshots/nomap"); } else @@ -1246,10 +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_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); + R2D_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].topc), 1.0); + R2D_FillBlock (x, y, 28, 4); + R2D_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].botc), 1.0); + R2D_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); @@ -1263,33 +1263,33 @@ void SL_SliderDraw (int x, int y, menucustom_t *ths, menu_t *menu) mpic_t *pic; - pic = Draw_SafeCachePic("scrollbars/slidebg.png"); + pic = R2D_SafeCachePic("scrollbars/slidebg.png"); if (pic) { - Draw_ScalePic(x + ths->common.width - 8, y+8, 8, ths->common.height-16, pic); + R2D_ScalePic(x + ths->common.width - 8, y+8, 8, ths->common.height-16, pic); - pic = Draw_SafeCachePic("scrollbars/arrow_up.png"); - Draw_ScalePic(x + ths->common.width - 8, y, 8, 8, pic); + pic = R2D_SafeCachePic("scrollbars/arrow_up.png"); + R2D_ScalePic(x + ths->common.width - 8, y, 8, 8, pic); - pic = Draw_SafeCachePic("scrollbars/arrow_down.png"); - Draw_ScalePic(x + ths->common.width - 8, y + ths->common.height - 8, 8, 8, pic); + pic = R2D_SafeCachePic("scrollbars/arrow_down.png"); + R2D_ScalePic(x + ths->common.width - 8, y + ths->common.height - 8, 8, 8, pic); y += ((info->scrollpos) / ((float)info->numslots - info->visibleslots)) * (float)(ths->common.height-(64+16-1)); y += 8; - pic = Draw_SafeCachePic("scrollbars/slider.png"); - Draw_ScalePic(x + ths->common.width - 8, y, 8, 64, pic); + pic = R2D_SafeCachePic("scrollbars/slider.png"); + R2D_ScalePic(x + ths->common.width - 8, y, 8, 64, pic); } else { - Draw_ImageColours(0.1, 0.1, 0.2, 1.0); - Draw_FillBlock(x, y, ths->common.width, ths->common.height); + R2D_ImageColours(0.1, 0.1, 0.2, 1.0); + R2D_FillBlock(x, y, ths->common.width, ths->common.height); y += ((info->scrollpos) / ((float)info->numslots - info->visibleslots)) * (ths->common.height-8); - Draw_ImageColours(0.35, 0.35, 0.55, 1.0); - Draw_FillBlock(x, y, 8, 8); + R2D_ImageColours(0.35, 0.35, 0.55, 1.0); + R2D_FillBlock(x, y, 8, 8); } if (info->sliderpressed) @@ -1303,7 +1303,7 @@ void SL_SliderDraw (int x, int y, menucustom_t *ths, menu_t *menu) my = mousecursor_y; my -= ths->common.posy; - if (Draw_SafeCachePic("scrollbars/slidebg.png")) + if (R2D_SafeCachePic("scrollbars/slidebg.png")) { my -= 32+8; my /= ths->common.height - (64+16); @@ -1333,7 +1333,7 @@ qboolean SL_SliderKey (menucustom_t *ths, menu_t *menu, int key) my = mousecursor_y; my -= ths->common.posy; - if (Draw_SafeCachePic("scrollbars/slidebg.png")) + if (R2D_SafeCachePic("scrollbars/slidebg.png")) { my -= 32+8; my /= ths->common.height - (64+16); diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index a4a84dcf2..800dbc05b 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -287,7 +287,7 @@ void M_Media_Draw (void) #define MP_Hightlight(x,y,text,hl) (hl?M_PrintWhite(x, y, text):M_Print(x, y, text)) - p = Draw_SafeCachePic ("gfx/p_option.lmp"); + p = R2D_SafeCachePic ("gfx/p_option.lmp"); if (p) M_DrawScalePic ( (320-p->width)/2, 4, 144, 24, p); if (!bgmvolume.value) @@ -914,7 +914,7 @@ qboolean Media_WinAvi_DecodeFrame(cin_t *cin, qboolean nosound) if (!lpbi || lpbi->biBitCount != 24)//oops { SCR_SetUpToDrawConsole(); - Draw_ConsoleBackground(0, vid.height, true); + R2D_ConsoleBackground(0, vid.height, true); Draw_FunString(0, 0, "Video stream is corrupt\n"); } else @@ -1743,8 +1743,8 @@ qboolean Media_ShowFilm(void) Media_PlayFilm(""); else { - Draw_ImageColours(1, 1, 1, 1); - Draw_ScalePic(0, 0, vid.width, vid.height, videoshader); + R2D_ImageColours(1, 1, 1, 1); + R2D_ScalePic(0, 0, vid.width, vid.height, videoshader); SCR_SetUpToDrawConsole(); if (scr_con_current) diff --git a/engine/client/m_multi.c b/engine/client/m_multi.c index 430addb8f..382f8b55e 100644 --- a/engine/client/m_multi.c +++ b/engine/client/m_multi.c @@ -72,7 +72,7 @@ void M_Menu_MultiPlayer_f (void) } else { - p = Draw_SafeCachePic("gfx/mp_menu.lmp"); + p = R2D_SafeCachePic("gfx/mp_menu.lmp"); if (p) { MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp"); @@ -254,7 +254,7 @@ void MSetupQ2_TransDraw (int x, int y, menucustom_t *option, menu_t *menu) mpic_t *p; - p = Draw_SafeCachePic (va("players/%s_i", skin.string)); + p = R2D_SafeCachePic (va("players/%s_i", skin.string)); if (!p) { q2skinsearch_t *s = Z_Malloc(sizeof(*s)); @@ -263,10 +263,10 @@ void MSetupQ2_TransDraw (int x, int y, menucustom_t *option, menu_t *menu) Cvar_Set(&skin, s->names[rand()%s->entries]); q2skin_destroy(s); - p = Draw_SafeCachePic (va("players/%s_i", skin.string)); + p = R2D_SafeCachePic (va("players/%s_i", skin.string)); } if (p) - Draw_ScalePic (x-12, y-8, p->width, p->height, p); + R2D_ScalePic (x-12, y-8, p->width, p->height, p); } void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu) @@ -312,9 +312,9 @@ void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu) } } - p = Draw_SafeCachePic ("gfx/bigbox.lmp"); + p = R2D_SafeCachePic ("gfx/bigbox.lmp"); if (p) - Draw_ScalePic (x-12, y-8, 72, 72, p); + R2D_ScalePic (x-12, y-8, 72, 72, p); M_BuildTranslationTable(info->topcolour, info->lowercolour); Draw_TransPicTranslate (x, y, info->tiwidth, info->tiheight, info->translationimage, translationTable); @@ -339,7 +339,7 @@ void M_Menu_Setup_f (void) mgt = M_GameType(); if (mgt == MGT_QUAKE2) //quake2 main menu. { - if (Draw_SafeCachePic("pics/m_banner_plauer_setup")) + if (R2D_SafeCachePic("pics/m_banner_plauer_setup")) { char *modeloptions[] = { @@ -357,7 +357,7 @@ void M_Menu_Setup_f (void) // menu->key = MC_Main_Key; MC_AddPicture(menu, 0, 4, 38, 166, "pics/m_main_plaque"); - p = Draw_SafeCachePic("pics/m_main_logo"); + p = R2D_SafeCachePic("pics/m_main_logo"); if (!p) return; MC_AddPicture(menu, 0, 173, 36, 42, "pics/m_main_logo"); diff --git a/engine/client/m_script.c b/engine/client/m_script.c index bba4ccf38..095292e68 100644 --- a/engine/client/m_script.c +++ b/engine/client/m_script.c @@ -154,7 +154,7 @@ void M_MenuS_Picture_f (void) return; } - p = Draw_SafeCachePic(picname); + p = R2D_SafeCachePic(picname); if (!p) return; diff --git a/engine/client/m_single.c b/engine/client/m_single.c index ab74c6185..a33da9b25 100644 --- a/engine/client/m_single.c +++ b/engine/client/m_single.c @@ -328,7 +328,7 @@ void M_Menu_SinglePlayer_f (void) MC_AddCenterPicture(menu, 4, 24, "gfx/p_option.lmp"); } - p = Draw_SafeCachePic("gfx/sp_menu.lmp"); + p = R2D_SafeCachePic("gfx/sp_menu.lmp"); if (!p) { MC_AddBox (menu, 60, 10*8, 23, 4); diff --git a/engine/client/menu.c b/engine/client/menu.c index ed1cf7474..38203cf42 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -58,7 +58,7 @@ void M_PrintWhite (int cx, int cy, qbyte *str) } void M_DrawScalePic (int x, int y, int w, int h, mpic_t *pic) { - Draw_ScalePic (x + ((vid.width - 320)>>1), y, w, h, pic); + R2D_ScalePic (x + ((vid.width - 320)>>1), y, w, h, pic); } qbyte identityTable[256]; @@ -129,18 +129,18 @@ void M_DrawTextBox (int x, int y, int width, int lines) // draw left side cx = x; cy = y; - p = Draw_SafeCachePic ("gfx/box_tl.lmp"); + p = R2D_SafeCachePic ("gfx/box_tl.lmp"); if (!p) return; //assume we can't find any M_DrawScalePic (cx, cy, 8, 8, p); - p = Draw_SafeCachePic ("gfx/box_ml.lmp"); + p = R2D_SafeCachePic ("gfx/box_ml.lmp"); if (p) for (n = 0; n < lines; n++) { cy += 8; M_DrawScalePic (cx, cy, 8, 8, p); } - p = Draw_SafeCachePic ("gfx/box_bl.lmp"); + p = R2D_SafeCachePic ("gfx/box_bl.lmp"); if (p) M_DrawScalePic (cx, cy+8, 8, 8, p); @@ -149,23 +149,23 @@ void M_DrawTextBox (int x, int y, int width, int lines) while (width > 0) { cy = y; - p = Draw_SafeCachePic ("gfx/box_tm.lmp"); + p = R2D_SafeCachePic ("gfx/box_tm.lmp"); if (p) M_DrawScalePic (cx, cy, 16, 8, p); - p = Draw_SafeCachePic ("gfx/box_mm.lmp"); + p = R2D_SafeCachePic ("gfx/box_mm.lmp"); if (p) for (n = 0; n < lines; n++) { cy += 8; if (n == 1) { - p = Draw_SafeCachePic ("gfx/box_mm2.lmp"); + p = R2D_SafeCachePic ("gfx/box_mm2.lmp"); if (!p) break; } M_DrawScalePic (cx, cy, 16, 8, p); } - p = Draw_SafeCachePic ("gfx/box_bm.lmp"); + p = R2D_SafeCachePic ("gfx/box_bm.lmp"); if (p) M_DrawScalePic (cx, cy+8, 16, 8, p); width -= 2; @@ -174,17 +174,17 @@ void M_DrawTextBox (int x, int y, int width, int lines) // draw right side cy = y; - p = Draw_SafeCachePic ("gfx/box_tr.lmp"); + p = R2D_SafeCachePic ("gfx/box_tr.lmp"); if (p) M_DrawScalePic (cx, cy, 8, 8, p); - p = Draw_SafeCachePic ("gfx/box_mr.lmp"); + p = R2D_SafeCachePic ("gfx/box_mr.lmp"); if (p) for (n = 0; n < lines; n++) { cy += 8; M_DrawScalePic (cx, cy, 8, 8, p); } - p = Draw_SafeCachePic ("gfx/box_br.lmp"); + p = R2D_SafeCachePic ("gfx/box_br.lmp"); if (p) M_DrawScalePic (cx, cy+8, 8, 8, p); } @@ -544,7 +544,7 @@ void M_Menu_Help_f (void) void M_Help_Draw (void) { mpic_t *pic; - pic = Draw_SafeCachePic(va(helpstyle, help_page+helppagemin)); + pic = R2D_SafeCachePic(va(helpstyle, help_page+helppagemin)); if (!pic) M_Menu_Main_f (); else @@ -992,7 +992,7 @@ void M_Draw (int uimenu) if (uimenu) { if (uimenu == 2) - Draw_FadeScreen (); + R2D_FadeScreen (); #ifdef VM_UI UI_DrawMenu(); #endif @@ -1013,14 +1013,14 @@ void M_Draw (int uimenu) if ((!menu_script || scr_con_current) && !m_recursiveDraw) { - Draw_FadeScreen (); + R2D_FadeScreen (); } else { m_recursiveDraw = false; } - Draw_ImageColours(1, 1, 1, 1); + R2D_ImageColours(1, 1, 1, 1); switch (m_state) { diff --git a/engine/client/merged.h b/engine/client/merged.h index ee44b4c87..0578aaef8 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -56,31 +56,28 @@ typedef struct { extern r_qrenderer_t qrenderer; extern char *q_renderername; -extern mpic_t *(*Draw_SafePicFromWad) (char *name); -extern mpic_t *(*Draw_SafeCachePic) (char *path); +mpic_t *R2D_SafeCachePic (char *path); +mpic_t *R2D_SafePicFromWad (char *name); +void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic); +void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight); +void R2D_TileClear (int x, int y, int w, int h); +void R2D_FadeScreen (void); + +void R2D_ConsoleBackground (int firstline, int lastline, qboolean forceopaque); +void R2D_EditorBackground (void); + +void R2D_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); + +void R2D_ImageColours(float r, float g, float b, float a); +void R2D_ImagePaletteColour(unsigned int i, float a); +void R2D_FillBlock(int x, int y, int w, int h); + extern void (*Draw_Init) (void); extern void (*Draw_TinyCharacter) (int x, int y, unsigned int num); extern void (*Draw_Crosshair) (void); -extern void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); -extern void (*Draw_SubPic) (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight); extern void (*Draw_TransPicTranslate) (int x, int y, int width, int height, qbyte *image, qbyte *translation); -extern void (*Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque); -extern void (*Draw_EditorBackground) (void); -extern void (*Draw_TileClear) (int x, int y, int w, int h); -extern void (*Draw_Fill) (int x, int y, int w, int h, unsigned int c); -extern void (*Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b); -extern void (*Draw_FadeScreen) (void); -extern void (*Draw_BeginDisc) (void); -extern void (*Draw_EndDisc) (void); extern qboolean (*Draw_IsCached) (char *picname); //can be null -extern void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic -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); extern void (*R_RenderView) (void); // must set r_refdef first @@ -181,25 +178,10 @@ typedef struct rendererinfo_s { char *name[4]; r_qrenderer_t rtype; - mpic_t *(*Draw_SafePicFromWad) (char *name); - mpic_t *(*Draw_SafeCachePic) (char *path); void (*Draw_Init) (void); void (*Draw_Shutdown) (void); - void (*Draw_Crosshair) (void); - void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); - void (*Draw_SubPic) (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight); - void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation); - void (*Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque); - void (*Draw_EditorBackground) (void); - void (*Draw_TileClear) (int x, int y, int w, int h); - void (*Draw_Fill) (int x, int y, int w, int h, unsigned int c); - void (*Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b); - void (*Draw_FadeScreen) (void); - void (*Draw_BeginDisc) (void); - void (*Draw_EndDisc) (void); - - void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic - void (*Draw_ImageColours) (float r, float g, float b, float a); + void (*Draw_Crosshair) (void); //TODO: MARKED FOR DEMOLITION + void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation); //TODO: MARKED FOR DEMOLITION texid_t (*IMG_LoadTexture) (char *identifier, int width, int height, uploadfmt_t fmt, void *data, unsigned int flags); texid_t (*IMG_LoadTexture8Pal24) (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags); diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index 9c5818e0e..a7543df6b 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -279,8 +279,8 @@ void QCBUILTIN PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_glob float *rgb = G_VECTOR(OFS_PARM2); float alpha = G_FLOAT(OFS_PARM3); - Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha); - Draw_FillBlock(pos[0], pos[1], size[0], size[1]); + R2D_ImageColours(rgb[0], rgb[1], rgb[2], alpha); + R2D_FillBlock(pos[0], pos[1], size[0], size[1]); G_FLOAT(OFS_RETURN) = 1; } @@ -417,13 +417,13 @@ void QCBUILTIN PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globa mpic_t *p; - p = Draw_SafeCachePic(picname); + p = R2D_SafeCachePic(picname); if (!p) - p = Draw_SafePicFromWad(picname); + p = R2D_SafePicFromWad(picname); PF_SelectDPDrawFlag(flag); - Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha); - Draw_Image(pos[0], pos[1], size[0], size[1], 0, 0, 1, 1, p); + R2D_ImageColours(rgb[0], rgb[1], rgb[2], alpha); + R2D_Image(pos[0], pos[1], size[0], size[1], 0, 0, 1, 1, p); BE_SelectMode(BEM_STANDARD, 0); G_FLOAT(OFS_RETURN) = 1; @@ -442,11 +442,11 @@ void QCBUILTIN PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_gl mpic_t *p; - p = Draw_SafeCachePic(picname); + p = R2D_SafeCachePic(picname); PF_SelectDPDrawFlag(flag); - Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha); - Draw_Image( pos[0], pos[1], + R2D_ImageColours(rgb[0], rgb[1], rgb[2], alpha); + R2D_Image( pos[0], pos[1], size[0], size[1], srcPos[0], srcPos[1], srcPos[0]+srcSize[0], srcPos[1]+srcSize[1], @@ -484,7 +484,7 @@ void QCBUILTIN PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_ fromwad = false; if (fromwad) - pic = Draw_SafePicFromWad(str); + pic = R2D_SafePicFromWad(str); else { if (cls.state @@ -494,7 +494,7 @@ void QCBUILTIN PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_ ) CL_CheckOrEnqueDownloadFile(str, str, 0); - pic = Draw_SafeCachePic(str); + pic = R2D_SafeCachePic(str); } if (pic) @@ -597,12 +597,12 @@ void QCBUILTIN PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_glob void QCBUILTIN PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals) { char *picname = PR_GetStringOfs(prinst, OFS_PARM0); - mpic_t *p = Draw_SafeCachePic(picname); + mpic_t *p = R2D_SafeCachePic(picname); float *ret = G_VECTOR(OFS_RETURN); if (!p) - p = Draw_SafeCachePic(va("%s.tga", picname)); + p = R2D_SafeCachePic(va("%s.tga", picname)); if (p) { diff --git a/engine/client/r_2d.c b/engine/client/r_2d.c index 68917c96b..bf4d38125 100644 --- a/engine/client/r_2d.c +++ b/engine/client/r_2d.c @@ -88,9 +88,9 @@ void R2D_Init(void) missing_texture = R_LoadTexture8("no_texture", 16, 16, (unsigned char*)r_notexture_mip + r_notexture_mip->offsets[0], IF_NOALPHA|IF_NOGAMMA, 0); - draw_backtile = Draw_SafePicFromWad ("backtile"); + draw_backtile = R2D_SafePicFromWad ("backtile"); if (!draw_backtile) - draw_backtile = Draw_SafeCachePic ("gfx/menu/backtile.lmp"); + draw_backtile = R2D_SafeCachePic ("gfx/menu/backtile.lmp"); shader_draw_fill = R_RegisterShader("fill_opaque", "{\n" diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 2a3f7b69c..2c3d2e1f0 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -640,28 +640,14 @@ void Renderer_Start(void) } -mpic_t *(*Draw_SafePicFromWad) (char *name); -mpic_t *(*Draw_SafeCachePic) (char *path); void (*Draw_Init) (void); void (*Draw_Shutdown) (void); //void (*Draw_TinyCharacter) (int x, int y, unsigned int num); void (*Draw_Crosshair) (void); -void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); void (*Draw_SubPic) (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight); void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *image, qbyte *translation); -void (*Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque); -void (*Draw_EditorBackground) (void); -void (*Draw_TileClear) (int x, int y, int w, int h); -void (*Draw_Fill) (int x, int y, int w, int h, unsigned int c); -void (*Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b); -void (*Draw_FadeScreen) (void); -void (*Draw_BeginDisc) (void); -void (*Draw_EndDisc) (void); - -void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic -void (*Draw_ImageColours) (float r, float g, float b, float a); void (*R_Init) (void); void (*R_DeInit) (void); @@ -715,25 +701,10 @@ rendererinfo_t dedicatedrendererinfo = { }, QR_NONE, - NULL, //Draw_PicFromWad; //Not supported - NULL, //Draw_SafeCachePic; NULL, //Draw_Init; NULL, //Draw_Shutdown; NULL, //Draw_Crosshair; - NULL, //Draw_SubPic; NULL, //Draw_TransPicTranslate; - NULL, //Draw_ConsoleBackground; - NULL, //Draw_EditorBackground; - NULL, //Draw_TileClear; - NULL, //Draw_Fill; - NULL, //Draw_FillRGB; - NULL, //Draw_FadeScreen; - NULL, //Draw_BeginDisc; - NULL, //Draw_EndDisc; - NULL, //I'm lazy. - - NULL, //Draw_Image - NULL, //Draw_ImageColours NULL, //R_LoadTexture NULL, //R_LoadTexture8Pal24 @@ -1276,25 +1247,10 @@ void R_SetRenderer(rendererinfo_t *ri) qrenderer = ri->rtype; q_renderername = ri->name[0]; - Draw_SafePicFromWad = ri->Draw_SafePicFromWad; //Not supported - Draw_SafeCachePic = ri->Draw_SafeCachePic; Draw_Init = ri->Draw_Init; Draw_Shutdown = ri->Draw_Shutdown; Draw_Crosshair = ri->Draw_Crosshair; - Draw_SubPic = ri->Draw_SubPic; Draw_TransPicTranslate = ri->Draw_TransPicTranslate; - Draw_ConsoleBackground = ri->Draw_ConsoleBackground; - Draw_EditorBackground = ri->Draw_EditorBackground; - Draw_TileClear = ri->Draw_TileClear; - Draw_Fill = ri->Draw_Fill; - Draw_FillRGB = ri->Draw_FillRGB; - Draw_FadeScreen = ri->Draw_FadeScreen; - Draw_BeginDisc = ri->Draw_BeginDisc; - Draw_EndDisc = ri->Draw_EndDisc; - Draw_ScalePic = ri->Draw_ScalePic; - - Draw_Image = ri->Draw_Image; - Draw_ImageColours = ri->Draw_ImageColours; R_Init = ri->R_Init; R_DeInit = ri->R_DeInit; diff --git a/engine/client/sbar.c b/engine/client/sbar.c index 9656496f7..60c1f3f90 100644 --- a/engine/client/sbar.c +++ b/engine/client/sbar.c @@ -243,7 +243,7 @@ static char *q2sb_nums[2][11] = static mpic_t *Sbar_Q2CachePic(char *name) { - return Draw_SafeCachePic(va("pics/%s.pcx", name)); + return R2D_SafeCachePic(va("pics/%s.pcx", name)); } #define ICON_WIDTH 24 @@ -280,7 +280,7 @@ static void SCR_DrawField (int x, int y, int color, int width, int value) p = Sbar_Q2CachePic(q2sb_nums[color][frame]); if (p) - Draw_ScalePic (x,y,p->width, p->height, p); + R2D_ScalePic (x,y,p->width, p->height, p); x += CHAR_WIDTH; ptr++; l--; @@ -378,7 +378,7 @@ void Sbar_ExecuteLayoutString (char *s) // SCR_AddDirtyPoint (x+23, y+23); p = Sbar_Q2CachePic(Get_Q2ConfigString(Q2CS_IMAGES+value)); if (p) - Draw_ScalePic (x, y, p->width, p->height, p); + R2D_ScalePic (x, y, p->width, p->height, p); } continue; } @@ -417,7 +417,7 @@ void Sbar_ExecuteLayoutString (char *s) // if (!ci->icon) // ci = &cl.baseclientinfo; -// Draw_Pic (x, y, Draw_SafeCachePic(ci->iconname)); +// Draw_Pic (x, y, R2D_SafeCachePic(ci->iconname)); continue; } @@ -463,7 +463,7 @@ void Sbar_ExecuteLayoutString (char *s) // SCR_AddDirtyPoint (x+23, y+23); p = Sbar_Q2CachePic(com_token); if (p) - Draw_ScalePic (x, y, p->width, p->height, p); + R2D_ScalePic (x, y, p->width, p->height, p); continue; } @@ -494,7 +494,7 @@ void Sbar_ExecuteLayoutString (char *s) { p = Sbar_Q2CachePic("field_3"); if (p) - Draw_ScalePic (x, y, p->width, p->height, p); + R2D_ScalePic (x, y, p->width, p->height, p); } SCR_DrawField (x, y, color, width, value); @@ -518,7 +518,7 @@ void Sbar_ExecuteLayoutString (char *s) { p = Sbar_Q2CachePic("field_3"); if (p) - Draw_ScalePic (x, y, p->width, p->height, p); + R2D_ScalePic (x, y, p->width, p->height, p); } SCR_DrawField (x, y, color, width, value); @@ -537,7 +537,7 @@ void Sbar_ExecuteLayoutString (char *s) color = 0; // green if (cl.q2frame.playerstate.stats[Q2STAT_FLASHES] & 2) - Draw_ScalePic (x, y, FINDOUT, FINDOUT, Draw_SafeCachePic("field_3")); + R2D_ScalePic (x, y, FINDOUT, FINDOUT, R2D_SafeCachePic("field_3")); SCR_DrawField (x, y, color, width, value); continue; @@ -773,7 +773,7 @@ char *failedpic; mpic_t *Sbar_PicFromWad(char *name) { mpic_t *ret; - ret = Draw_SafePicFromWad(name); + ret = R2D_SafePicFromWad(name); if (ret) return ret; @@ -958,7 +958,7 @@ Sbar_DrawPic */ void Sbar_DrawPic (int x, int y, int w, int h, mpic_t *pic) { - Draw_ScalePic(sbar_rect.x + x /* + ((sbar_rect.width - 320)>>1) */, sbar_rect.y + y + (sbar_rect.height-SBAR_HEIGHT), w, h, pic); + R2D_ScalePic(sbar_rect.x + x /* + ((sbar_rect.width - 320)>>1) */, sbar_rect.y + y + (sbar_rect.height-SBAR_HEIGHT), w, h, pic); } /* @@ -970,7 +970,7 @@ JACK: Draws a portion of the picture in the status bar. void Sbar_DrawSubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight) { - Draw_SubPic (sbar_rect.x + x, sbar_rect.y + y+(sbar_rect.height-SBAR_HEIGHT), width, height, pic, srcx, srcy, srcwidth, srcheight); + R2D_SubPic (sbar_rect.x + x, sbar_rect.y + y+(sbar_rect.height-SBAR_HEIGHT), width, height, pic, srcx, srcy, srcwidth, srcheight); } /* @@ -1038,26 +1038,26 @@ void Sbar_FillPC (int x, int y, int w, int h, unsigned int pcolour) { if (pcolour >= 16) { - Draw_ImageColours (((pcolour&0xff0000)>>16)/255.0f, ((pcolour&0xff00)>>8)/255.0f, (pcolour&0xff)/255.0f, 1.0); - Draw_FillBlock (x, y, w, h); + R2D_ImageColours (((pcolour&0xff0000)>>16)/255.0f, ((pcolour&0xff00)>>8)/255.0f, (pcolour&0xff)/255.0f, 1.0); + R2D_FillBlock (x, y, w, h); } else { - Draw_ImagePaletteColour(Sbar_ColorForMap(pcolour), 1.0); - Draw_FillBlock (x, y, w, h); + R2D_ImagePaletteColour(Sbar_ColorForMap(pcolour), 1.0); + R2D_FillBlock (x, y, w, h); } } static void Sbar_FillPCDark (int x, int y, int w, int h, unsigned int pcolour) { if (pcolour >= 16) { - Draw_ImageColours (((pcolour&0xff0000)>>16)/1024.0f, ((pcolour&0xff00)>>8)/1024.0f, (pcolour&0xff)/1024.0f, 1.0); - Draw_FillBlock (x, y, w, h); + R2D_ImageColours (((pcolour&0xff0000)>>16)/1024.0f, ((pcolour&0xff00)>>8)/1024.0f, (pcolour&0xff)/1024.0f, 1.0); + R2D_FillBlock (x, y, w, h); } else { - Draw_ImagePaletteColour(Sbar_ColorForMap(pcolour)-1, 1.0); - Draw_FillBlock (x, y, w, h); + R2D_ImagePaletteColour(Sbar_ColorForMap(pcolour)-1, 1.0); + R2D_FillBlock (x, y, w, h); } } @@ -1669,7 +1669,7 @@ void Sbar_DrawFrags (void) } x+=4; } - Draw_ImageColours(1.0, 1.0, 1.0, 1.0); + R2D_ImageColours(1.0, 1.0, 1.0, 1.0); } //============================================================================= @@ -1879,14 +1879,14 @@ void Sbar_DrawScoreboard (void) void Sbar_Hexen2DrawItem(int pnum, int x, int y, int itemnum) { int num; - Sbar_DrawPic(x, y, 29, 28, Draw_SafeCachePic(va("gfx/arti%02d.lmp", itemnum))); + Sbar_DrawPic(x, y, 29, 28, R2D_SafeCachePic(va("gfx/arti%02d.lmp", itemnum))); num = cl.stats[pnum][STAT_H2_CNT_TORCH+itemnum]; if(num > 0) { if (num >= 10) - Sbar_DrawPic(x+20, y+21, 4, 6, Draw_SafeCachePic(va("gfx/artinum%d.lmp", num/10))); - Sbar_DrawPic(x+20+4, y+21, 4, 6, Draw_SafeCachePic(va("gfx/artinum%d.lmp", num%10))); + Sbar_DrawPic(x+20, y+21, 4, 6, R2D_SafeCachePic(va("gfx/artinum%d.lmp", num/10))); + Sbar_DrawPic(x+20+4, y+21, 4, 6, R2D_SafeCachePic(va("gfx/artinum%d.lmp", num%10))); } } @@ -1926,7 +1926,7 @@ void Sbar_Hexen2DrawInventory(int pnum) continue; if (i == sb_hexen2_cur_item[pnum]) - Sbar_DrawPic(x+9, y-12, 11, 11, Draw_SafeCachePic("gfx/artisel.lmp")); + Sbar_DrawPic(x+9, y-12, 11, 11, R2D_SafeCachePic("gfx/artisel.lmp")); Sbar_Hexen2DrawItem(pnum, x, y, i); x -= 33; } @@ -1937,7 +1937,7 @@ void Sbar_Hexen2DrawInventory(int pnum) if (i != sb_hexen2_cur_item[pnum] && !cl.stats[pnum][STAT_H2_CNT_TORCH+i]) continue; if (i == sb_hexen2_cur_item[pnum]) - Sbar_DrawPic(x+9, y-12, 11, 11, Draw_SafeCachePic("gfx/artisel.lmp")); + Sbar_DrawPic(x+9, y-12, 11, 11, R2D_SafeCachePic("gfx/artisel.lmp")); Sbar_Hexen2DrawItem(pnum, x, y, i); x+=33; } @@ -1985,8 +1985,8 @@ void Sbar_Hexen2DrawExtra (int pnum) //adjust it so there's space sbar_rect.y -= 46+98-SBAR_HEIGHT; - Sbar_DrawPic(0, 46, 160, 98, Draw_SafeCachePic("gfx/btmbar1.lmp")); - Sbar_DrawPic(160, 46, 160, 98, Draw_SafeCachePic("gfx/btmbar2.lmp")); + Sbar_DrawPic(0, 46, 160, 98, R2D_SafeCachePic("gfx/btmbar1.lmp")); + Sbar_DrawPic(160, 46, 160, 98, R2D_SafeCachePic("gfx/btmbar2.lmp")); Sbar_DrawTinyString (11, 48, pclassname[pclass]); @@ -2019,7 +2019,7 @@ void Sbar_Hexen2DrawExtra (int pnum) { if (cl.stats[pnum][STAT_H2_ARMOUR1+i] > 0) { - Sbar_DrawPic (164+i*40, 115, 28, 19, Draw_SafeCachePic(va("gfx/armor%d.lmp", i+1))); + Sbar_DrawPic (164+i*40, 115, 28, 19, R2D_SafeCachePic(va("gfx/armor%d.lmp", i+1))); Sbar_DrawTinyString (168+i*40, 136, va("+%d", cl.stats[pnum][STAT_H2_ARMOUR1+i])); } } @@ -2027,14 +2027,14 @@ void Sbar_Hexen2DrawExtra (int pnum) { if (cl.stats[pnum][STAT_H2_FLIGHT_T+i] > 0) { - Sbar_DrawPic (ringpos[i], 119, 32, 22, Draw_SafeCachePic(va("gfx/ring_f.lmp"))); + Sbar_DrawPic (ringpos[i], 119, 32, 22, R2D_SafeCachePic(va("gfx/ring_f.lmp"))); val = cl.stats[pnum][STAT_H2_FLIGHT_T+i]; if (val > 100) val = 100; if (val < 0) val = 0; - Sbar_DrawPic(ringpos[i]+29 - (int)(26 * (val/(float)100)),142, 26, 1, Draw_SafeCachePic("gfx/ringhlth.lmp")); - Sbar_DrawPic(ringpos[i]+29, 142, 26, 1, Draw_SafeCachePic("gfx/rhlthcvr.lmp")); + Sbar_DrawPic(ringpos[i]+29 - (int)(26 * (val/(float)100)),142, 26, 1, R2D_SafeCachePic("gfx/ringhlth.lmp")); + Sbar_DrawPic(ringpos[i]+29, 142, 26, 1, R2D_SafeCachePic("gfx/rhlthcvr.lmp")); } } @@ -2043,12 +2043,12 @@ void Sbar_Hexen2DrawExtra (int pnum) { if (cl.statsstr[pnum][STAT_H2_PUZZLE1+i]) { - Sbar_DrawPic (194+(slot%4)*31, slot<4?51:82, 26, 26, Draw_SafeCachePic(va("gfx/puzzle/%s.lmp", cl.statsstr[pnum][STAT_H2_PUZZLE1+i]))); + Sbar_DrawPic (194+(slot%4)*31, slot<4?51:82, 26, 26, R2D_SafeCachePic(va("gfx/puzzle/%s.lmp", cl.statsstr[pnum][STAT_H2_PUZZLE1+i]))); slot++; } } - Sbar_DrawPic(134, 50, 49, 56, Draw_SafeCachePic(va("gfx/cport%d.lmp", pclass))); + Sbar_DrawPic(134, 50, 49, 56, R2D_SafeCachePic(va("gfx/cport%d.lmp", pclass))); } int Sbar_Hexen2ArmourValue(int pnum) @@ -2089,11 +2089,11 @@ void Sbar_Hexen2DrawBasic(int pnum) { int chainpos; int val, maxval; - Sbar_DrawPic(0, 0, 160, 46, Draw_SafeCachePic("gfx/topbar1.lmp")); - Sbar_DrawPic(160, 0, 160, 46, Draw_SafeCachePic("gfx/topbar2.lmp")); - Sbar_DrawPic(0, -23, 51, 23, Draw_SafeCachePic("gfx/topbumpl.lmp")); - Sbar_DrawPic(138, -8, 39, 8, Draw_SafeCachePic("gfx/topbumpm.lmp")); - Sbar_DrawPic(269, -23, 51, 23, Draw_SafeCachePic("gfx/topbumpr.lmp")); + Sbar_DrawPic(0, 0, 160, 46, R2D_SafeCachePic("gfx/topbar1.lmp")); + Sbar_DrawPic(160, 0, 160, 46, R2D_SafeCachePic("gfx/topbar2.lmp")); + Sbar_DrawPic(0, -23, 51, 23, R2D_SafeCachePic("gfx/topbumpl.lmp")); + Sbar_DrawPic(138, -8, 39, 8, R2D_SafeCachePic("gfx/topbumpm.lmp")); + Sbar_DrawPic(269, -23, 51, 23, R2D_SafeCachePic("gfx/topbumpr.lmp")); //mana1 maxval = cl.stats[pnum][STAT_H2_MAXMANA]; @@ -2102,8 +2102,8 @@ void Sbar_Hexen2DrawBasic(int pnum) Sbar_DrawTinyString(201, 22, va("%03d", val)); if(val) { - Sbar_DrawPic(190, 26-(int)((val*18.0)/(float)maxval+0.5), 3, 19, Draw_SafeCachePic("gfx/bmana.lmp")); - Sbar_DrawPic(190, 27, 3, 19, Draw_SafeCachePic("gfx/bmanacov.lmp")); + Sbar_DrawPic(190, 26-(int)((val*18.0)/(float)maxval+0.5), 3, 19, R2D_SafeCachePic("gfx/bmana.lmp")); + Sbar_DrawPic(190, 27, 3, 19, R2D_SafeCachePic("gfx/bmanacov.lmp")); } //mana2 @@ -2113,8 +2113,8 @@ void Sbar_Hexen2DrawBasic(int pnum) Sbar_DrawTinyString(243, 22, va("%03d", val)); if(val) { - Sbar_DrawPic(232, 26-(int)((val*18.0)/(float)maxval+0.5), 3, 19, Draw_SafeCachePic("gfx/gmana.lmp")); - Sbar_DrawPic(232, 27, 3, 19, Draw_SafeCachePic("gfx/gmanacov.lmp")); + Sbar_DrawPic(232, 26-(int)((val*18.0)/(float)maxval+0.5), 3, 19, R2D_SafeCachePic("gfx/gmana.lmp")); + Sbar_DrawPic(232, 27, 3, 19, R2D_SafeCachePic("gfx/gmanacov.lmp")); } @@ -2132,10 +2132,10 @@ void Sbar_Hexen2DrawBasic(int pnum) chainpos = (195.0f*cl.stats[pnum][STAT_HEALTH]) / cl.stats[pnum][STAT_H2_MAXHEALTH]; if (chainpos < 0) chainpos = 0; - Sbar_DrawPic(45+((int)chainpos&7), 38, 222, 5, Draw_SafeCachePic("gfx/hpchain.lmp")); - Sbar_DrawPic(45+(int)chainpos, 36, 35, 9, Draw_SafeCachePic("gfx/hpgem.lmp")); - Sbar_DrawPic(43, 36, 10, 10, Draw_SafeCachePic("gfx/chnlcov.lmp")); - Sbar_DrawPic(267, 36, 10, 10, Draw_SafeCachePic("gfx/chnrcov.lmp")); + Sbar_DrawPic(45+((int)chainpos&7), 38, 222, 5, R2D_SafeCachePic("gfx/hpchain.lmp")); + Sbar_DrawPic(45+(int)chainpos, 36, 35, 9, R2D_SafeCachePic("gfx/hpgem.lmp")); + Sbar_DrawPic(43, 36, 10, 10, R2D_SafeCachePic("gfx/chnlcov.lmp")); + Sbar_DrawPic(267, 36, 10, 10, R2D_SafeCachePic("gfx/chnrcov.lmp")); Sbar_Hexen2DrawItem(pnum, 144, 3, sb_hexen2_cur_item[pnum]); @@ -2145,8 +2145,8 @@ void Sbar_Hexen2DrawMinimal(int pnum) { int y; y = -16; - Sbar_DrawPic(3, y, 31, 17, Draw_SafeCachePic("gfx/bmmana.lmp")); - Sbar_DrawPic(3, y+18, 31, 17, Draw_SafeCachePic("gfx/gmmana.lmp")); + Sbar_DrawPic(3, y, 31, 17, R2D_SafeCachePic("gfx/bmmana.lmp")); + Sbar_DrawPic(3, y+18, 31, 17, R2D_SafeCachePic("gfx/gmmana.lmp")); Sbar_DrawTinyString(10, y+6, va("%03d", cl.stats[pnum][STAT_H2_BLUEMANA])); Sbar_DrawTinyString(10, y+18+6, va("%03d", cl.stats[pnum][STAT_H2_GREENMANA])); @@ -2338,7 +2338,7 @@ void Sbar_Draw (void) if (cls.protocol == CP_QUAKE2) { SCR_VRectForPlayer(&sbar_rect, 0); - Draw_ImageColours(1, 1, 1, 1); + R2D_ImageColours(1, 1, 1, 1); if (*cl.q2statusbar) Sbar_ExecuteLayoutString(cl.q2statusbar); if (*cl.q2layout) @@ -2352,7 +2352,7 @@ void Sbar_Draw (void) Sbar_Start(); - Draw_ImageColours(1, 1, 1, 1); + R2D_ImageColours(1, 1, 1, 1); for (pnum = 0; pnum < cl.splitclients; pnum++) { @@ -2474,10 +2474,10 @@ void Sbar_Draw (void) { if (cl.splitclients==1 && sbar_rect.x>0) { // left - Draw_TileClear (0, sbar_rect.height - sb_lines, sbar_rect.x, sb_lines); + R2D_TileClear (0, sbar_rect.height - sb_lines, sbar_rect.x, sb_lines); } if (sbar_rect.x + 320 <= sbar_rect.width && !headsup) - Draw_TileClear (sbar_rect.x + 320, sbar_rect.height - sb_lines, sbar_rect.width - (320), sb_lines); + R2D_TileClear (sbar_rect.x + 320, sbar_rect.height - sb_lines, sbar_rect.width - (320), sb_lines); } #endif @@ -2523,7 +2523,7 @@ void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color) else frame = *ptr -'0'; - Draw_ScalePic (x,y, 16, 24, sb_nums[color][frame]); + R2D_ScalePic (x,y, 16, 24, sb_nums[color][frame]); x += 24; ptr++; } @@ -2558,11 +2558,11 @@ void Sbar_TeamOverlay (void) if (scr_scoreboard_drawtitle.ival) { - pic = Draw_SafeCachePic ("gfx/ranking.lmp"); + pic = R2D_SafeCachePic ("gfx/ranking.lmp"); if (pic) { k = (pic->width * 24) / pic->height; - Draw_ScalePic ((vid.width-k)/2, 0, k, 24, pic); + R2D_ScalePic ((vid.width-k)/2, 0, k, 24, pic); } y += 24; } @@ -2763,11 +2763,11 @@ void Sbar_DeathmatchOverlay (int start) y = 0; if (scr_scoreboard_drawtitle.ival) { - pic = Draw_SafeCachePic ("gfx/ranking.lmp"); + pic = R2D_SafeCachePic ("gfx/ranking.lmp"); if (pic) { k = (pic->width * 24) / pic->height; - Draw_ScalePic ((vid.width-k)/2, 0, k, 24, pic); + R2D_ScalePic ((vid.width-k)/2, 0, k, 24, pic); } y += 24; } @@ -2832,12 +2832,12 @@ void Sbar_DeathmatchOverlay (int start) if (scr_scoreboard_newstyle.ival) { // Electro's scoreboard eyecandy: Draw top border - Draw_ImagePaletteColour (0, 1.0); - Draw_FillBlock(startx - 3, y - 1, rank_width - 1, 1); + R2D_ImagePaletteColour (0, 1.0); + R2D_FillBlock(startx - 3, y - 1, rank_width - 1, 1); // Electro's scoreboard eyecandy: Draw the title row background - Draw_ImagePaletteColour (1, 1.0); - Draw_FillBlock(startx - 2, y, rank_width - 3, 9); + R2D_ImagePaletteColour (1, 1.0); + R2D_FillBlock(startx - 2, y, rank_width - 3, 9); } x = startx; @@ -2868,14 +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); + R2D_ImageColours(1.0, 1.0, 1.0, 1.0); } void Sbar_ChatModeOverlay(void) @@ -3199,30 +3199,30 @@ void Sbar_CoopIntermission (void) sbar_rect.x = 0; sbar_rect.y = 0; - pic = Draw_SafeCachePic ("gfx/complete.lmp"); + pic = R2D_SafeCachePic ("gfx/complete.lmp"); if (!pic) return; - Draw_ScalePic ((sbar_rect.width - 320)/2 + 64, (sbar_rect.height - 200)/2 + 24, 192, 24, pic); + R2D_ScalePic ((sbar_rect.width - 320)/2 + 64, (sbar_rect.height - 200)/2 + 24, 192, 24, pic); - pic = Draw_SafeCachePic ("gfx/inter.lmp"); + pic = R2D_SafeCachePic ("gfx/inter.lmp"); if (pic) - Draw_ScalePic ((sbar_rect.width - 320)/2 + 0, (sbar_rect.height - 200)/2 + 56, 160, 144, pic); + R2D_ScalePic ((sbar_rect.width - 320)/2 + 0, (sbar_rect.height - 200)/2 + 56, 160, 144, pic); // time dig = cl.completed_time/60; Sbar_IntermissionNumber ((sbar_rect.width - 320)/2 + 160, (sbar_rect.height - 200)/2 + 64, dig, 3, 0); num = cl.completed_time - dig*60; - Draw_ScalePic ((sbar_rect.width - 320)/2 + 234,(sbar_rect.height - 200)/2 + 64, 16, 24, sb_colon); - Draw_ScalePic ((sbar_rect.width - 320)/2 + 246,(sbar_rect.height - 200)/2 + 64, 16, 26, sb_nums[0][num/10]); - Draw_ScalePic ((sbar_rect.width - 320)/2 + 266,(sbar_rect.height - 200)/2 + 64, 16, 24, sb_nums[0][num%10]); + R2D_ScalePic ((sbar_rect.width - 320)/2 + 234,(sbar_rect.height - 200)/2 + 64, 16, 24, sb_colon); + R2D_ScalePic ((sbar_rect.width - 320)/2 + 246,(sbar_rect.height - 200)/2 + 64, 16, 26, sb_nums[0][num/10]); + R2D_ScalePic ((sbar_rect.width - 320)/2 + 266,(sbar_rect.height - 200)/2 + 64, 16, 24, sb_nums[0][num%10]); //it is assumed that secrits/monsters are going to be constant for any player... Sbar_IntermissionNumber ((sbar_rect.width - 320)/2 + 160, (sbar_rect.height - 200)/2 + 104, cl.stats[0][STAT_SECRETS], 3, 0); - Draw_ScalePic ((sbar_rect.width - 320)/2 + 232,(sbar_rect.height - 200)/2 + 104, 16, 24, sb_slash); + R2D_ScalePic ((sbar_rect.width - 320)/2 + 232,(sbar_rect.height - 200)/2 + 104, 16, 24, sb_slash); Sbar_IntermissionNumber ((sbar_rect.width - 320)/2 + 240, (sbar_rect.height - 200)/2 + 104, cl.stats[0][STAT_TOTALSECRETS], 3, 0); Sbar_IntermissionNumber ((sbar_rect.width - 320)/2 + 160, (sbar_rect.height - 200)/2 + 144, cl.stats[0][STAT_MONSTERS], 3, 0); - Draw_ScalePic ((sbar_rect.width - 320)/2 + 232,(sbar_rect.height - 200)/2 + 144, 16, 24, sb_slash); + R2D_ScalePic ((sbar_rect.width - 320)/2 + 232,(sbar_rect.height - 200)/2 + 144, 16, 24, sb_slash); Sbar_IntermissionNumber ((sbar_rect.width - 320)/2 + 240, (sbar_rect.height - 200)/2 + 144, cl.stats[0][STAT_TOTALMONSTERS], 3, 0); } /* @@ -3263,8 +3263,8 @@ void Sbar_FinaleOverlay (void) if (UI_DrawFinale()>0) return; #endif - pic = Draw_SafeCachePic ("gfx/finale.lmp"); + pic = R2D_SafeCachePic ("gfx/finale.lmp"); if (pic) - Draw_ScalePic ( (vid.width-pic->width)/2, 16, pic->width, pic->height, pic); + R2D_ScalePic ( (vid.width-pic->width)/2, 16, pic->width, pic->height, pic); } diff --git a/engine/client/textedit.c b/engine/client/textedit.c index 348308375..33815f456 100644 --- a/engine/client/textedit.c +++ b/engine/client/textedit.c @@ -870,7 +870,7 @@ void Editor_Draw(void) key_dest = key_editor; if ((editoractive && cls.state == ca_disconnected) || editormodal) - Draw_EditorBackground(); + R2D_EditorBackground(); if (cursorlinenum < 0) //look for the cursor line num { diff --git a/engine/common/fs.c b/engine/common/fs.c index 2fdb8610d..7ebae1194 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -1065,21 +1065,10 @@ qbyte *COM_LoadFile (const char *path, int usehunk) Sys_Error ("COM_LoadFile: not enough space for %s", path); ((qbyte *)buf)[len] = 0; -#ifndef SERVERONLY - if (qrenderer != QR_NONE) - if (Draw_BeginDisc) - Draw_BeginDisc (); -#endif VFS_READ(f, buf, len); VFS_CLOSE(f); -#ifndef SERVERONLY - if (qrenderer != QR_NONE) - if (Draw_EndDisc) - Draw_EndDisc (); -#endif - return buf; } diff --git a/engine/common/plugin.c b/engine/common/plugin.c index b16746179..a215ee446 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -1638,8 +1638,7 @@ void Plug_SBar(void) for (cp = 0; cp < cl.splitclients; cp++) { //if you don't use splitscreen, use a full videosize rect. SCR_VRectForPlayer(&rect, cp); - if (Draw_ImageColours) - Draw_ImageColours(1, 1, 1, 1); // ensure menu colors are reset + R2D_ImageColours(1, 1, 1, 1); // ensure menu colors are reset ret |= VM_Call(currentplug->vm, currentplug->sbarlevel[0], cp, rect.x, rect.y, rect.width, rect.height, sb_showscores+sb_showteamscores*2); } break; @@ -1658,8 +1657,7 @@ void Plug_SBar(void) for (cp = 0; cp < cl.splitclients; cp++) { //if you don't use splitscreen, use a full videosize rect. SCR_VRectForPlayer(&rect, cp); - if (Draw_ImageColours) - Draw_ImageColours(1, 1, 1, 1); // ensure menu colors are reset + R2D_ImageColours(1, 1, 1, 1); // ensure menu colors are reset ret |= VM_Call(currentplug->vm, currentplug->sbarlevel[1], cp, rect.x, rect.y, rect.width, rect.height, sb_showscores+sb_showteamscores*2); } } @@ -1672,8 +1670,7 @@ void Plug_SBar(void) for (cp = 0; cp < cl.splitclients; cp++) { //if you don't use splitscreen, use a full videosize rect. SCR_VRectForPlayer(&rect, cp); - if (Draw_ImageColours) - Draw_ImageColours(1, 1, 1, 1); // ensure menu colors are reset + R2D_ImageColours(1, 1, 1, 1); // ensure menu colors are reset ret |= VM_Call(currentplug->vm, currentplug->sbarlevel[2], cp, rect.x, rect.y, rect.width, rect.height, sb_showscores+sb_showteamscores*2); } } diff --git a/engine/d3d/vid_d3d.c b/engine/d3d/vid_d3d.c index b838aca50..a91937011 100644 --- a/engine/d3d/vid_d3d.c +++ b/engine/d3d/vid_d3d.c @@ -974,7 +974,7 @@ static void (D3D9_SCR_UpdateScreen) (void) scr_con_current = vid.height; if (scr_con_current != vid.height) - Draw_ConsoleBackground(0, vid.height, true); + R2D_ConsoleBackground(0, vid.height, true); else scr_con_forcedraw = true; @@ -1011,12 +1011,6 @@ static void (D3D9_SCR_UpdateScreen) (void) -static void (D3D9_Draw_BeginDisc) (void) -{ -} -static void (D3D9_Draw_EndDisc) (void) -{ -} static void (D3D9_Draw_Init) (void) @@ -1032,14 +1026,6 @@ static void (D3D9_Draw_Crosshair) (void) static void (D3D9_Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation) { } -static void (D3D9_Draw_Fill) (int x, int y, int w, int h, unsigned int c) -{ -} -static void (D3D9_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b) -{ -} -static void (D3D9_Draw_BeginDisc) (void); -static void (D3D9_Draw_EndDisc) (void); static void (D3D9_R_Init) (void) { @@ -1165,25 +1151,10 @@ rendererinfo_t d3drendererinfo = }, QR_DIRECT3D, - R2D_SafePicFromWad, - R2D_SafeCachePic, D3D9_Draw_Init, D3D9_Draw_ReInit, D3D9_Draw_Crosshair, - R2D_ScalePic, - R2D_SubPic, D3D9_Draw_TransPicTranslate, - R2D_ConsoleBackground, - R2D_EditorBackground, - R2D_TileClear, - D3D9_Draw_Fill, - D3D9_Draw_FillRGB, - R2D_FadeScreen, - D3D9_Draw_BeginDisc, - D3D9_Draw_EndDisc, - - R2D_Image, - R2D_ImageColours, D3D9_LoadTexture, D3D9_LoadTexture8Pal24, diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index ffa3a5f36..641d12f45 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -364,9 +364,9 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n")); qglClear(GL_COLOR_BUFFER_BIT); { - mpic_t *pic = Draw_SafeCachePic ("gfx/loading.lmp"); + mpic_t *pic = R2D_SafeCachePic ("gfx/loading.lmp"); if (pic) - Draw_ScalePic ( ((int)vid.width - pic->width)/2, + R2D_ScalePic ( ((int)vid.width - pic->width)/2, ((int)vid.height - 48 - pic->height)/2, pic->width, pic->height, pic); } @@ -393,8 +393,8 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n")); // // get the other pics we need // - TRACE(("dbg: GLDraw_ReInit: Draw_SafePicFromWad\n")); - draw_disc = Draw_SafePicFromWad ("disc"); + TRACE(("dbg: GLDraw_ReInit: R2D_SafePicFromWad\n")); + draw_disc = R2D_SafePicFromWad ("disc"); #ifdef GL_USE8BITTEX inited15to8 = false; @@ -654,81 +654,9 @@ void GLDraw_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qglEnd (); } -void GLDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b) -{ - if (gl_config.gles) - return; //TODO: DRAW FILL NOT FIXED YET - qglDisable (GL_TEXTURE_2D); - qglColor3f (r, g, b); - - qglBegin (GL_QUADS); - - qglVertex2f (x,y); - qglVertex2f (x+w, y); - qglVertex2f (x+w, y+h); - qglVertex2f (x, y+h); - - qglEnd (); - qglColor3f (1,1,1); - qglEnable (GL_TEXTURE_2D); -} - -/* -============= -Draw_Fill - -Fills a box of pixels with a single color -============= -*/ -void GLDraw_Fill (int x, int y, int w, int h, unsigned int c) -{ - unsigned int r, g, b; - extern qboolean gammaworks; - - r = host_basepal[c*3]; - g = host_basepal[c*3+1]; - b = host_basepal[c*3+2]; - - if (!gammaworks) - { - r = gammatable[r]; - g = gammatable[r]; - b = gammatable[r]; - } - - GLDraw_FillRGB (x, y, w, h, - r/255.0, - g/255.0, - b/255.0); -} //============================================================================= -/* -================ -Draw_BeginDisc - -Draws the little blue disc in the corner of the screen. -Call before beginning any disc IO. -================ -*/ -void GLDraw_BeginDisc (void) -{ -} - - -/* -================ -Draw_EndDisc - -Erases the disc icon. -Call after completing any disc IO -================ -*/ -void GLDraw_EndDisc (void) -{ -} - /* ================ GL_Set2D diff --git a/engine/gl/gl_draw.h b/engine/gl/gl_draw.h index 9464c6ae7..0c04c8a4e 100644 --- a/engine/gl/gl_draw.h +++ b/engine/gl/gl_draw.h @@ -26,10 +26,6 @@ void GLDraw_ReInit (void); void GLDraw_DeInit (void); void Surf_DeInit (void); void GLDraw_TransPicTranslate (int x, int y, int w, int h, qbyte *pic, qbyte *translation); -void GLDraw_BeginDisc (void); -void GLDraw_EndDisc (void); -void GLDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b); -void GLDraw_Fill (int x, int y, int w, int h, unsigned int c); void GLDraw_Crosshair(void); void GLDraw_LevelPic (mpic_t *pic); diff --git a/engine/gl/gl_font.c b/engine/gl/gl_font.c index cf09a1b44..3ff3aa29a 100644 --- a/engine/gl/gl_font.c +++ b/engine/gl/gl_font.c @@ -1102,8 +1102,6 @@ void Font_InvalidateColour(void) font_colourmask = ~0; } -void GLDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b); - //draw a character from the current font at a pixel location. int Font_DrawChar(int px, int py, unsigned int charcode) { diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index 6334c9cbf..9a8c13eb5 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -192,14 +192,9 @@ void GLSCR_UpdateScreen (void) //draw the levelshot or the conback fullscreen if (*levelshotname) - { - if(Draw_ScalePic) - Draw_ScalePic(0, 0, vid.width, vid.height, Draw_SafeCachePic (levelshotname)); - else if (scr_con_current != vid.height) - Draw_ConsoleBackground(0, vid.height, true); - } + R2D_ScalePic(0, 0, vid.width, vid.height, R2D_SafeCachePic (levelshotname)); else if (scr_con_current != vid.height) - Draw_ConsoleBackground(0, vid.height, true); + R2D_ConsoleBackground(0, vid.height, true); else scr_con_forcedraw = true; diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index 446576c46..d9e74b996 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -684,6 +684,7 @@ static void Shader_Sort ( shader_t *shader, shaderpass_t *pass, char **ptr ) { char *token; + token = Shader_ParseString ( ptr ); if ( !Q_stricmp( token, "portal" ) ) { shader->sort = SHADER_SORT_PORTAL; diff --git a/engine/gl/gl_shadow.c b/engine/gl/gl_shadow.c index d3fc2f7dc..5bcfc1339 100644 --- a/engine/gl/gl_shadow.c +++ b/engine/gl/gl_shadow.c @@ -1965,15 +1965,15 @@ static qboolean Sh_DrawStencilLight(dlight_t *dl, vec3_t colour, qbyte *vvis) { qglColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE); qglStencilFunc(GL_GREATER, 1, ~0); - Draw_ConsoleBackground(vid.height); + R2D_ConsoleBackground(vid.height); qglColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); qglStencilFunc(GL_LESS, 1, ~0); - Draw_ConsoleBackground(vid.height); + R2D_ConsoleBackground(vid.height); qglColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_FALSE); qglStencilFunc(GL_NEVER, 1, ~0); - Draw_ConsoleBackground(vid.height); + R2D_ConsoleBackground(vid.height); } qglMatrixMode(GL_PROJECTION); diff --git a/engine/gl/gl_vidcommon.c b/engine/gl/gl_vidcommon.c index 9730e59f3..88626f967 100644 --- a/engine/gl/gl_vidcommon.c +++ b/engine/gl/gl_vidcommon.c @@ -1065,25 +1065,10 @@ rendererinfo_t openglrendererinfo = { QR_OPENGL, - R2D_SafePicFromWad, - R2D_SafeCachePic, GLDraw_Init, GLDraw_ReInit, GLDraw_Crosshair, - R2D_ScalePic, - R2D_SubPic, GLDraw_TransPicTranslate, - R2D_ConsoleBackground, - R2D_EditorBackground, - R2D_TileClear, - GLDraw_Fill, - GLDraw_FillRGB, - R2D_FadeScreen, - GLDraw_BeginDisc, - GLDraw_EndDisc, - - R2D_Image, - R2D_ImageColours, GL_LoadTextureFmt, GL_LoadTexture8Pal24,