more centerprint cleanup.

This commit is contained in:
Bill Currie 2004-03-02 00:58:13 +00:00
parent d3dfb0ebd1
commit 39fc0fe721
4 changed files with 49 additions and 33 deletions

View file

@ -55,8 +55,7 @@ void SCR_DrawFPS (void);
void SCR_DrawTime (void); void SCR_DrawTime (void);
void SCR_DrawTurtle (void); void SCR_DrawTurtle (void);
void SCR_DrawPause (void); void SCR_DrawPause (void);
void SCR_DrawCenterString (struct view_s *view); void SCR_DrawCenterString (struct view_s *view, int remaining);
void SCR_CheckDrawCenterString (struct view_s *view);
struct tex_s *SCR_ScreenShot (int width, int height); struct tex_s *SCR_ScreenShot (int width, int height);
void SCR_DrawStringToSnap (const char *s, struct tex_s *tex, int x, int y); void SCR_DrawStringToSnap (const char *s, struct tex_s *tex, int x, int y);
@ -65,7 +64,10 @@ int SCR_ModalMessage (const char *text);
extern float scr_con_current; extern float scr_con_current;
extern float scr_centertime_off; extern float scr_centertime_off;
extern float scr_conlines; // lines of console to display extern float scr_conlines; // lines of console to display
extern float scr_centertime_start; // for slow victory printing
extern int scr_center_lines;
extern int scr_erase_lines;
extern int scr_fullupdate; // set to 0 to force full redraw extern int scr_fullupdate; // set to 0 to force full redraw
extern int sb_lines; extern int sb_lines;

View file

@ -216,17 +216,10 @@ SCR_CenterPrint (const char *str)
} }
void void
SCR_DrawCenterString (view_t *view) SCR_DrawCenterString (view_t *view, int remaining)
{ {
char *start; char *start;
int remaining, j, l, x, y; int j, l, x, y;
// the finale prints the characters one at a time
if (r_force_fullscreen /* FIXME: better test */)
remaining = scr_printspeed->value * (r_realtime -
scr_centertime_start);
else
remaining = 9999;
scr_erase_center = 0; scr_erase_center = 0;
start = scr_centerstring; start = scr_centerstring;
@ -259,23 +252,6 @@ SCR_DrawCenterString (view_t *view)
} while (1); } while (1);
} }
void
SCR_CheckDrawCenterString (view_t *view)
{
scr_copytop = 1;
if (scr_center_lines > scr_erase_lines)
scr_erase_lines = scr_center_lines;
scr_centertime_off -= r_frametime;
if (scr_centertime_off <= 0 && !r_force_fullscreen /*FIXME: better test*/)
return;
if (key_dest != key_game)
return;
SCR_DrawCenterString (view);
}
float float
CalcFov (float fov_x, float width, float height) CalcFov (float fov_x, float width, float height)
{ {

View file

@ -48,6 +48,7 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "client.h" #include "client.h"
#include "compat.h" #include "compat.h"
#include "game.h" #include "game.h"
#include "r_cvar.h" // for scr_printspeed
#include "sbar.h" #include "sbar.h"
#include "server.h" #include "server.h"
@ -1185,16 +1186,34 @@ Sbar_IntermissionOverlay (void)
void void
Sbar_FinaleOverlay (void) Sbar_FinaleOverlay (void)
{ {
int remaining;
if (key_dest != key_game)
return;
scr_copyeverything = 1; scr_copyeverything = 1;
draw_cachepic (overlay_view, 0, 16, "gfx/finale.lmp", 1); draw_cachepic (overlay_view, 0, 16, "gfx/finale.lmp", 1);
SCR_CheckDrawCenterString (overlay_view); // the finale prints the characters one at a time
remaining = scr_printspeed->value * (realtime - scr_centertime_start);
SCR_DrawCenterString (overlay_view, remaining);
} }
void void
Sbar_DrawCenterPrint (void) Sbar_DrawCenterPrint (void)
{ {
SCR_CheckDrawCenterString (overlay_view); scr_copytop = 1;
if (scr_center_lines > scr_erase_lines)
scr_erase_lines = scr_center_lines;
scr_centertime_off -= r_frametime;
if (scr_centertime_off <= 0)
return;
if (key_dest != key_game)
return;
SCR_DrawCenterString (overlay_view, -1);
} }
static void static void

View file

@ -60,6 +60,7 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "cl_parse.h" #include "cl_parse.h"
#include "client.h" #include "client.h"
#include "compat.h" #include "compat.h"
#include "r_cvar.h" // for scr_printspeed
#include "sbar.h" #include "sbar.h"
int sb_updates; // if >= vid.numpages, no update needed int sb_updates; // if >= vid.numpages, no update needed
@ -1677,16 +1678,34 @@ Sbar_IntermissionOverlay (void)
void void
Sbar_FinaleOverlay (void) Sbar_FinaleOverlay (void)
{ {
int remaining;
if (key_dest != key_game)
return;
scr_copyeverything = 1; scr_copyeverything = 1;
draw_cachepic (overlay_view, 0, 16, "gfx/finale.lmp"); draw_cachepic (overlay_view, 0, 16, "gfx/finale.lmp");
SCR_CheckDrawCenterString (overlay_view); // the finale prints the characters one at a time
remaining = scr_printspeed->value * (realtime - scr_centertime_start);
SCR_DrawCenterString (overlay_view, remaining);
} }
void void
Sbar_DrawCenterPrint (void) Sbar_DrawCenterPrint (void)
{ {
SCR_CheckDrawCenterString (overlay_view); scr_copytop = 1;
if (scr_center_lines > scr_erase_lines)
scr_erase_lines = scr_center_lines;
scr_centertime_off -= r_frametime;
if (scr_centertime_off <= 0)
return;
if (key_dest != key_game)
return;
SCR_DrawCenterString (overlay_view, -1);
} }
static void static void