diff --git a/Quake/gl_draw.c b/Quake/gl_draw.c index 3c5bed4a..04d83b0c 100644 --- a/Quake/gl_draw.c +++ b/Quake/gl_draw.c @@ -980,26 +980,43 @@ void Draw_TransPicTranslate (int x, int y, qpic_t *pic, plcolour_t top, plcolour Draw_Pic (x, y, pic); } +extern cvar_t scr_concolor; // woods #concolor + /* ================ -Draw_ConsoleBackground -- johnfitz -- rewritten +Draw_ConsoleBackground -- johnfitz -- rewritten -- woods #concolor ================ */ void Draw_ConsoleBackground (void) { qpic_t *pic; float alpha; + plcolour_t conback_color; + const char* conback_str = scr_concolor.string; + + // Parse the scr_conback cvar + conback_color = CL_PLColours_Parse(conback_str); - pic = Draw_CachePic ("gfx/conback.lmp"); - pic->width = vid.conwidth; - pic->height = vid.conheight; + // Determine if the default background image should be used + int use_default = (conback_color.type == 0 || + (conback_color.type == 2 && + conback_color.rgb[0] == 0xFF && + conback_color.rgb[1] == 0xFF && + conback_color.rgb[2] == 0xFF)); + + GL_SetCanvas (CANVAS_CONSOLE); // Ensure we're drawing on the console canvas alpha = (con_forcedup) ? 1.0f : scr_conalpha.value; - GL_SetCanvas (CANVAS_CONSOLE); //in case this is called from weird places + if (alpha <= 0.0f) + return; // Nothing to draw - if (alpha > 0.0f) + if (use_default) // Use the default background image { + pic = Draw_CachePic ("gfx/conback.lmp"); + pic->width = vid.conwidth; + pic->height = vid.conheight; + if (alpha < 1.0f) { if (premul_hud) @@ -1027,8 +1044,41 @@ void Draw_ConsoleBackground (void) glColor4f (1,1,1,1); } } -} + else + { + byte* rgb = CL_PLColours_ToRGB(&conback_color); // Render a solid color background based on scr_conback + float r, g, b; + if (rgb) + { + r = rgb[0] / 255.0f; + g = rgb[1] / 255.0f; + b = rgb[2] / 255.0f; + } + else + r = g = b = 1.0f; // Fallback to white if RGB is not available + + // Set the color with alpha + glColor4f(r, g, b, alpha); + + // Enable blending for transparency + glEnable (GL_BLEND); + glDisable(GL_TEXTURE_2D); // Disable texture rendering + + // Draw a filled quad covering the console area + glBegin(GL_QUADS); + glVertex2f(0, 0); + glVertex2f(vid.conwidth, 0); + glVertex2f(vid.conwidth, vid.conheight); + glVertex2f(0, vid.conheight); + glEnd(); + + // Reset OpenGL states + glEnable(GL_TEXTURE_2D); // Re-enable textures + glDisable(GL_BLEND); + glColor4f(1, 1, 1, 1); // Reset color + } +} /* ============= diff --git a/Quake/gl_model.c b/Quake/gl_model.c index a8317414..416fe855 100644 --- a/Quake/gl_model.c +++ b/Quake/gl_model.c @@ -54,6 +54,8 @@ cvar_t gl_load24bit_skins = {"gl_load24bit_skins", "0", CVAR_ARCHIVE }; // woods cvar_t gl_load24bit_hud = {"gl_load24bit_hud", "1", CVAR_ARCHIVE}; // woods #24bithud void Cache_Flush_f (cvar_t* var); // woods #loadskins +cvar_t scr_concolor = {"scr_concolor", "", CVAR_ARCHIVE}; // woods #concolor + extern cvar_t r_fastturb; // woods #fastturb static byte *mod_novis; @@ -89,6 +91,7 @@ void Mod_Init (void) Cvar_RegisterVariable (&gl_load24bit_hud); // woods #24bithud Cvar_RegisterVariable (&mod_lightscale_broken); Cvar_RegisterVariable (&mod_lightgrid); + Cvar_RegisterVariable (&scr_concolor); // woods #concolor Cmd_AddCommand ("mcache", Mod_Print); diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index b255666e..3d78b618 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -1757,7 +1757,8 @@ void VID_Init (void) "vid_desktopfullscreen", "vid_borderless", "gl_load24bit", //including this here so we don't start up to the wrong setting. - "gl_load24bit_hud" // woods #24bithud + "gl_load24bit_hud", // woods #24bithud + "scr_concolor" // woods #concolor }; #define num_readvars ( sizeof(read_vars)/sizeof(read_vars[0]) )