shithub: choc

Download patch

ref: 9f1245d39e792a9c37d0b7e06184dfff54394154
parent: 3b8e76e7363712827be27729a79b0d3139a2ff97
author: Simon Howard <[email protected]>
date: Thu Mar 16 17:17:45 EST 2006

Better fix for the intermission screen crash. Don't call WI_End until
after we change to gamestate != GS_INTERMISSION

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 422

--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: g_game.c 405 2006-03-02 00:57:25Z fraggle $
+// $Id: g_game.c 422 2006-03-16 22:17:45Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -134,7 +134,7 @@
 
 
 static const char
-rcsid[] = "$Id: g_game.c 405 2006-03-02 00:57:25Z fraggle $";
+rcsid[] = "$Id: g_game.c 422 2006-03-16 22:17:45Z fraggle $";
 
 #include <string.h>
 #include <stdlib.h>
@@ -207,6 +207,9 @@
 void	G_DoWorldDone (void); 
 void	G_DoSaveGame (void); 
  
+// Gamestate the last time G_Ticker was called.
+
+gamestate_t     oldgamestate; 
  
 gameaction_t    gameaction; 
 gamestate_t     gamestate; 
@@ -909,6 +912,15 @@
 	    } 
 	}
     }
+
+    // Have we just finished displaying an intermission screen?
+
+    if (oldgamestate == GS_INTERMISSION && gamestate != GS_INTERMISSION)
+    {
+        WI_End();
+    }
+
+    oldgamestate = gamestate;
     
     // do main actions
     switch (gamestate) 
--- a/src/wi_stuff.c
+++ b/src/wi_stuff.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: wi_stuff.c 421 2006-03-16 21:46:59Z fraggle $
+// $Id: wi_stuff.c 422 2006-03-16 22:17:45Z 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 421 2006-03-16 21:46:59Z fraggle $";
+rcsid[] = "$Id: wi_stuff.c 422 2006-03-16 22:17:45Z fraggle $";
 
 #include <stdio.h>
 
@@ -748,11 +748,6 @@
 {
     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)
@@ -768,7 +763,11 @@
 
     if (!--cnt)
     {
-	WI_End();
+        // Don't call WI_End yet.  G_WorldDone doesnt immediately 
+        // change gamestate, so WI_Drawer is still going to get
+        // run until that happens.  If we do that after WI_End
+        // (which unloads all the graphics), we're in trouble.
+	//WI_End();
 	G_WorldDone();
     }
 
@@ -1559,9 +1558,6 @@
       case NoState:
 	WI_updateNoState();
 	break;
-
-      case FinishedIntermission:
-        break;
     }
 
 }
@@ -1822,9 +1818,6 @@
       case NoState:
 	WI_drawNoState();
 	break;
-
-      case FinishedIntermission:
-        break;
     }
 }
 
@@ -1873,7 +1866,6 @@
 
 void WI_Start(wbstartstruct_t* wbstartstruct)
 {
-
     WI_initVariables(wbstartstruct);
     WI_loadData();
 
--- a/src/wi_stuff.h
+++ b/src/wi_stuff.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: wi_stuff.h 421 2006-03-16 21:46:59Z fraggle $
+// $Id: wi_stuff.h 422 2006-03-16 22:17:45Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -40,7 +40,6 @@
     NoState = -1,
     StatCount,
     ShowNextLoc,
-    FinishedIntermission,
 } stateenum_t;
 
 // Called by main loop, animate the intermission.
@@ -52,6 +51,9 @@
 
 // Setup for an intermission screen.
 void WI_Start(wbstartstruct_t*	 wbstartstruct);
+
+// Shut down the intermission screen
+void WI_End(void);
 
 #endif
 //-----------------------------------------------------------------------------