Fix console scrolling too far when page scrolling with scaled text

This commit is contained in:
Marisa Heit 2016-11-11 22:56:19 -06:00
parent 4dce07762b
commit c5eb28d360

View file

@ -100,7 +100,7 @@ extern bool advancedemo;
extern FBaseCVar *CVars; extern FBaseCVar *CVars;
extern FConsoleCommand *Commands[FConsoleCommand::HASH_SIZE]; extern FConsoleCommand *Commands[FConsoleCommand::HASH_SIZE];
unsigned ConCols, PhysRows; unsigned ConCols;
int ConWidth; int ConWidth;
bool vidactive = false; bool vidactive = false;
bool cursoron = false; bool cursoron = false;
@ -533,7 +533,6 @@ void C_InitConsole (int width, int height, bool ingame)
} }
ConWidth = (width - LEFTMARGIN - RIGHTMARGIN); ConWidth = (width - LEFTMARGIN - RIGHTMARGIN);
ConCols = ConWidth / cwidth; ConCols = ConWidth / cwidth;
PhysRows = height / cheight;
if (conbuffer == NULL) conbuffer = new FConsoleBuffer; if (conbuffer == NULL) conbuffer = new FConsoleBuffer;
} }
@ -1324,7 +1323,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
case GK_PGUP: case GK_PGUP:
if (ev->data3 & (GKM_SHIFT|GKM_CTRL)) if (ev->data3 & (GKM_SHIFT|GKM_CTRL))
{ // Scroll console buffer up one page { // Scroll console buffer up one page
RowAdjust += (SCREENHEIGHT-4) / RowAdjust += (SCREENHEIGHT-4)/active_con_scale() /
((gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP) ? ConFont->GetHeight() : ConFont->GetHeight()*2) - 3; ((gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP) ? ConFont->GetHeight() : ConFont->GetHeight()*2) - 3;
} }
else if (RowAdjust < conbuffer->GetFormattedLineCount()) else if (RowAdjust < conbuffer->GetFormattedLineCount())
@ -1347,7 +1346,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
case GK_PGDN: case GK_PGDN:
if (ev->data3 & (GKM_SHIFT|GKM_CTRL)) if (ev->data3 & (GKM_SHIFT|GKM_CTRL))
{ // Scroll console buffer down one page { // Scroll console buffer down one page
const int scrollamt = (SCREENHEIGHT-4) / const int scrollamt = (SCREENHEIGHT-4)/active_con_scale() /
((gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP) ? ConFont->GetHeight() : ConFont->GetHeight()*2) - 3; ((gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP) ? ConFont->GetHeight() : ConFont->GetHeight()*2) - 3;
if (RowAdjust < scrollamt) if (RowAdjust < scrollamt)
{ {