From 4578b1af0dbeb1599fe63c9729f1c99527c403b7 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 21 Sep 2022 17:31:18 +0900 Subject: [PATCH] [vid] Remove console view from viddef_t This breaks console scaling for now (con_width and con_height are gone), but is a major step towards window resize support as console stuff should never have been in viddef_t in the first place. The client screen init code now sets up a screen view (actually the renderer's scr_view) that is passed to the client console so it can know the size of the screen. The same view is used by the status bar code. Also, the ram/cache/paused icon drawing is moved into the client screen update code. A bit of duplication, but I do plan on merging that eventually. --- include/QF/plugin/console.h | 1 + include/QF/screen.h | 4 - include/QF/vid.h | 1 - libs/console/client.c | 16 +-- libs/video/renderer/gl/gl_draw.c | 26 ++-- libs/video/renderer/glsl/glsl_draw.c | 17 ++- libs/video/renderer/r_cvar.c | 30 ---- libs/video/renderer/r_progs.c | 4 +- libs/video/renderer/r_screen.c | 62 +-------- libs/video/renderer/sw/draw.c | 44 +++--- libs/video/renderer/vid_render_vulkan.c | 4 +- libs/video/renderer/vulkan/vulkan_draw.c | 24 ++-- libs/video/targets/vid.c | 55 ++------ libs/video/targets/vid_x11_sw.c | 5 - nq/include/client.h | 2 + nq/source/cl_main.c | 1 + nq/source/cl_screen.c | 167 ++++++++++++++++++----- nq/source/sbar.c | 48 +++---- qw/include/client.h | 2 + qw/source/cl_main.c | 1 + qw/source/cl_screen.c | 160 ++++++++++++++++++---- qw/source/sbar.c | 35 +++-- 22 files changed, 388 insertions(+), 321 deletions(-) diff --git a/include/QF/plugin/console.h b/include/QF/plugin/console.h index d24fabca8..1c9f02f5c 100644 --- a/include/QF/plugin/console.h +++ b/include/QF/plugin/console.h @@ -51,6 +51,7 @@ typedef struct console_data_s { int ormask; void (*quit) (void); struct cbuf_s *cbuf; + struct view_s *screen_view; struct view_s *view; struct view_s *status_view; float lines; diff --git a/include/QF/screen.h b/include/QF/screen.h index d53b1b1ee..bf0c60ee1 100644 --- a/include/QF/screen.h +++ b/include/QF/screen.h @@ -35,10 +35,6 @@ struct tex_s; void SCR_Init (void); -void SCR_DrawRam (void); -void SCR_DrawTurtle (void); -void SCR_DrawPause (void); - typedef void (*SCR_Func)(void); // scr_funcs is a null terminated array void SCR_UpdateScreen (struct transform_s *camera, double realtime, diff --git a/include/QF/vid.h b/include/QF/vid.h index c8ce3b226..6b03b3c9b 100644 --- a/include/QF/vid.h +++ b/include/QF/vid.h @@ -49,7 +49,6 @@ typedef struct { unsigned height; int numpages; qboolean recalc_refdef; // if true, recalc vid-based stuff - struct view_s *conview; struct vid_internal_s *vid_internal; struct viddef_listener_set_s *onPaletteChanged; diff --git a/libs/console/client.c b/libs/console/client.c index 75eeae97b..91f512cd1 100644 --- a/libs/console/client.c +++ b/libs/console/client.c @@ -563,7 +563,7 @@ draw_console (view_t *view) if (con_state == con_fullscreen) { alpha = 255; } else { - float y = r_data->vid->conview->ylen * con_size; + float y = con_data.screen_view->ylen * con_size; alpha = 255 * con_alpha * view->ylen / y; alpha = min (alpha, 255); } @@ -609,11 +609,11 @@ setup_console (void) lines = 0; break; case con_active: - lines = r_data->vid->conview->ylen * bound (0.2, con_size, + lines = con_data.screen_view->ylen * bound (0.2, con_size, 1); break; case con_fullscreen: - lines = con_data.lines = r_data->vid->conview->ylen; + lines = con_data.lines = con_data.screen_view->ylen; break; } @@ -628,10 +628,10 @@ setup_console (void) } else { con_data.lines = lines; } - if (con_data.lines > r_data->vid->conview->ylen) { - con_data.lines = r_data->vid->conview->ylen; + if (con_data.lines > con_data.screen_view->ylen) { + con_data.lines = con_data.screen_view->ylen; } - if (con_data.lines >= r_data->vid->conview->ylen - r_data->lineadj) + if (con_data.lines >= con_data.screen_view->ylen - r_data->lineadj) r_data->scr_copyeverything = 1; } @@ -688,8 +688,8 @@ con_app_window (const IE_event_t *event) old_xlen = event->app_window.xlen; old_ylen = event->app_window.ylen; - view_resize (con_data.view, r_data->vid->conview->xlen, - r_data->vid->conview->ylen); + view_resize (con_data.view, con_data.screen_view->xlen, + con_data.screen_view->ylen); } } diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index 9ee389775..7b79dfc13 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -711,8 +711,8 @@ gl_Draw_Crosshair (void) if ((unsigned) ch >= sizeof (crosshair_func) / sizeof (crosshair_func[0])) return; - x = vid.conview->xlen / 2 + cl_crossx; - y = vid.conview->ylen / 2 + cl_crossy; + x = vid.width / 2 + cl_crossx; + y = vid.height / 2 + cl_crossy; crosshair_func[ch] (x, y); } @@ -837,7 +837,7 @@ gl_Draw_ConsoleBackground (int lines, byte alpha) if (gl_constretch) { ofs = 0; } else - ofs = (vid.conview->ylen - lines) / (float) vid.conview->ylen; + ofs = (vid.height - lines) / (float) vid.height; color_0_8[3] = alpha; qfglColor4ubv (color_0_8); @@ -852,9 +852,9 @@ gl_Draw_ConsoleBackground (int lines, byte alpha) qfglTexCoord2f (0, 0 + ofs); qfglVertex2f (0, 0); qfglTexCoord2f (1, 0 + ofs); - qfglVertex2f (vid.conview->xlen, 0); + qfglVertex2f (vid.width, 0); qfglTexCoord2f (1, 1); - qfglVertex2f (vid.conview->xlen, lines); + qfglVertex2f (vid.width, lines); qfglTexCoord2f (0, 1); qfglVertex2f (0, lines); qfglEnd (); @@ -871,7 +871,7 @@ gl_Draw_ConsoleBackground (int lines, byte alpha) } int len = strlen (cl_verstring); - gl_Draw_AltString (vid.conview->xlen - len * 8 - 11, lines - 14, + gl_Draw_AltString (vid.width - len * 8 - 11, lines - 14, cl_verstring); qfglColor3ubv (color_white); } @@ -951,9 +951,9 @@ gl_Draw_FadeScreen (void) qfglBegin (GL_QUADS); qfglVertex2f (0, 0); - qfglVertex2f (vid.conview->xlen, 0); - qfglVertex2f (vid.conview->xlen, vid.conview->ylen); - qfglVertex2f (0, vid.conview->ylen); + qfglVertex2f (vid.width, 0); + qfglVertex2f (vid.width, vid.height); + qfglVertex2f (0, vid.height); qfglEnd (); qfglColor3ubv (color_white); @@ -993,7 +993,7 @@ GL_Set2D (void) void GL_Set2DScaled (void) { - set_2d (vid.conview->xlen, vid.conview->ylen); + set_2d (vid.width, vid.height); } void @@ -1024,9 +1024,9 @@ gl_Draw_BlendScreen (quat_t color) qfglColor4fv (color); qfglVertex2f (0, 0); - qfglVertex2f (vid.conview->xlen, 0); - qfglVertex2f (vid.conview->xlen, vid.conview->ylen); - qfglVertex2f (0, vid.conview->ylen); + qfglVertex2f (vid.width, 0); + qfglVertex2f (vid.width, vid.height); + qfglVertex2f (0, vid.height); qfglEnd (); diff --git a/libs/video/renderer/glsl/glsl_draw.c b/libs/video/renderer/glsl/glsl_draw.c index 6258d3048..c58352a03 100644 --- a/libs/video/renderer/glsl/glsl_draw.c +++ b/libs/video/renderer/glsl/glsl_draw.c @@ -611,8 +611,8 @@ glsl_Draw_Crosshair (void) { int x, y; - x = vid.conview->xlen / 2 + cl_crossx; - y = vid.conview->ylen / 2 + cl_crossy; + x = vid.width / 2 + cl_crossx; + y = vid.height / 2 + cl_crossy; glsl_Draw_CrosshairAt (crosshair, x, y); } @@ -644,14 +644,14 @@ glsl_Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, void glsl_Draw_ConsoleBackground (int lines, byte alpha) { - float ofs = (vid.conview->ylen - lines) / (float) vid.conview->ylen; + float ofs = (vid.height - lines) / (float) vid.height; quat_t color = {1, 1, 1, bound (0, alpha, 255) / 255.0}; drawvert_t verts[] = { {{ 0, 0, 0, ofs}}, - {{vid.conview->xlen, 0, 1, ofs}}, - {{vid.conview->xlen, lines, 1, 1}}, + {{vid.width, 0, 1, ofs}}, + {{vid.width, lines, 1, 1}}, {{ 0, 0, 0, ofs}}, - {{vid.conview->xlen, lines, 1, 1}}, + {{vid.width, lines, 1, 1}}, {{ 0, lines, 0, 1}}, }; @@ -751,8 +751,7 @@ glsl_Draw_Line (int x0, int y0, int x1, int y1, int c) static inline void draw_blendscreen (quat_t color) { - draw_pic (0, 0, vid.conview->xlen, vid.conview->ylen, white_pic, - 0, 0, 8, 8, color); + draw_pic (0, 0, vid.width, vid.height, white_pic, 0, 0, 8, 8, color); } void @@ -825,7 +824,7 @@ GLSL_Set2D (void) void GLSL_Set2DScaled (void) { - set_2d (vid.conview->xlen, vid.conview->ylen); + set_2d (vid.width, vid.height); } void diff --git a/libs/video/renderer/r_cvar.c b/libs/video/renderer/r_cvar.c index 76937ebae..41c666d0a 100644 --- a/libs/video/renderer/r_cvar.c +++ b/libs/video/renderer/r_cvar.c @@ -463,33 +463,6 @@ static cvar_t scr_ffov_cvar = { .flags = CVAR_NONE, .value = { .type = &cexpr_float, .value = &scr_ffov }, }; -int scr_showpause; -static cvar_t scr_showpause_cvar = { - .name = "showpause", - .description = - "Toggles display of pause graphic", - .default_value = "1", - .flags = CVAR_NONE, - .value = { .type = &cexpr_int, .value = &scr_showpause }, -}; -int scr_showram; -static cvar_t scr_showram_cvar = { - .name = "showram", - .description = - "Show RAM icon if game is running low on memory", - .default_value = "1", - .flags = CVAR_NONE, - .value = { .type = &cexpr_int, .value = &scr_showram }, -}; -int scr_showturtle; -static cvar_t scr_showturtle_cvar = { - .name = "showturtle", - .description = - "Show a turtle icon if your fps is below 10", - .default_value = "0", - .flags = CVAR_NONE, - .value = { .type = &cexpr_int, .value = &scr_showturtle }, -}; int scr_viewsize; static cvar_t scr_viewsize_cvar = { .name = "viewsize", @@ -651,9 +624,6 @@ R_Init_Cvars (void) Cvar_Register (&scr_fisheye_cvar, scr_fisheye_f, 0); Cvar_Register (&scr_fviews_cvar, 0, 0); Cvar_Register (&scr_ffov_cvar, scr_ffov_f, 0); - Cvar_Register (&scr_showpause_cvar, 0, 0); - Cvar_Register (&scr_showram_cvar, 0, 0); - Cvar_Register (&scr_showturtle_cvar, 0, 0); Cvar_Register (&scr_viewsize_cvar, viewsize_f, 0); r_data->graphheight = &r_graphheight; diff --git a/libs/video/renderer/r_progs.c b/libs/video/renderer/r_progs.c index 2b33da012..b7a1004f3 100644 --- a/libs/video/renderer/r_progs.c +++ b/libs/video/renderer/r_progs.c @@ -373,13 +373,13 @@ bi_Draw_Crosshair (progs_t *pr, void *_res) static void bi_Draw_Width (progs_t *pr, void *_res) { - R_INT (pr) = r_data->vid->conview->xlen; + R_INT (pr) = r_data->vid->width; } static void bi_Draw_Height (progs_t *pr, void *_res) { - R_INT (pr) = r_data->vid->conview->ylen; + R_INT (pr) = r_data->vid->height; } static void diff --git a/libs/video/renderer/r_screen.c b/libs/video/renderer/r_screen.c index f55531c0c..4106220f8 100644 --- a/libs/video/renderer/r_screen.c +++ b/libs/video/renderer/r_screen.c @@ -67,8 +67,6 @@ int *r_face_visframes; //FIXME per renderer qboolean scr_skipupdate; static qboolean scr_initialized;// ready to draw -static qpic_t *scr_ram; -static qpic_t *scr_turtle; static framebuffer_t *fisheye_cube_map; static framebuffer_t *warp_buffer; @@ -431,60 +429,6 @@ SCR_SizeDown_f (void) r_data->vid->recalc_refdef = 1; } -void -SCR_DrawRam (void) -{ - if (!scr_showram) - return; - - if (!r_cache_thrash) - return; - - //FIXME view - r_funcs->Draw_Pic (r_data->scr_view->xpos + 32, r_data->scr_view->ypos, - scr_ram); -} - -void -SCR_DrawTurtle (void) -{ - static int count; - - if (!scr_showturtle) - return; - - if (r_data->frametime < 0.1) { - count = 0; - return; - } - - count++; - if (count < 3) - return; - - //FIXME view - r_funcs->Draw_Pic (r_data->scr_view->xpos, r_data->scr_view->ypos, - scr_turtle); -} - -void -SCR_DrawPause (void) -{ - qpic_t *pic; - - if (!scr_showpause) // turn off for screenshots - return; - - if (!r_data->paused) - return; - - //FIXME view conwidth - pic = r_funcs->Draw_CachePic ("gfx/pause.lmp", true); - r_funcs->Draw_Pic ((r_data->vid->conview->xlen - pic->width) / 2, - (r_data->vid->conview->ylen - 48 - pic->height) / 2, - pic); -} - static void viewsize_listener (void *data, const cvar_t *cvar) { @@ -494,15 +438,15 @@ viewsize_listener (void *data, const cvar_t *cvar) void SCR_Init (void) { + r_data->scr_view->xlen = r_data->vid->width; + r_data->scr_view->ylen = r_data->vid->height; + // register our commands Cmd_AddCommand ("screenshot", ScreenShot_f, "Take a screenshot, " "saves as qfxxxx.png in the QF directory"); Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increases the screen size"); Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decreases the screen size"); - scr_ram = r_funcs->Draw_PicFromWad ("ram"); - scr_turtle = r_funcs->Draw_PicFromWad ("turtle"); - scr_initialized = true; r_ent_queue = EntQueue_New (mod_num_types); diff --git a/libs/video/renderer/sw/draw.c b/libs/video/renderer/sw/draw.c index 06db109af..1edbd5a51 100644 --- a/libs/video/renderer/sw/draw.c +++ b/libs/video/renderer/sw/draw.c @@ -265,7 +265,7 @@ Draw_Character (int x, int y, unsigned int chr) if (y <= -8) return; // totally off screen - if (y > vid.conview->ylen - 8 || x < 0 || x > vid.conview->xlen - 8) + if (y > (int) vid.height - 8 || x < 0 || x > (int) vid.width - 8) return; if (chr > 255) return; @@ -478,8 +478,8 @@ Draw_Crosshair (void) if ((unsigned) ch >= sizeof (crosshair_func) / sizeof (crosshair_func[0])) return; - x = vid.conview->xlen / 2 + cl_crossx; - y = vid.conview->ylen / 2 + cl_crossy; + x = vid.width / 2 + cl_crossx; + y = vid.height / 2 + cl_crossy; crosshair_func[ch] (x, y); } @@ -501,8 +501,8 @@ Draw_Pic (int x, int y, qpic_t *pic) byte *dest, *source, tbyte; int v, u; - if (x < 0 || (x + pic->width) > vid.conview->xlen - || y < 0 || (y + pic->height) > vid.conview->ylen) { + if (x < 0 || (x + pic->width) > (int) vid.width + || y < 0 || (y + pic->height) > (int) vid.height) { Sys_MaskPrintf (SYS_vid, "Draw_Pic: bad coordinates"); Draw_SubPic (x, y, pic, 0, 0, pic->width, pic->height); return; @@ -560,8 +560,8 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, byte *dest, *source, tbyte; int u, v; - if ((x < 0) || (x + width > vid.conview->xlen) - || (y < 0) || (y + height > vid.conview->ylen)) { + if ((x < 0) || (x + width > (int) vid.width) + || (y < 0) || (y + height > (int) vid.height)) { Sys_MaskPrintf (SYS_vid, "Draw_SubPic: bad coordinates"); } // first, clip to screen @@ -629,7 +629,6 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, void Draw_ConsoleBackground (int lines, byte alpha) { - int x, y, v; byte *src, *dest; int f, fstep; qpic_t *conback; @@ -639,15 +638,15 @@ Draw_ConsoleBackground (int lines, byte alpha) // draw the pic dest = d_viewbuffer; - for (y = 0; y < lines; y++, dest += d_rowbytes) { - v = (vid.conview->ylen - lines + y) * 200 / vid.conview->ylen; + for (int y = 0; y < lines; y++, dest += d_rowbytes) { + int v = (vid.height - lines + y) * 200 / vid.height; src = conback->data + v * 320; - if (vid.conview->xlen == 320) - memcpy (dest, src, vid.conview->xlen); + if (vid.width == 320) + memcpy (dest, src, vid.width); else { f = 0; - fstep = 320 * 0x10000 / vid.conview->xlen; - for (x = 0; x < vid.conview->xlen; x += 4) { + fstep = 320 * 0x10000 / vid.width; + for (unsigned x = 0; x < vid.width; x += 4) { dest[x] = src[f >> 16]; f += fstep; dest[x + 1] = src[f >> 16]; @@ -660,7 +659,7 @@ Draw_ConsoleBackground (int lines, byte alpha) } } - Draw_AltString (vid.conview->xlen - strlen (cl_verstring) * 8 - 11, + Draw_AltString (vid.width - strlen (cl_verstring) * 8 - 11, lines - 14, cl_verstring); } @@ -767,8 +766,7 @@ Draw_Fill (int x, int y, int w, int h, int c) byte *dest; int u, v; - if (x < 0 || x + w > vid.conview->xlen - || y < 0 || y + h > vid.conview->ylen) { + if (x < 0 || x + w > (int) vid.width || y < 0 || y + h > (int) vid.height) { Sys_MaskPrintf (SYS_vid, "Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c); } @@ -899,12 +897,12 @@ test_point (int x, int y) if (x < 0) { c |= 1; - } else if (x >= vid.conview->xlen) { + } else if (x >= (int) vid.width) { c |= 2; } if (y < 0) { c |= 4; - } else if (y >= vid.conview->ylen) { + } else if (y >= (int) vid.height) { c |= 8; } return c; @@ -915,8 +913,8 @@ Draw_Line (int x0, int y0, int x1, int y1, int c) { byte c0 = test_point (x0, y0); byte c1 = test_point (x1, y1); - int xmax = vid.conview->xlen - 1; - int ymax = vid.conview->ylen - 1; + int xmax = vid.width - 1; + int ymax = vid.height - 1; while (c0 | c1) { // Cohen-Sutherland line clipping @@ -944,8 +942,8 @@ void Draw_FadeScreen (void) { int x, y; - int height = vid.conview->ylen; - int width = vid.conview->xlen / 4; + int height = vid.height; + int width = vid.width / 4; uint32_t *pbuf; for (y = 0; y < height; y++) { diff --git a/libs/video/renderer/vid_render_vulkan.c b/libs/video/renderer/vid_render_vulkan.c index acb38d4d6..bdad0f499 100644 --- a/libs/video/renderer/vid_render_vulkan.c +++ b/libs/video/renderer/vid_render_vulkan.c @@ -346,8 +346,8 @@ vulkan_set_2d (int scaled) __auto_type mctx = vulkan_ctx->matrix_context; __auto_type mat = &mctx->matrices; - int width = vid.conview->xlen; //FIXME vid - int height = vid.conview->ylen; + int width = vid.width; //FIXME vid + int height = vid.height; QFV_Orthographic (mat->Projection2d, 0, width, 0, height, 0, 99999); mctx->dirty = mctx->frames.size; diff --git a/libs/video/renderer/vulkan/vulkan_draw.c b/libs/video/renderer/vulkan/vulkan_draw.c index 7a604860a..5a0fba012 100644 --- a/libs/video/renderer/vulkan/vulkan_draw.c +++ b/libs/video/renderer/vulkan/vulkan_draw.c @@ -593,10 +593,10 @@ Vulkan_Draw_Character (int x, int y, unsigned int chr, vulkan_ctx_t *ctx) if (chr == ' ') { return; } - if (y <= -8 || y >= vid.conview->ylen) { + if (y <= -8 || y >= (int) vid.height) { return; } - if (x <= -8 || x >= vid.conview->xlen) { + if (x <= -8 || x >= (int) vid.width) { return; } queue_character (x, y, chr, ctx); @@ -610,11 +610,11 @@ Vulkan_Draw_String (int x, int y, const char *str, vulkan_ctx_t *ctx) if (!str || !str[0]) { return; } - if (y <= -8 || y >= vid.conview->ylen) { + if (y <= -8 || y >= (int) vid.height) { return; } while (*str) { - if ((chr = *str++) != ' ' && x >= -8 && x < vid.conview->xlen) { + if ((chr = *str++) != ' ' && x >= -8 && x < (int) vid.width) { queue_character (x, y, chr, ctx); } x += 8; @@ -630,11 +630,11 @@ Vulkan_Draw_nString (int x, int y, const char *str, int count, if (!str || !str[0]) { return; } - if (y <= -8 || y >= vid.conview->ylen) { + if (y <= -8 || y >= (int) vid.height) { return; } while (count-- > 0 && *str) { - if ((chr = *str++) != ' ' && x >= -8 && x < vid.conview->xlen) { + if ((chr = *str++) != ' ' && x >= -8 && x < (int) vid.width) { queue_character (x, y, chr, ctx); } x += 8; @@ -649,12 +649,12 @@ Vulkan_Draw_AltString (int x, int y, const char *str, vulkan_ctx_t *ctx) if (!str || !str[0]) { return; } - if (y <= -8 || y >= vid.conview->ylen) { + if (y <= -8 || y >= (int) vid.height) { return; } while (*str) { if ((chr = *str++ | 0x80) != (' ' | 0x80) - && x >= -8 && x < vid.conview->xlen) { + && x >= -8 && x < (int) vid.width) { queue_character (x, y, chr, ctx); } x += 8; @@ -711,8 +711,8 @@ Vulkan_Draw_Crosshair (vulkan_ctx_t *ctx) { int x, y; - x = vid.conview->xlen / 2 + cl_crossx; - y = vid.conview->ylen / 2 + cl_crossy; + x = vid.width / 2 + cl_crossx; + y = vid.height / 2 + cl_crossy; Vulkan_Draw_CrosshairAt (crosshair, x, y, ctx); } @@ -833,7 +833,7 @@ Vulkan_Draw_ConsoleBackground (int lines, byte alpha, vulkan_ctx_t *ctx) int ofs = max (0, cpic->height - lines); lines = min (lines, cpic->height); subpic_t *subpic = *(subpic_t **) cpic->data; - draw_pic (0, 0, vid.conview->xlen, lines, subpic, + draw_pic (0, 0, vid.width, lines, subpic, 0, ofs, cpic->width, lines, color, &frame->quad_verts); } @@ -891,7 +891,7 @@ draw_blendscreen (quat_t color, vulkan_ctx_t *ctx) drawframe_t *frame = &dctx->frames.a[ctx->curFrame]; subpic_t *subpic = *(subpic_t **) dctx->white_pic->data; - draw_pic (0, 0, vid.conview->xlen, vid.conview->ylen, subpic, + draw_pic (0, 0, vid.width, vid.height, subpic, 0, 0, 1, 1, color, &frame->quad_verts); } diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index fe2a62333..d6547250a 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -69,24 +69,6 @@ static cvar_t vid_system_gamma_cvar = { .flags = CVAR_ARCHIVE, .value = { .type = &cexpr_int, .value = &vid_system_gamma }, }; -int con_width; -static cvar_t con_width_cvar = { - .name = "con_width", - .description = - "console effective width (GL only)", - .default_value = 0, - .flags = CVAR_ROM, - .value = { .type = &cexpr_int, .value = &con_width }, -}; -int con_height; -static cvar_t con_height_cvar = { - .name = "con_height", - .description = - "console effective height (GL only)", - .default_value = 0, - .flags = CVAR_ROM, - .value = { .type = &cexpr_int, .value = &con_height }, -}; qboolean vid_gamma_avail; // hardware gamma availability VISIBLE unsigned int d_8to24table[256]; @@ -121,12 +103,10 @@ static cvar_t vid_fullscreen_cvar = { .value = { .type = &cexpr_int, .value = &vid_fullscreen }, }; -static view_t conview; - void VID_GetWindowSize (int def_w, int def_h) { - int pnum, conheight; + int pnum; vid_width_cvar.default_value = nva ("%d", def_w); vid_height_cvar.default_value = nva ("%d", def_h); @@ -168,30 +148,21 @@ VID_GetWindowSize (int def_w, int def_h) viddef.width = vid_width; viddef.height = vid_height; - viddef.conview = &conview; +} - con_width_cvar.default_value = nva ("%d", vid_width); - Cvar_Register (&con_width_cvar, 0, 0); - if ((pnum = COM_CheckParm ("-conwidth"))) { - if (pnum >= com_argc - 1) - Sys_Error ("VID: -conwidth "); - con_width = atoi(com_argv[pnum + 1]); +void +VID_SetWindowSize (int width, int height) +{ + if (width < 0 || height < 0) { + Sys_Error ("VID_SetWindowSize: invalid size: %d, %d", width, height); } - con_width = max (con_width & ~7, 320); - // make con_width a multiple of 8 and >= 320 - viddef.conview->xlen = con_width; - - conheight = (viddef.conview->xlen * viddef.height) / viddef.width; - con_height_cvar.default_value = nva ("%d", conheight); - Cvar_Register (&con_height_cvar, 0, 0); - if ((pnum = COM_CheckParm ("-conheight"))) { - if (pnum >= com_argc - 1) - Sys_Error ("VID: -conheight "); - con_height = atoi (com_argv[pnum + 1]); + if (width != (int) viddef.width || height != (int) viddef.height) { + viddef.width = width; + viddef.height = height; + if (viddef.onVidResize) { + LISTENER_INVOKE (viddef.onVidResize, &viddef); + } } - // make con_height >= 200 - con_height = max (con_height & ~7, 200); - viddef.conview->ylen = con_height; } /* GAMMA FUNCTIONS */ diff --git a/libs/video/targets/vid_x11_sw.c b/libs/video/targets/vid_x11_sw.c index 455d2b8e9..658a11ac2 100644 --- a/libs/video/targets/vid_x11_sw.c +++ b/libs/video/targets/vid_x11_sw.c @@ -682,11 +682,6 @@ x11_create_context (sw_ctx_t *ctx) x_shmeventtype = XShmGetEventBase (x_disp) + ShmCompletion; } - // FIXME this really shouldn't be here (ideally, scale console in sw) - // No console scaling in the sw renderer - viddef.conview->xlen = viddef.width; - viddef.conview->ylen = viddef.height; - viddef.vid_internal->init_buffers = x11_init_buffers; // XSynchronize (x_disp, False); // X11_AddEvent (x_shmeventtype, event_shm); diff --git a/nq/include/client.h b/nq/include/client.h index 33d0c0174..44391c545 100644 --- a/nq/include/client.h +++ b/nq/include/client.h @@ -287,6 +287,8 @@ extern qboolean recording; struct cvar_s; void Cvar_Info (void *data, const struct cvar_s *cvar); +extern struct view_s *cl_screen_view; +void CL_Init_Screen (void); void CL_UpdateScreen (double realtime); void CL_SetState (cactive_t state); diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 39f3d06a1..225876f9c 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -723,6 +723,7 @@ CL_Init (cbuf_t *cbuf) PI_RegisterPlugins (client_plugin_list); Con_Init ("client"); + CL_Init_Screen (); CDAudio_Init (); diff --git a/nq/source/cl_screen.c b/nq/source/cl_screen.c index ea3a3ab50..ccaa2a31c 100644 --- a/nq/source/cl_screen.c +++ b/nq/source/cl_screen.c @@ -44,6 +44,7 @@ #include "QF/pcx.h" #include "QF/screen.h" +#include "QF/plugin/console.h" #include "QF/plugin/vid_render.h" #include "QF/scene/scene.h" @@ -52,15 +53,49 @@ #include "sbar.h" +#include "r_local.h" //FIXME for r_cache_thrash + #include "client/world.h" #include "nq/include/client.h" +int scr_showpause; +static cvar_t scr_showpause_cvar = { + .name = "showpause", + .description = + "Toggles display of pause graphic", + .default_value = "1", + .flags = CVAR_NONE, + .value = { .type = &cexpr_int, .value = &scr_showpause }, +}; +int scr_showram; +static cvar_t scr_showram_cvar = { + .name = "showram", + .description = + "Show RAM icon if game is running low on memory", + .default_value = "1", + .flags = CVAR_NONE, + .value = { .type = &cexpr_int, .value = &scr_showram }, +}; +int scr_showturtle; +static cvar_t scr_showturtle_cvar = { + .name = "showturtle", + .description = + "Show a turtle icon if your fps is below 10", + .default_value = "0", + .flags = CVAR_NONE, + .value = { .type = &cexpr_int, .value = &scr_showturtle }, +}; + +view_t *cl_screen_view; static view_t *net_view; static view_t *timegraph_view; static view_t *zgraph_view; static view_t *loading_view; +static qpic_t *scr_ram; +static qpic_t *scr_turtle; + static void draw_pic (view_t *view) { @@ -90,6 +125,60 @@ SCR_CShift (void) r_funcs->Draw_BlendScreen (cl.viewstate.cshift_color); } +static void +SCR_DrawRam (void) +{ + if (!scr_showram) + return; + + if (!r_cache_thrash) + return; + + //FIXME view + r_funcs->Draw_Pic (cl_screen_view->xpos + 32, cl_screen_view->ypos, + scr_ram); +} + +static void +SCR_DrawTurtle (void) +{ + static int count; + + if (!scr_showturtle) + return; + + if (r_data->frametime < 0.1) { + count = 0; + return; + } + + count++; + if (count < 3) + return; + + //FIXME view + r_funcs->Draw_Pic (cl_screen_view->xpos, cl_screen_view->ypos, + scr_turtle); +} + +static void +SCR_DrawPause (void) +{ + qpic_t *pic; + + if (!scr_showpause) // turn off for screenshots + return; + + if (!r_data->paused) + return; + + //FIXME view conwidth + pic = r_funcs->Draw_CachePic ("gfx/pause.lmp", true); + r_funcs->Draw_Pic ((cl_screen_view->xlen - pic->width) / 2, + (cl_screen_view->ylen - 48 - pic->height) / 2, + pic); +} + static void scr_draw_views (void) { @@ -99,7 +188,7 @@ scr_draw_views (void) timegraph_view->visible = r_timegraph; zgraph_view->visible = r_zgraph; - view_draw (r_data->vid->conview); + view_draw (cl_screen_view); } static SCR_Func scr_funcs_normal[] = { @@ -133,6 +222,47 @@ static SCR_Func *scr_funcs[] = { scr_funcs_finale, }; +void +CL_Init_Screen (void) +{ + qpic_t *pic; + + cl_screen_view = r_data->scr_view; + con_module->data->console->screen_view = cl_screen_view; + + scr_ram = r_funcs->Draw_PicFromWad ("ram"); + scr_turtle = r_funcs->Draw_PicFromWad ("turtle"); + + Cvar_Register (&scr_showpause_cvar, 0, 0); + Cvar_Register (&scr_showram_cvar, 0, 0); + Cvar_Register (&scr_showturtle_cvar, 0, 0); + + pic = r_funcs->Draw_PicFromWad ("net"); + net_view = view_new (64, 0, pic->width, pic->height, grav_northwest); + net_view->draw = draw_pic; + net_view->data = pic; + net_view->visible = 0; + view_add (cl_screen_view, net_view); + + timegraph_view = view_new (0, 0, cl_screen_view->xlen, 100, grav_southwest); + timegraph_view->draw = R_TimeGraph; + timegraph_view->visible = 0; + view_add (cl_screen_view, timegraph_view); + + zgraph_view = view_new (0, 0, cl_screen_view->xlen, 100, grav_southwest); + zgraph_view->draw = R_ZGraph; + zgraph_view->visible = 0; + view_add (cl_screen_view, zgraph_view); + + const char *name = "gfx/loading.lmp"; + pic = r_funcs->Draw_CachePic (name, 1); + loading_view = view_new (0, -24, pic->width, pic->height, grav_center); + loading_view->draw = draw_cachepic; + loading_view->data = (void *) name; + loading_view->visible = 0; + view_add (cl_screen_view, loading_view); +} + void CL_UpdateScreen (double realtime) { @@ -141,41 +271,6 @@ CL_UpdateScreen (double realtime) if (index >= sizeof (scr_funcs) / sizeof (scr_funcs[0])) index = 0; - if (!net_view) { - qpic_t *pic = r_funcs->Draw_PicFromWad ("net"); - net_view = view_new (64, 0, pic->width, pic->height, grav_northwest); - net_view->draw = draw_pic; - net_view->data = pic; - net_view->visible = 0; - view_add (r_data->scr_view, net_view); - } - - if (!timegraph_view) { - view_t *parent = r_data->scr_view; - timegraph_view = view_new (0, 0, parent->xlen, 100, grav_southwest); - timegraph_view->draw = R_TimeGraph; - timegraph_view->visible = 0; - view_add (parent, timegraph_view); - } - - if (!zgraph_view) { - view_t *parent = r_data->scr_view; - zgraph_view = view_new (0, 0, parent->xlen, 100, grav_southwest); - zgraph_view->draw = R_ZGraph; - zgraph_view->visible = 0; - view_add (parent, zgraph_view); - } - - if (!loading_view) { - const char *name = "gfx/loading.lmp"; - qpic_t *pic = r_funcs->Draw_CachePic (name, 1); - loading_view = view_new (0, -24, pic->width, pic->height, grav_center); - loading_view->draw = draw_cachepic; - loading_view->data = (void *) name; - loading_view->visible = 0; - view_add (r_data->vid->conview, loading_view); - } - //FIXME not every time if (cls.state == ca_active) { if (cl.watervis) diff --git a/nq/source/sbar.c b/nq/source/sbar.c index 8287adf13..fa46defa6 100644 --- a/nq/source/sbar.c +++ b/nq/source/sbar.c @@ -354,7 +354,7 @@ draw_weapons_hud (view_t *view) if (view->parent->gravity == grav_southeast) x = view->xlen - 24; - for (i = r_data->vid->conview->ylen < 204; i < 7; i++) { + for (i = cl_screen_view->ylen < 204; i < 7; i++) { if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN << i)) { flashon = calc_flashon (cl.item_gettime[i], IT_SHOTGUN << i); draw_subpic (view, x, i * 16, sb_weapons[flashon][i], 0, 0, 24, 16); @@ -711,7 +711,7 @@ draw_rogue_weapons_hud (view_t *view) int flashon, i, j; qpic_t *pic; - for (i = r_data->vid->conview->ylen < 204; i < 7; i++) { + for (i = cl_screen_view->ylen < 204; i < 7; i++) { if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN << i)) { flashon = calc_flashon (cl.item_gettime[i], IT_SHOTGUN << i); if (i >= 2) { @@ -982,7 +982,7 @@ sbar_update_vis (void) return; if (con_module && - con_module->data->console->lines == r_data->vid->conview->ylen) + con_module->data->console->lines == cl_screen_view->ylen) return; // console is full screen if (cls.state == ca_active @@ -1420,8 +1420,8 @@ init_sbar_views (void) view->draw = draw_status; view_add (sbar_view, view); - if (r_data->vid->conview->xlen > 320) { - int l = (r_data->vid->conview->xlen - 320) / 2; + if (cl_screen_view->xlen > 320) { + int l = (cl_screen_view->xlen - 320) / 2; view = view_new (-l, 0, l, 48, grav_southwest); view->draw = draw_tile; @@ -1442,12 +1442,12 @@ init_hud_views (void) view_t *minifrags_view = 0; view_t *miniteam_view = 0; - if (r_data->vid->conview->xlen < 512) { + if (cl_screen_view->xlen < 512) { hud_view = view_new (0, 0, 320, 48, grav_south); hud_frags_view = view_new (0, 0, 130, 8, grav_northeast); hud_frags_view->draw = draw_frags; - } else if (r_data->vid->conview->xlen < 640) { + } else if (cl_screen_view->xlen < 640) { hud_view = view_new (0, 0, 512, 48, grav_south); minifrags_view = view_new (320, 0, 192, 48, grav_southwest); @@ -1499,7 +1499,7 @@ init_hud_views (void) if (miniteam_view) view_add (hud_view, miniteam_view); - view = view_new (0, 0, r_data->vid->conview->xlen, 48, grav_south); + view = view_new (0, 0, cl_screen_view->xlen, 48, grav_south); view_add (view, hud_view); hud_view = view; @@ -1550,8 +1550,8 @@ init_hipnotic_sbar_views (void) view->draw = draw_hipnotic_status; view_add (sbar_view, view); - if (r_data->vid->conview->xlen > 320) { - int l = (r_data->vid->conview->xlen - 320) / 2; + if (cl_screen_view->xlen > 320) { + int l = (cl_screen_view->xlen - 320) / 2; view = view_new (-l, 0, l, 48, grav_southwest); view->draw = draw_tile; @@ -1576,10 +1576,8 @@ init_hipnotic_hud_views (void) hud_view->resize_y = 1; - if (r_data->vid->conview->ylen < 252) { - hud_armament_view = view_new (0, - min (r_data->vid->conview->ylen - 160, - 48), + if (cl_screen_view->ylen < 252) { + hud_armament_view = view_new (0, min (cl_screen_view->ylen - 160, 48), 66, 160, grav_southeast); } else { hud_armament_view = view_new (0, 48, 42, 204, grav_southeast); @@ -1611,7 +1609,7 @@ init_hipnotic_hud_views (void) if (hud_frags_view) view_add (hud_inventory_view, hud_frags_view); - view = view_new (0, 0, r_data->vid->conview->xlen, 48, grav_south); + view = view_new (0, 0, cl_screen_view->xlen, 48, grav_south); view_add (view, hud_view); hud_view = view; @@ -1658,8 +1656,8 @@ init_rogue_sbar_views (void) view->draw = draw_rogue_status; view_add (sbar_view, view); - if (r_data->vid->conview->xlen > 320) { - int l = (r_data->vid->conview->xlen - 320) / 2; + if (cl_screen_view->xlen > 320) { + int l = (cl_screen_view->xlen - 320) / 2; view = view_new (-l, 0, l, 48, grav_southwest); view->draw = draw_tile; @@ -1708,7 +1706,7 @@ init_rogue_hud_views (void) if (hud_frags_view) view_add (hud_inventory_view, hud_frags_view); - view = view_new (0, 0, r_data->vid->conview->xlen, 48, grav_south); + view = view_new (0, 0, cl_screen_view->xlen, 48, grav_south); view_add (view, hud_view); hud_view = view; @@ -1720,19 +1718,17 @@ init_rogue_hud_views (void) static void init_views (void) { - hud_main_view = view_new (0, 0, r_data->vid->conview->xlen, - r_data->vid->conview->ylen, - grav_northwest); - if (con_module) - view_insert (con_module->data->console->view, hud_main_view, 0); + hud_main_view = view_new (0, 0, cl_screen_view->xlen, cl_screen_view->ylen, + grav_northwest); + view_insert (cl_screen_view, hud_main_view, 0); hud_main_view->resize_x = 1; // get resized if the 2d view resizes hud_main_view->resize_y = 1; hud_main_view->visible = 0; // but don't let the console draw our stuff - if (r_data->vid->conview->ylen > 300) + if (cl_screen_view->ylen > 300) hud_overlay_view = view_new (0, 0, 320, 300, grav_center); else - hud_overlay_view = view_new (0, 0, 320, r_data->vid->conview->ylen, - grav_center); + hud_overlay_view = view_new (0, 0, 320, cl_screen_view->ylen, + grav_center); hud_overlay_view->draw = draw_overlay; hud_overlay_view->visible = 0; diff --git a/qw/include/client.h b/qw/include/client.h index 7951338cb..bac651e15 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -301,6 +301,8 @@ extern struct view_s *cl_netgraph_view; void CL_NetGraph (struct view_s *view); void CL_NetGraph_Init_Cvars (void); +extern struct view_s *cl_screen_view; +void CL_Init_Screen (void); void CL_UpdateScreen (double realtime); void CL_SetState (cactive_t state); diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index cf72e69cd..cc3bf4c82 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1500,6 +1500,7 @@ CL_Init (void) PI_RegisterPlugins (client_plugin_list); Con_Init ("client"); + CL_Init_Screen (); if (con_module) { con_module->data->console->dl_name = cls.downloadname; con_module->data->console->dl_percent = &cls.downloadpercent; diff --git a/qw/source/cl_screen.c b/qw/source/cl_screen.c index bbab72313..d8084ef8f 100644 --- a/qw/source/cl_screen.c +++ b/qw/source/cl_screen.c @@ -44,12 +44,16 @@ #include "QF/pcx.h" #include "QF/screen.h" +#include "QF/plugin/console.h" + #include "QF/scene/scene.h" #include "QF/scene/transform.h" #include "QF/ui/view.h" #include "sbar.h" +#include "r_local.h" //FIXME for r_cache_thrash + #include "client/hud.h" #include "client/view.h" #include "client/world.h" @@ -57,9 +61,41 @@ #include "qw/include/client.h" #include "qw/include/cl_parse.h" +int scr_showpause; +static cvar_t scr_showpause_cvar = { + .name = "showpause", + .description = + "Toggles display of pause graphic", + .default_value = "1", + .flags = CVAR_NONE, + .value = { .type = &cexpr_int, .value = &scr_showpause }, +}; +int scr_showram; +static cvar_t scr_showram_cvar = { + .name = "showram", + .description = + "Show RAM icon if game is running low on memory", + .default_value = "1", + .flags = CVAR_NONE, + .value = { .type = &cexpr_int, .value = &scr_showram }, +}; +int scr_showturtle; +static cvar_t scr_showturtle_cvar = { + .name = "showturtle", + .description = + "Show a turtle icon if your fps is below 10", + .default_value = "0", + .flags = CVAR_NONE, + .value = { .type = &cexpr_int, .value = &scr_showturtle }, +}; + +view_t *cl_screen_view; static view_t *net_view; static view_t *loading_view; +static qpic_t *scr_ram; +static qpic_t *scr_turtle; + static void draw_pic (view_t *view) { @@ -89,6 +125,60 @@ SCR_CShift (void) r_funcs->Draw_BlendScreen (cl.viewstate.cshift_color); } +static void +SCR_DrawRam (void) +{ + if (!scr_showram) + return; + + if (!r_cache_thrash) + return; + + //FIXME view + r_funcs->Draw_Pic (cl_screen_view->xpos + 32, cl_screen_view->ypos, + scr_ram); +} + +static void +SCR_DrawTurtle (void) +{ + static int count; + + if (!scr_showturtle) + return; + + if (r_data->frametime < 0.1) { + count = 0; + return; + } + + count++; + if (count < 3) + return; + + //FIXME view + r_funcs->Draw_Pic (cl_screen_view->xpos, cl_screen_view->ypos, + scr_turtle); +} + +static void +SCR_DrawPause (void) +{ + qpic_t *pic; + + if (!scr_showpause) // turn off for screenshots + return; + + if (!r_data->paused) + return; + + //FIXME view conwidth + pic = r_funcs->Draw_CachePic ("gfx/pause.lmp", true); + r_funcs->Draw_Pic ((cl_screen_view->xlen - pic->width) / 2, + (cl_screen_view->ylen - 48 - pic->height) / 2, + pic); +} + static void scr_draw_views (void) { @@ -104,7 +194,7 @@ scr_draw_views (void) view_setgravity (cl_netgraph_view, hud_swap ? grav_southeast : grav_southwest); - view_draw (r_data->vid->conview); + view_draw (cl_screen_view); } static SCR_Func scr_funcs_normal[] = { @@ -140,6 +230,45 @@ static SCR_Func *scr_funcs[] = { scr_funcs_finale, }; +void +CL_Init_Screen (void) +{ + qpic_t *pic; + + cl_screen_view = r_data->scr_view; + con_module->data->console->screen_view = cl_screen_view; + + scr_ram = r_funcs->Draw_PicFromWad ("ram"); + scr_turtle = r_funcs->Draw_PicFromWad ("turtle"); + + Cvar_Register (&scr_showpause_cvar, 0, 0); + Cvar_Register (&scr_showram_cvar, 0, 0); + Cvar_Register (&scr_showturtle_cvar, 0, 0); + + pic = r_funcs->Draw_PicFromWad ("net"); + net_view = view_new (64, 0, pic->width, pic->height, grav_northwest); + net_view->draw = draw_pic; + net_view->data = pic; + net_view->visible = 0; + view_add (cl_screen_view, net_view); + + const char *name = "gfx/loading.lmp"; + pic = r_funcs->Draw_CachePic (name, 1); + loading_view = view_new (0, -24, pic->width, pic->height, grav_center); + loading_view->draw = draw_cachepic; + loading_view->data = (void *) name; + loading_view->visible = 0; + view_add (cl_screen_view, loading_view); + + cl_netgraph_view = view_new (0, hud_sb_lines, + NET_TIMINGS + 16, + cl_netgraph_height + 25, + grav_southwest); + cl_netgraph_view->draw = CL_NetGraph; + cl_netgraph_view->visible = 0; + view_add (cl_screen_view, cl_netgraph_view); +} + void CL_UpdateScreen (double realtime) { @@ -148,35 +277,6 @@ CL_UpdateScreen (double realtime) if (index >= sizeof (scr_funcs) / sizeof (scr_funcs[0])) index = 0; - if (!net_view) { - qpic_t *pic = r_funcs->Draw_PicFromWad ("net"); - net_view = view_new (64, 0, pic->width, pic->height, grav_northwest); - net_view->draw = draw_pic; - net_view->data = pic; - net_view->visible = 0; - view_add (r_data->scr_view, net_view); - } - - if (!loading_view) { - const char *name = "gfx/loading.lmp"; - qpic_t *pic = r_funcs->Draw_CachePic (name, 1); - loading_view = view_new (0, -24, pic->width, pic->height, grav_center); - loading_view->draw = draw_cachepic; - loading_view->data = (void *) name; - loading_view->visible = 0; - view_add (r_data->vid->conview, loading_view); - } - - if (!cl_netgraph_view) { - cl_netgraph_view = view_new (0, hud_sb_lines, - NET_TIMINGS + 16, - cl_netgraph_height + 25, - grav_southwest); - cl_netgraph_view->draw = CL_NetGraph; - cl_netgraph_view->visible = 0; - view_add (r_data->vid->conview, cl_netgraph_view); - } - //FIXME not every time if (cls.state == ca_active) { if (cl.watervis) diff --git a/qw/source/sbar.c b/qw/source/sbar.c index d016aeb11..e58113595 100644 --- a/qw/source/sbar.c +++ b/qw/source/sbar.c @@ -390,7 +390,7 @@ draw_weapons_hud (view_t *view) if (view->parent->gravity == grav_southeast) x = view->xlen - 24; - for (i = r_data->vid->conview->ylen < 204; i < 7; i++) { + for (i = cl_screen_view->ylen < 204; i < 7; i++) { if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN << i)) { flashon = calc_flashon (cl.item_gettime[i], IT_SHOTGUN << i); draw_subpic (view, x, i * 16, sb_weapons[flashon][i], 0, 0, 24, 16); @@ -857,7 +857,7 @@ Sbar_DeathmatchOverlay (view_t *view, int start) int l, y; int skip = 10; - if (r_data->vid->conview->xlen < 244) // FIXME: magic number, gained through experimentation + if (cl_screen_view->xlen < 244) // FIXME: magic number, gained through experimentation return; if (largegame) @@ -1009,8 +1009,7 @@ sbar_update_vis (void) if ((sb_updates >= r_data->vid->numpages) && !headsup) return; - if (con_module - && con_module->data->console->lines == r_data->vid->conview->ylen) + if (con_module && con_module->data->console->lines == cl_screen_view->ylen) return; // console is full screen if (!hud_sb_lines) @@ -1698,12 +1697,12 @@ init_sbar_views (void) view_t *minifrags_view = 0; view_t *miniteam_view = 0; - if (r_data->vid->conview->xlen < 512) { + if (cl_screen_view->xlen < 512) { sbar_view = view_new (0, 0, 320, 48, grav_south); sbar_frags_view = view_new (0, 0, 130, 8, grav_northeast); sbar_frags_view->draw = draw_frags; - } else if (r_data->vid->conview->xlen < 640) { + } else if (cl_screen_view->xlen < 640) { sbar_view = view_new (0, 0, 512, 48, grav_south); minifrags_view = view_new (320, 0, 192, 48, grav_southwest); minifrags_view->draw = draw_minifrags; @@ -1765,8 +1764,8 @@ init_sbar_views (void) if (miniteam_view) view_add (sbar_view, miniteam_view); - if (r_data->vid->conview->xlen > 640) { - int l = (r_data->vid->conview->xlen - 640) / 2; + if (cl_screen_view->xlen > 640) { + int l = (cl_screen_view->xlen - 640) / 2; view = view_new (-l, 0, l, 48, grav_southwest); view->draw = draw_tile; @@ -1787,12 +1786,12 @@ init_hud_views (void) view_t *minifrags_view = 0; view_t *miniteam_view = 0; - if (r_data->vid->conview->xlen < 512) { + if (cl_screen_view->xlen < 512) { hud_view = view_new (0, 0, 320, 48, grav_south); hud_frags_view = view_new (0, 0, 130, 8, grav_northeast); hud_frags_view->draw = draw_frags; - } else if (r_data->vid->conview->xlen < 640) { + } else if (cl_screen_view->xlen < 640) { hud_view = view_new (0, 0, 512, 48, grav_south); minifrags_view = view_new (320, 0, 192, 48, grav_southwest); @@ -1844,7 +1843,7 @@ init_hud_views (void) if (miniteam_view) view_add (hud_view, miniteam_view); - view = view_new (0, 0, r_data->vid->conview->xlen, 48, grav_south); + view = view_new (0, 0, cl_screen_view->xlen, 48, grav_south); view_add (view, hud_view); hud_view = view; @@ -1856,19 +1855,17 @@ init_hud_views (void) static void init_views (void) { - hud_main_view = view_new (0, 0, r_data->vid->conview->xlen, - r_data->vid->conview->ylen, - grav_northwest); - if (con_module) - view_insert (con_module->data->console->view, hud_main_view, 0); + hud_main_view = view_new (0, 0, cl_screen_view->xlen, cl_screen_view->ylen, + grav_northwest); + view_insert (cl_screen_view, hud_main_view, 0); hud_main_view->resize_x = 1; // get resized if the 2d view resizes hud_main_view->resize_y = 1; hud_main_view->visible = 0; // but don't let the console draw our stuff - if (r_data->vid->conview->ylen > 300) + if (cl_screen_view->ylen > 300) hud_overlay_view = view_new (0, 0, 320, 300, grav_center); else - hud_overlay_view = view_new (0, 0, 320, r_data->vid->conview->ylen, - grav_center); + hud_overlay_view = view_new (0, 0, 320, cl_screen_view->ylen, + grav_center); hud_overlay_view->draw = draw_overlay; hud_overlay_view->visible = 0;