From 82767751a775236780f930f77b3c7751c1499d52 Mon Sep 17 00:00:00 2001
From: sirlemonhead <sirlemonhead@gmail.com>
Date: Tue, 26 Nov 2019 14:44:01 +0000
Subject: [PATCH] Fix credits screen

# Conflicts:
#	source/exhumed/src/exhumed.cpp
---
 source/exhumed/src/exhumed.cpp | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp
index 78ebe173a..796f44e45 100644
--- a/source/exhumed/src/exhumed.cpp
+++ b/source/exhumed/src/exhumed.cpp
@@ -1342,6 +1342,7 @@ void DoCredits()
 
     int var_20 = 0;
 
+    if (videoGetRenderMode() == REND_CLASSIC)
     FadeOut(0);
 
     int nCreditsIndex = FindGString("CREDITS");
@@ -1357,36 +1358,27 @@ void DoCredits()
             nCreditsIndex++;
         }
 
-        // vars
-        int eax = (10 * (nCreditsIndex - nStart - 1)) / 2;
-
-        if (eax < 0) {
-            eax++;
-        }
-
-        eax >>= 1;
-
-        int y = 100 - eax;
-
-        int edi = nStart;
-
+        int y = 100 - ((10 * (nCreditsIndex - nStart - 1)) / 2);
 
         for (int i = nStart; i < nCreditsIndex; i++)
         {
-            // var 24 ==
-
-            int nWidth = MyGetStringWidth(gString[edi]);
-            myprintext((320 - nWidth) / 2, y, gString[edi], 0);
-
-            edi++;
+            int nWidth = MyGetStringWidth(gString[i]);
+            myprintext((320 - nWidth) / 2, y, gString[i], 0);
             y += 10;
         }
 
         videoNextPage();
+
+        nCreditsIndex++;
+
+        if (videoGetRenderMode() == REND_CLASSIC)
         FadeIn();
 
-        while ((int)totalclock + 600 > (int)totalclock)
+        int nDuration = (int)totalclock + 600;
+
+        while ((int)totalclock <= nDuration)
         {
+            handleevents();
 			if(inputState.GetKeyStatus(sc_F12))
             {
                 var_20++;
@@ -1399,6 +1391,7 @@ void DoCredits()
             }
         }
 
+        if (videoGetRenderMode() == REND_CLASSIC)
         FadeOut(0);
     }