Resize console upon resolution change

Basically, changing to a lower resolution won't cause your console to extend
past the screen anymore.
This commit is contained in:
James R 2019-03-26 12:30:02 -07:00
parent b9b36a44a8
commit e8071e66e4
1 changed files with 22 additions and 10 deletions

View File

@ -96,6 +96,7 @@ static size_t input_len; // length of current line, used to bound cursor and suc
// protos.
static void CON_InputInit(void);
static void CON_RecalcSize(void);
static void CON_ChangeHeight(void);
static void CONS_hudlines_Change(void);
static void CONS_backcolor_Change(void);
@ -447,6 +448,12 @@ static void CON_RecalcSize(void)
con_destlines = vid.height;
}
if (con_destlines > 0) // Resize console if already open
{
CON_ChangeHeight();
con_curlines = con_destlines;
}
// check for change of video width
if (conw == con_width)
return; // didn't change
@ -496,6 +503,20 @@ static void CON_RecalcSize(void)
Z_Free(tmp_buffer);
}
static void CON_ChangeHeight(void)
{
INT32 minheight = 20 * con_scalefactor; // 20 = 8+8+4
// toggle console in
con_destlines = (cons_height.value*vid.height)/100;
if (con_destlines < minheight)
con_destlines = minheight;
else if (con_destlines > vid.height)
con_destlines = vid.height;
con_destlines &= ~0x3; // multiple of text row height
}
// Handles Console moves in/out of screen (per frame)
//
static void CON_MoveConsole(void)
@ -584,16 +605,7 @@ void CON_Ticker(void)
CON_ClearHUD();
}
else
{
// toggle console in
con_destlines = (cons_height.value*vid.height)/100;
if (con_destlines < minheight)
con_destlines = minheight;
else if (con_destlines > vid.height)
con_destlines = vid.height;
con_destlines &= ~0x3; // multiple of text row height
}
CON_ChangeHeight();
}
// console movement