foxygit / doom Log in
commit b00b65538a1f7a04fdd46d7c193a7c59733fde9b
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Tue Dec 9 23:32:19 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Tue Dec 9 23:32:19 2008 +0000

    Make intermission screen work on MAP33, to be consistent with Vanilla
    Doom. Also, make levels after MAP33 trigger a V_DrawPatch error.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 1414
---
 src/wi_stuff.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/wi_stuff.c b/src/wi_stuff.c
index 938d6915..238462de 100644
--- a/src/wi_stuff.c
+++ b/src/wi_stuff.c
@@ -427,13 +427,32 @@ void WI_drawLF(void)
 {
     int y = WI_TITLEY;

-    // draw <LevelName>
-    V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2,
-		y, FB, lnames[wbs->last]);
+    if (wbs->last < NUMCMAPS)
+    {
+        // draw <LevelName>
+        V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2,
+                    y, FB, lnames[wbs->last]);
+
+        // draw "Finished!"
+        y += (5*SHORT(lnames[wbs->last]->height))/4;
+    }
+    else if (wbs->last == NUMCMAPS)
+    {
+        // MAP33 - nothing is displayed!
+    }
+    else if (wbs->last > NUMCMAPS)
+    {
+        // > MAP33.  Doom bombs out here with a Bad V_DrawPatch error.
+        // I'm pretty sure that doom2.exe is just reading into random
+        // bits of memory at this point, but let's try to be accurate
+        // anyway.  This deliberately triggers a V_DrawPatch error.
+
+        patch_t tmp = { SCREENWIDTH, SCREENHEIGHT, 1, 1,
+                        { 0, 0, 0, 0, 0, 0, 0, 0 } };
+
+        V_DrawPatch(0, y, FB, &tmp);
+    }

-    // draw "Finished!"
-    y += (5*SHORT(lnames[wbs->last]->height))/4;
-
     V_DrawPatch((SCREENWIDTH - SHORT(finished->width))/2,
 		y, FB, finished);
 }