From 2955fac550f1411f2bf9634f79140aa07613baf2 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 1 Mar 2004 23:47:39 +0000 Subject: [PATCH] first step of centerprint/finale cleanup. fixes the misplaced text for end-of-episode text --- include/QF/screen.h | 4 +++- include/sbar.h | 1 + libs/video/renderer/gl/gl_screen.c | 15 +++------------ libs/video/renderer/r_screen.c | 15 ++++++++------- libs/video/renderer/sw/screen.c | 13 +++---------- libs/video/renderer/sw32/screen.c | 13 +++---------- nq/source/cl_screen.c | 24 ++++++++++++++++++++++-- nq/source/sbar.c | 12 ++++++++---- qw/source/cl_screen.c | 24 ++++++++++++++++++++++-- qw/source/sbar.c | 7 +++++++ 10 files changed, 80 insertions(+), 48 deletions(-) diff --git a/include/QF/screen.h b/include/QF/screen.h index 7a1e7601f..12333aab9 100644 --- a/include/QF/screen.h +++ b/include/QF/screen.h @@ -49,12 +49,14 @@ void SCR_CalcRefdef (void); void SCR_BeginLoadingPlaque (void); void SCR_EndLoadingPlaque (void); +struct view_s; void SCR_DrawRam (void); void SCR_DrawFPS (void); void SCR_DrawTime (void); void SCR_DrawTurtle (void); void SCR_DrawPause (void); -void SCR_CheckDrawCenterString (void); +void SCR_DrawCenterString (struct view_s *view); +void SCR_CheckDrawCenterString (struct view_s *view); struct tex_s *SCR_ScreenShot (int width, int height); void SCR_DrawStringToSnap (const char *s, struct tex_s *tex, int x, int y); diff --git a/include/sbar.h b/include/sbar.h index e60c427fe..7e78658e4 100644 --- a/include/sbar.h +++ b/include/sbar.h @@ -51,6 +51,7 @@ void Sbar_IntermissionOverlay (void); // called each frame after the level has been completed void Sbar_FinaleOverlay (void); +void Sbar_DrawCenterPrint (void); void Sbar_LogFrags (void); diff --git a/libs/video/renderer/gl/gl_screen.c b/libs/video/renderer/gl/gl_screen.c index 41a744141..120bd5ab4 100644 --- a/libs/video/renderer/gl/gl_screen.c +++ b/libs/video/renderer/gl/gl_screen.c @@ -254,18 +254,9 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs) // draw any areas not covered by the refresh SCR_TileClear (); - if (r_force_fullscreen /*FIXME better test*/ == 1 && key_dest == - key_game) { - Sbar_IntermissionOverlay (); - } else if (r_force_fullscreen /*FIXME better test*/ == 2 && - key_dest == key_game) { - Sbar_FinaleOverlay (); - SCR_CheckDrawCenterString (); - } else { - while (*scr_funcs) { - (*scr_funcs)(); - scr_funcs++; - } + while (*scr_funcs) { + (*scr_funcs)(); + scr_funcs++; } if (r_speeds->int_val) { diff --git a/libs/video/renderer/r_screen.c b/libs/video/renderer/r_screen.c index 1d620b2b8..feedea84a 100644 --- a/libs/video/renderer/r_screen.c +++ b/libs/video/renderer/r_screen.c @@ -47,6 +47,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/render.h" #include "QF/screen.h" #include "QF/sys.h" +#include "QF/view.h" #include "compat.h" #include "r_cvar.h" @@ -214,8 +215,8 @@ SCR_CenterPrint (const char *str) } } -static void -SCR_DrawCenterString (void) +void +SCR_DrawCenterString (view_t *view) { char *start; int remaining, j, l, x, y; @@ -231,16 +232,16 @@ SCR_DrawCenterString (void) start = scr_centerstring; if (scr_center_lines <= 4) - y = vid.height * 0.35; + y = view->yabs + view->ylen * 0.35; else - y = 48; + y = view->yabs + 48; do { // scan the width of the line for (l = 0; l < 40; l++) if (start[l] == '\n' || !start[l]) break; - x = (vid.width - l * 8) / 2; + x = view->xabs + (view->xlen - l * 8) / 2; for (j = 0; j < l; j++, x += 8) { Draw_Character (x, y, start[j]); if (!remaining--) @@ -259,7 +260,7 @@ SCR_DrawCenterString (void) } void -SCR_CheckDrawCenterString (void) +SCR_CheckDrawCenterString (view_t *view) { scr_copytop = 1; if (scr_center_lines > scr_erase_lines) @@ -272,7 +273,7 @@ SCR_CheckDrawCenterString (void) if (key_dest != key_game) return; - SCR_DrawCenterString (); + SCR_DrawCenterString (view); } float diff --git a/libs/video/renderer/sw/screen.c b/libs/video/renderer/sw/screen.c index f8f15be45..e375b5314 100644 --- a/libs/video/renderer/sw/screen.c +++ b/libs/video/renderer/sw/screen.c @@ -239,16 +239,9 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs) D_EnableBackBufferAccess (); // of all overlay stuff if drawing // directly - if (r_force_fullscreen /*FIXME*/ == 1 && key_dest == key_game) { - Sbar_IntermissionOverlay (); - } else if (r_force_fullscreen /*FIXME*/ == 2 && key_dest == key_game) { - Sbar_FinaleOverlay (); - SCR_CheckDrawCenterString (); - } else { - while (*scr_funcs) { - (*scr_funcs)(); - scr_funcs++; - } + while (*scr_funcs) { + (*scr_funcs)(); + scr_funcs++; } D_DisableBackBufferAccess (); // for adapters that can't stay mapped diff --git a/libs/video/renderer/sw32/screen.c b/libs/video/renderer/sw32/screen.c index 7dbcd553a..ebe0353ba 100644 --- a/libs/video/renderer/sw32/screen.c +++ b/libs/video/renderer/sw32/screen.c @@ -260,16 +260,9 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs) D_EnableBackBufferAccess (); // of all overlay stuff if drawing // directly - if (r_force_fullscreen /*FIXME*/ == 1 && key_dest == key_game) { - Sbar_IntermissionOverlay (); - } else if (r_force_fullscreen /*FIXME*/ == 2 && key_dest == key_game) { - Sbar_FinaleOverlay (); - SCR_CheckDrawCenterString (); - } else { - while (*scr_funcs) { - (*scr_funcs)(); - scr_funcs++; - } + while (*scr_funcs) { + (*scr_funcs)(); + scr_funcs++; } D_DisableBackBufferAccess (); // for adapters that can't stay mapped diff --git a/nq/source/cl_screen.c b/nq/source/cl_screen.c index 89567b168..6d2597b55 100644 --- a/nq/source/cl_screen.c +++ b/nq/source/cl_screen.c @@ -64,23 +64,43 @@ SCR_DrawNet (void) Draw_Pic (scr_vrect.x + 64, scr_vrect.y, scr_net); } -static SCR_Func scr_funcs[] = { +static SCR_Func scr_funcs_normal[] = { Draw_Crosshair, SCR_DrawRam, SCR_DrawNet, SCR_DrawTurtle, SCR_DrawPause, - SCR_CheckDrawCenterString, + Sbar_DrawCenterPrint, Sbar_Draw, Con_DrawConsole, 0 }; +static SCR_Func scr_funcs_intermission[] = { + Sbar_IntermissionOverlay, + 0 +}; + +static SCR_Func scr_funcs_finale[] = { + Sbar_FinaleOverlay, + 0, +}; + void CL_UpdateScreen (double realtime) { + SCR_Func *scr_funcs = scr_funcs_normal; + cl_wateralpha = r_wateralpha->value; + if (r_force_fullscreen /*FIXME better test*/ == 1 + && key_dest == key_game) { + scr_funcs = scr_funcs_intermission; + } else if (r_force_fullscreen /*FIXME better test*/ == 2 + && key_dest == key_game) { + scr_funcs = scr_funcs_finale; + } + V_PrepBlend (); SCR_UpdateScreen (realtime, scr_funcs); } diff --git a/nq/source/sbar.c b/nq/source/sbar.c index 53b43c712..f3eabafc9 100644 --- a/nq/source/sbar.c +++ b/nq/source/sbar.c @@ -1185,12 +1185,16 @@ Sbar_IntermissionOverlay (void) void Sbar_FinaleOverlay (void) { - qpic_t *pic; - scr_copyeverything = 1; - pic = Draw_CachePic ("gfx/finale.lmp", true); - Draw_Pic ((vid.width - pic->width) / 2, 16, pic); + draw_cachepic (overlay_view, 0, 16, "gfx/finale.lmp", 1); + SCR_CheckDrawCenterString (overlay_view); +} + +void +Sbar_DrawCenterPrint (void) +{ + SCR_CheckDrawCenterString (overlay_view); } static void diff --git a/qw/source/cl_screen.c b/qw/source/cl_screen.c index 9b36b887c..d42e0493e 100644 --- a/qw/source/cl_screen.c +++ b/qw/source/cl_screen.c @@ -69,22 +69,34 @@ SCR_DrawNet (void) Draw_Pic (scr_vrect.x + 64, scr_vrect.y, scr_net); } -static SCR_Func scr_funcs[] = { +static SCR_Func scr_funcs_normal[] = { Draw_Crosshair, SCR_DrawRam, SCR_DrawNet, CL_NetGraph, SCR_DrawTurtle, SCR_DrawPause, - SCR_CheckDrawCenterString, + Sbar_DrawCenterPrint, Sbar_Draw, Con_DrawConsole, 0 }; +static SCR_Func scr_funcs_intermission[] = { + Sbar_IntermissionOverlay, + 0 +}; + +static SCR_Func scr_funcs_finale[] = { + Sbar_FinaleOverlay, + 0, +}; + void CL_UpdateScreen (double realtime) { + SCR_Func *scr_funcs = scr_funcs_normal; + // don't allow cheats in multiplayer if (r_active) { if (cl.watervis) @@ -93,6 +105,14 @@ CL_UpdateScreen (double realtime) cl_wateralpha = 1.0; } + if (r_force_fullscreen /*FIXME better test*/ == 1 + && key_dest == key_game) { + scr_funcs = scr_funcs_intermission; + } else if (r_force_fullscreen /*FIXME better test*/ == 2 + && key_dest == key_game) { + scr_funcs = scr_funcs_finale; + } + V_PrepBlend (); SCR_UpdateScreen (realtime, scr_funcs); } diff --git a/qw/source/sbar.c b/qw/source/sbar.c index ccf5e080e..0844c87c7 100644 --- a/qw/source/sbar.c +++ b/qw/source/sbar.c @@ -1680,6 +1680,13 @@ Sbar_FinaleOverlay (void) scr_copyeverything = 1; draw_cachepic (overlay_view, 0, 16, "gfx/finale.lmp"); + SCR_CheckDrawCenterString (overlay_view); +} + +void +Sbar_DrawCenterPrint (void) +{ + SCR_CheckDrawCenterString (overlay_view); } static void