From c30d79eb31f78cfd78fb6d604894726ce149e79c Mon Sep 17 00:00:00 2001 From: TimeServ Date: Sat, 6 Aug 2005 07:18:29 +0000 Subject: [PATCH] fix to sw character drawing (should speed SW up) gl_blend2d (hackish cvar to get 2d blending, should work?) fixes to pluginless compile few other small changes git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1202 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 2 ++ engine/client/cl_parse.c | 2 +- engine/client/cl_screen.c | 12 +++++++-- engine/client/console.c | 16 ++++++------ engine/client/pr_csqc.c | 5 ++++ engine/client/renderer.c | 4 +++ engine/common/console.h | 2 +- engine/gl/gl_draw.c | 13 ++++++++-- engine/sw/sw_draw.c | 9 +++++-- engine/sw/sw_screen.c | 54 --------------------------------------- 10 files changed, 49 insertions(+), 70 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index baa8f3e21..5ead7d5be 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1676,8 +1676,10 @@ void CL_ConnectionlessPacket (void) else net_message.data[net_message.cursize] = '\0'; +#ifdef PLUGINS if (Plug_ConnectionlessClientPacket(net_message.data+4, net_message.cursize-4)) return; +#endif c = MSG_ReadByte (); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 90c011ba9..9e5bfbc30 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -3712,7 +3712,7 @@ void CLQ2_ParseServerMessage (void) if (i == PRINT_CHAT) { S_LocalSound ("misc/talk.wav"); - con_ormask = 0x8000; + con_ormask = CON_2NDCHARSETTEXT; if (CL_ParseChat(s)) { CL_ParsePrint(s, i); diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 6e537379d..3c08ce4dc 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -1849,9 +1849,11 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) if (scr_drawdialog) { -#ifdef PLUGINS if (!nohud) +#ifdef PLUGINS Plug_SBar (); +#else + Sbar_Draw (); #endif SCR_ShowPics_Draw(); Draw_FadeScreen (); @@ -1861,8 +1863,12 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) else if (scr_drawloading) { SCR_DrawLoading (); + + if (!nohud) #ifdef PLUGINS - Plug_SBar (); + Plug_SBar (); +#else + Sbar_Draw (); #endif SCR_ShowPics_Draw(); } @@ -1894,6 +1900,8 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) SCR_DrawPause (); #ifdef PLUGINS Plug_SBar (); +#else + Sbar_Draw (); #endif SCR_ShowPics_Draw(); diff --git a/engine/client/console.c b/engine/client/console.c index a17797c27..bac056f38 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -24,14 +24,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //this is the same order as q3, except that white and black are swapped... consolecolours_t consolecolours[] = { #define CON_WHITEMASK 7*256 //must be constant. things assume this - {0, 0, 0}, - {1, 0, 0}, - {0, 1, 0}, - {1, 1, 0}, - {0.1, 0.1, 1}, //brighten dark blue a little - {1, 0, 1}, - {0, 1, 1}, - {1, 1, 1} + {0, 0, 0, 0x0000}, + {1, 0, 0, 0x001F}, + {0, 1, 0, 0x03E0}, + {1, 1, 0, 0x03FF}, + {0.1, 0.1, 1, 0x7C00}, //brighten dark blue a little + {1, 0, 1, 0x7C1F}, + {0, 1, 1, 0x7FE0}, + {1, 1, 1, 0x7FFF} }; int con_ormask; diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 0d367116c..733f21a1f 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -932,7 +932,12 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global vid.recalc_refdef = 1; if (csqc_drawsbar) +#ifdef PLUGINS + Plug_SBar(); +#else Sbar_Draw(); +#endif + if (csqc_addcrosshair) Draw_Crosshair(); } diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 572cf87e6..44977836f 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -163,6 +163,8 @@ cvar_t gl_shadeq3 = {"gl_shadeq3", "1"}; //use if you want. extern cvar_t r_vertexlight; cvar_t gl_shadeq1 = {"gl_shadeq1", "0", NULL, CVAR_CHEAT}; //FIXME: :( cvar_t gl_shadeq1_name = {"gl_shadeq1_name", "*"}; + +cvar_t gl_blend2d = {"gl_blend2d", "0"}; #endif cvar_t r_bloodstains = {"r_bloodstains", "1"}; @@ -333,6 +335,8 @@ void GLRenderer_Init(void) Cvar_Register (&gl_shadeq1, GLRENDEREROPTIONS); Cvar_Register (&gl_shadeq1_name, GLRENDEREROPTIONS); Cvar_Register (&gl_shadeq3, GLRENDEREROPTIONS); + + Cvar_Register (&gl_blend2d, GLRENDEREROPTIONS); #endif } #endif diff --git a/engine/common/console.h b/engine/common/console.h index f564a6340..e202c6060 100644 --- a/engine/common/console.h +++ b/engine/common/console.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAXCONCOLOURS 8 typedef struct { float r, g, b; - int pal; + int rgbmask; } consolecolours_t; extern consolecolours_t consolecolours[MAXCONCOLOURS]; diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index abeaa5fc1..d3dbe0e01 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -63,6 +63,7 @@ extern cvar_t gl_savecompressedtex; extern cvar_t gl_load24bit; +extern cvar_t gl_blend2d; extern cvar_t con_ocranaleds; qbyte *draw_chars; // 8*8 graphic characters @@ -1928,8 +1929,16 @@ void GL_Set2D (void) qglDisable (GL_DEPTH_TEST); qglDisable (GL_CULL_FACE); - qglDisable (GL_BLEND); - qglEnable (GL_ALPHA_TEST); + if (gl_blend2d.value) + { + qglEnable (GL_BLEND); + qglDisable (GL_ALPHA_TEST); + } + else + { + qglDisable (GL_BLEND); + qglEnable (GL_ALPHA_TEST); + } // qglDisable (GL_ALPHA_TEST); qglColor4f (1,1,1,1); diff --git a/engine/sw/sw_draw.c b/engine/sw/sw_draw.c index 0ef7b5eb2..5c8666a05 100644 --- a/engine/sw/sw_draw.c +++ b/engine/sw/sw_draw.c @@ -652,9 +652,15 @@ void SWDraw_Character (int x, int y, unsigned int num) } } +/* #define FindPalette(r,g,b) pal555to8[((r&0xF8)>>3)|((g&0xF8)<<2)|((b&0xF8)<<7)] #define colourmask(p,r,g,b) FindPalette(host_basepal[p*3]*r, host_basepal[p*3+1]*g, host_basepal[p*3+2]*b) #define draw(p) colourmask(p, (int)consolecolours[colour].r, (int)consolecolours[colour].g, (int)consolecolours[colour].b) +*/ + +#define drawpal(r,g,b) pal555to8[(r|(g<<5)|(b<<10)) & consolecolours[colour].rgbmask] +#define draw(p) drawpal(host_basepal[p*3]>>3,host_basepal[p*3+1]>>3,host_basepal[p*3+2]>>3) + void SWDraw_ColouredCharacter (int x, int y, unsigned int num) { qbyte *source; @@ -677,7 +683,7 @@ int colour; return; } - if (colour == 0) //0 is white anyway (speedup) + if (colour == COLOR_WHITE) { Draw_Character(x, y, num); return; @@ -697,7 +703,6 @@ int colour; else drawline = 8; - if (r_pixbytes == 1) { qbyte *dest; diff --git a/engine/sw/sw_screen.c b/engine/sw/sw_screen.c index f320f704d..84d8447e8 100644 --- a/engine/sw/sw_screen.c +++ b/engine/sw/sw_screen.c @@ -164,61 +164,7 @@ void SWSCR_UpdateScreen (void) D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly -#if 1 SCR_DrawTwoDimensional(uimenu, nohud); -#else - if (scr_drawloading) - { - SCR_DrawLoading (); -#ifdef PLUGINS - Plug_SBar (); -#endif - SCR_ShowPics_Draw(); - } - else if (scr_drawdialog) - { -#ifdef PLUGINS - Plug_SBar (); -#endif - SCR_ShowPics_Draw(); - Draw_FadeScreen (); - SCR_DrawNotifyString (); - scr_copyeverything = true; - } - else if (cl.intermission == 1 && key_dest == key_game) - { - Sbar_IntermissionOverlay (); - } - else if (cl.intermission == 2 && key_dest == key_game) - { - Sbar_FinaleOverlay (); - SCR_CheckDrawCenterString (); - } - else - { - Draw_Crosshair(); - - SCR_DrawRam (); - SCR_DrawNet (); - SCR_DrawTurtle (); - SCR_DrawPause (); - SCR_DrawFPS (); - SCR_DrawUPS (); - SCR_DrawClock(); -#ifdef PLUGINS - Plug_SBar (); -#endif - SCR_ShowPics_Draw(); - SCR_CheckDrawCenterString (); -#ifdef TEXTEDITOR - if (editoractive) - Editor_Draw(); -#endif - SCR_DrawConsole (false); - M_Draw (uimenu); - } -#endif - D_DisableBackBufferAccess (); // for adapters that can't stay mapped in // for linear writes all the time