From 28d84572d39aa9789f04032fb8699ead02faf6a9 Mon Sep 17 00:00:00 2001 From: Molgrum Date: Thu, 26 Jul 2007 16:30:56 +0000 Subject: [PATCH] Another fix that I like. Also avoids using the scr_conlines global. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2553 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/keys.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/engine/client/keys.c b/engine/client/keys.c index 4f11f057b..295e80c86 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -719,14 +719,15 @@ void Key_Console (int key) if (key == K_PGUP || key==K_MWHEELUP) { - // scr_conlines actually contains the height of the console in + // con_current->vislines actually contains the height of the console in // pixels (and not the number of lines). It's 22 pixels larger // than the text area to include borders I guess... weird shit. // - Molgrum if (keydown[K_CTRL]) - con_current->display -= ( ( (int)scr_conlines - 22 ) / 8 ); + con_current->display -= ( ( (int)con_current->vislines - 22 ) / 8 ); else con_current->display -= 2; + if (con_current->display < upperconbound) con_current->display = upperconbound; return; @@ -734,18 +735,25 @@ void Key_Console (int key) if (key == K_PGDN || key==K_MWHEELDOWN) { - // scr_conlines actually contains the height of the console in + // con_current->vislines actually contains the height of the console in // pixels (and not the number of lines). It's 22 pixels larger // than the text area to include borders I guess... weird shit. // - Molgrum if (keydown[K_CTRL]) - con_current->display += ( ( (int)scr_conlines - 22 ) / 8 ); + con_current->display += ( ( (int)con_current->vislines - 22 ) / 8 ); else con_current->display += 2; + if (con_current->display < upperconbound) con_current->display = upperconbound; - if (con_current->display > con_current->current) + + // Changed this to prevent the following scenario: PGUP, ENTER, PGDN ,(you'll + // see the ^^^^ indicator), PGDN, (the indicator disappears but the console position + // is still the same). + // - Molgrum + if (con_current->display >= ( con_current->current - 1 )) con_current->display = con_current->current; + return; }