From 9f1245d39e792a9c37d0b7e06184dfff54394154 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 16 Mar 2006 22:17:45 +0000 Subject: 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 --- src/g_game.c | 16 ++++++++++++++-- src/wi_stuff.c | 22 +++++++--------------- src/wi_stuff.h | 6 ++++-- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index e6c24f00..b8807da1 100644 --- 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 #include @@ -207,6 +207,9 @@ void G_DoVictory (void); 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 @@ void G_Ticker (void) } } } + + // Have we just finished displaying an intermission screen? + + if (oldgamestate == GS_INTERMISSION && gamestate != GS_INTERMISSION) + { + WI_End(); + } + + oldgamestate = gamestate; // do main actions switch (gamestate) diff --git a/src/wi_stuff.c b/src/wi_stuff.c index 41e6e193..75e2ff9e 100644 --- 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 @@ -748,11 +748,6 @@ 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) @@ -768,7 +763,11 @@ void WI_updateNoState(void) { 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 @@ void WI_Ticker(void) case NoState: WI_updateNoState(); break; - - case FinishedIntermission: - break; } } @@ -1822,9 +1818,6 @@ void WI_Drawer (void) case NoState: WI_drawNoState(); break; - - case FinishedIntermission: - break; } } @@ -1873,7 +1866,6 @@ void WI_initVariables(wbstartstruct_t* wbstartstruct) void WI_Start(wbstartstruct_t* wbstartstruct) { - WI_initVariables(wbstartstruct); WI_loadData(); diff --git a/src/wi_stuff.h b/src/wi_stuff.h index da14002f..5368de76 100644 --- 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 @@ typedef enum NoState = -1, StatCount, ShowNextLoc, - FinishedIntermission, } stateenum_t; // Called by main loop, animate the intermission. @@ -53,6 +52,9 @@ void WI_Drawer (void); // Setup for an intermission screen. void WI_Start(wbstartstruct_t* wbstartstruct); +// Shut down the intermission screen +void WI_End(void); + #endif //----------------------------------------------------------------------------- // -- cgit v1.2.3