1
0
Fork 0
forked from fte/fteqw

better compat with hexen2's intermissions

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5773 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-09-30 21:03:59 +00:00
parent 069433abc1
commit 155ef1f460

View file

@ -650,7 +650,7 @@ static char *SCR_CopyCenterPrint(cprint_t *p) //reads the link under the mouse c
} }
#define MAX_CPRINT_LINES 512 #define MAX_CPRINT_LINES 512
int SCR_DrawCenterString (vrect_t *rect, cprint_t *p, struct font_s *font) int SCR_DrawCenterString (vrect_t *playerrect, cprint_t *p, struct font_s *font)
{ {
int l; int l;
int y, x; int y, x;
@ -667,6 +667,8 @@ int SCR_DrawCenterString (vrect_t *rect, cprint_t *p, struct font_s *font)
conchar_t *line_end[MAX_CPRINT_LINES]; conchar_t *line_end[MAX_CPRINT_LINES];
int linecount; int linecount;
vrect_t rect = *playerrect;
// the finale prints the characters one at a time // the finale prints the characters one at a time
if (p->flags & CPRINT_TYPEWRITER) if (p->flags & CPRINT_TYPEWRITER)
remaining = scr_printspeed.value * (cl.time - p->time_start); remaining = scr_printspeed.value * (cl.time - p->time_start);
@ -682,34 +684,20 @@ int SCR_DrawCenterString (vrect_t *rect, cprint_t *p, struct font_s *font)
if (p->flags & CPRINT_BACKGROUND) if (p->flags & CPRINT_BACKGROUND)
{ //hexen2 style plaque. { //hexen2 style plaque.
int w = 320, h=200; int w = 320;
if (pic) if (rect.width > w)
R_GetShaderSizes(pic, &w, &h, false);
if (rect->width > w)
{ {
rect->x = (rect->x + rect->width/2) - (w / 2); rect.x = (rect.x + rect.width/2) - (w / 2);
rect->width = w; rect.width = w;
} }
if (rect->width < 32) if (rect.width < 32)
return 0; return 0;
rect->x += 16; rect.x += 16;
rect->width -= 32; rect.width -= 32;
/*keep the text inside the image too*/
if (pic)
{
if (rect->height > h)
{
rect->y = (rect->y + rect->height/2) - (h/2);
rect->height = h;
}
rect->y += 16;
rect->height -= 32;
}
} }
y = rect->y; y = rect.y;
if (pic) if (pic)
{ {
@ -721,15 +709,15 @@ int SCR_DrawCenterString (vrect_t *rect, cprint_t *p, struct font_s *font)
w *= 24.0/h; w *= 24.0/h;
h = 24; h = 24;
y+= 16; y+= 16;
R2D_ScalePic ( (vid.width-w)/2, 16, w, h, pic); R2D_ScalePic (rect.x + (rect.width-w)/2, y, w, h, pic);
y+= h; y+= h;
y+= 8; y+= 8;
} }
} }
Font_BeginString(font, mousecursor_x, mousecursor_y, &mousex, &mousey); Font_BeginString(font, mousecursor_x, mousecursor_y, &mousex, &mousey);
Font_BeginString(font, rect->x, y, &left, &top); Font_BeginString(font, rect.x, y, &left, &top);
Font_BeginString(font, rect->x+rect->width, rect->y+rect->height, &right, &bottom); Font_BeginString(font, rect.x+rect.width, rect.y+rect.height, &right, &bottom);
linecount = Font_LineBreaks(p->string, p->string + p->charcount, (p->flags & CPRINT_NOWRAP)?0x7fffffff:(right - left), MAX_CPRINT_LINES, line_start, line_end); linecount = Font_LineBreaks(p->string, p->string + p->charcount, (p->flags & CPRINT_NOWRAP)?0x7fffffff:(right - left), MAX_CPRINT_LINES, line_start, line_end);
ch = Font_CharHeight(); ch = Font_CharHeight();
@ -759,12 +747,16 @@ int SCR_DrawCenterString (vrect_t *rect, cprint_t *p, struct font_s *font)
{ //hexen2 style plaque. { //hexen2 style plaque.
Font_EndString(font); Font_EndString(font);
if (*p->titleimage) if (*p->titleimage && pic)
R2D_ScalePic (rect->x + ((int)rect->width - pic->width)/2, rect->y + ((int)rect->height - pic->height)/2, pic->width, pic->height, pic); {
int w, h;
R_GetShaderSizes(pic, &w, &h, false);
R2D_Letterbox(playerrect->x, playerrect->y, playerrect->width, playerrect->height, pic, w, h);
}
else else
Draw_ApproxTextBox(rect->x, (y * vid.height) / (float)vid.pixelheight, rect->width, linecount*Font_CharVHeight(font)); Draw_ApproxTextBox(rect.x, (y * (float)vid.height) / (float)vid.pixelheight, rect.width, linecount*Font_CharVHeight(font));
Font_BeginString(font, rect->x, y, &left, &top); Font_BeginString(font, rect.x, y, &left, &top);
} }
for (l = 0; l < linecount; l++, y += ch) for (l = 0; l < linecount; l++, y += ch)