foxygit / doom Log in
commit 81c69106b287db38fe93a2855a66baef9f7ca9d7
Author:     Mike Swanson <mikeonthecomputer@gmail.com>
AuthorDate: Tue May 12 00:32:49 2015 -0700
Commit:     Mike Swanson <mikeonthecomputer@gmail.com>
CommitDate: Tue May 12 00:38:15 2015 -0700

    doom: the sky changes in final2 map11->12 and map20->21 transitions.

    The id Anthology version of doom2.exe with Final Doom fixed the "Sky
    never changes in Doom II" bug. The original Doom source release
    included the repaired code, but it was re-bugged in an early Chocolate
    Doom version to emulate the behavior of the better-known versions of
    vanilla.

    Thanks to @fabiangreffrath for demonstrating how he (more-generically)
    fixed the bug in Crispy Doom.

    Closes #533
---
 src/doom/g_game.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 64f5b274..bc582a52 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -612,6 +612,30 @@ void G_DoLoadLevel (void)

     skyflatnum = R_FlatNumForName(DEH_String(SKYFLATNAME));

+    // The "Sky never changes in Doom II" bug was fixed in
+    // the id Anthology version of doom2.exe for Final Doom.
+    if ((gamemode == commercial) && (gameversion == exe_final2))
+    {
+        char *skytexturename;
+
+        if (gamemap < 12)
+        {
+            skytexturename = "SKY1";
+        }
+        else if (gamemap < 21)
+        {
+            skytexturename = "SKY2";
+        }
+        else
+        {
+            skytexturename = "SKY3";
+        }
+
+        skytexturename = DEH_String(skytexturename);
+
+        skytexture = R_TextureNumForName(skytexturename);
+    }
+
     levelstarttic = gametic;        // for time calculation

     if (wipegamestate == GS_LEVEL)