foxygit / doom Log in
commit 3b8e76e7363712827be27729a79b0d3139a2ff97
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu Mar 16 21:46:59 2006 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu Mar 16 21:46:59 2006 +0000

    Fix crasher when starting new levels, because the intermissions code
    tries to draw patches which have been unloaded (WI_Drawer runs
    after WI_End, because it is waiting for the game loop to load
    the new level)

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 421
---
 src/wi_stuff.c | 15 +++++++++++++--
 src/wi_stuff.h |  6 +++---
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/wi_stuff.c b/src/wi_stuff.c
index da51d3e3..41e6e193 100644
--- a/src/wi_stuff.c
+++ b/src/wi_stuff.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: wi_stuff.c 352 2006-01-28 20:03:09Z fraggle $
+// $Id: wi_stuff.c 421 2006-03-16 21:46:59Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -44,7 +44,7 @@
 //-----------------------------------------------------------------------------

 static const char
-rcsid[] = "$Id: wi_stuff.c 352 2006-01-28 20:03:09Z fraggle $";
+rcsid[] = "$Id: wi_stuff.c 421 2006-03-16 21:46:59Z fraggle $";

 #include <stdio.h>

@@ -748,6 +748,11 @@ void WI_End(void)
 {
     void WI_unloadData(void);
     WI_unloadData();
+
+    // Set state to finished.  This prevents trying to draw the screen
+    // again using any of the patches we have now unloaded.
+
+    state = FinishedIntermission;
 }

 void WI_initNoState(void)
@@ -1554,6 +1559,9 @@ void WI_Ticker(void)
       case NoState:
 	WI_updateNoState();
 	break;
+
+      case FinishedIntermission:
+        break;
     }

 }
@@ -1814,6 +1822,9 @@ void WI_Drawer (void)
       case NoState:
 	WI_drawNoState();
 	break;
+
+      case FinishedIntermission:
+        break;
     }
 }

diff --git a/src/wi_stuff.h b/src/wi_stuff.h
index 948bc20b..da14002f 100644
--- a/src/wi_stuff.h
+++ b/src/wi_stuff.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: wi_stuff.h 8 2005-07-23 16:44:57Z fraggle $
+// $Id: wi_stuff.h 421 2006-03-16 21:46:59Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -39,8 +39,8 @@ typedef enum
 {
     NoState = -1,
     StatCount,
-    ShowNextLoc
-
+    ShowNextLoc,
+    FinishedIntermission,
 } stateenum_t;

 // Called by main loop, animate the intermission.