foxygit / doom Log in
commit 1138de4fb695a3ca5e4d06d75891fadce5cf7679
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu Feb 2 21:10:20 2012 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu Feb 2 21:10:20 2012 +0000

    Fix scroll bar behavior (thanks Alexandre Xavier).

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 2484
---
 textscreen/txt_gui.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/textscreen/txt_gui.c b/textscreen/txt_gui.c
index d00e3a65..af1bb0a4 100644
--- a/textscreen/txt_gui.c
+++ b/textscreen/txt_gui.c
@@ -269,9 +269,9 @@ void TXT_DrawHorizScrollbar(int x, int y, int w, int cursor, int range)

     cursor_x = x + 1;

-    if (range > 1)
+    if (range > 0)
     {
-        cursor_x += (cursor * (w - 3)) / (range - 1);
+        cursor_x += (cursor * (w - 3)) / range;
     }

     if (cursor_x > x + w - 2)
@@ -320,9 +320,9 @@ void TXT_DrawVertScrollbar(int x, int y, int h, int cursor, int range)
         cursor_y = y + h - 2;
     }

-    if (range > 1)
+    if (range > 0)
     {
-        cursor_y += (cursor * (h - 3)) / (range - 1);
+        cursor_y += (cursor * (h - 3)) / range;
     }

     for (y1=y+1; y1<y+h-1; ++y1)