summaryrefslogtreecommitdiff
path: root/src/heretic/f_finale.c
diff options
context:
space:
mode:
authorSimon Howard2013-09-19 03:51:15 +0000
committerSimon Howard2013-09-19 03:51:15 +0000
commit157725a6018290484cb24f97a1df6ce3e8fb8ce2 (patch)
tree38a91acf5727440a0d4e193384fc5f172258e322 /src/heretic/f_finale.c
parent0ef3690cb4508ebbfcc26bb9e227bcb2319d8729 (diff)
downloadchocolate-doom-157725a6018290484cb24f97a1df6ce3e8fb8ce2.tar.gz
chocolate-doom-157725a6018290484cb24f97a1df6ce3e8fb8ce2.tar.bz2
chocolate-doom-157725a6018290484cb24f97a1df6ce3e8fb8ce2.zip
Fix crash at Heretic E2 end screen (thanks Leitbild).
Subversion-branch: /branches/v2-branch Subversion-revision: 2665
Diffstat (limited to 'src/heretic/f_finale.c')
-rw-r--r--src/heretic/f_finale.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/heretic/f_finale.c b/src/heretic/f_finale.c
index 7f6b3594..1592dac4 100644
--- a/src/heretic/f_finale.c
+++ b/src/heretic/f_finale.c
@@ -29,6 +29,7 @@
#include "deh_str.h"
#include "i_swap.h"
#include "i_video.h"
+#include "i_scale.h"
#include "s_sound.h"
#include "v_video.h"
@@ -304,8 +305,15 @@ void F_DemonScroll(void)
void F_DrawUnderwater(void)
{
- static boolean underwawa;
+ static boolean underwawa = false;
extern boolean askforquit;
+ char *lumpname;
+ byte *palette;
+
+ // The underwater screen has its own palette, which is rather annoying.
+ // The palette doesn't correspond to the normal palette. Because of
+ // this, we must regenerate the lookup tables used in the video scaling
+ // code.
switch (finalestage)
{
@@ -313,8 +321,12 @@ void F_DrawUnderwater(void)
if (!underwawa)
{
underwawa = true;
- memset((byte *) 0xa0000, 0, SCREENWIDTH * SCREENHEIGHT);
- I_SetPalette(W_CacheLumpName(DEH_String("E2PAL"), PU_CACHE));
+ V_DrawFilledBox(0, 0, SCREENWIDTH, SCREENHEIGHT, 0);
+ lumpname = DEH_String("E2PAL");
+ palette = W_CacheLumpName(lumpname, PU_STATIC);
+ I_SetPalette(palette);
+ I_ResetScaleTables(palette);
+ W_ReleaseLumpName(lumpname);
V_DrawRawScreen(W_CacheLumpName(DEH_String("E2END"), PU_CACHE));
}
paused = false;
@@ -323,6 +335,15 @@ void F_DrawUnderwater(void)
break;
case 2:
+ if (underwawa)
+ {
+ lumpname = DEH_String("PLAYPAL");
+ palette = W_CacheLumpName(lumpname, PU_STATIC);
+ I_SetPalette(palette);
+ I_ResetScaleTables(palette);
+ W_ReleaseLumpName(lumpname);
+ underwawa = false;
+ }
V_DrawRawScreen(W_CacheLumpName(DEH_String("TITLE"), PU_CACHE));
//D_StartTitle(); // go to intro/demo mode.
}