diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/heretic/f_finale.c | 27 | ||||
-rw-r--r-- | src/i_scale.c | 26 | ||||
-rw-r--r-- | src/i_scale.h | 1 |
3 files changed, 51 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. } diff --git a/src/i_scale.c b/src/i_scale.c index 6d03d708..32efabca 100644 --- a/src/i_scale.c +++ b/src/i_scale.c @@ -405,6 +405,32 @@ static void I_InitSquashTable(byte *palette) puts(""); } +// Destroy the scaling lookup tables. This should only ever be called +// if switching to a completely different palette from the normal one +// (in which case the mappings no longer make any sense). + +void I_ResetScaleTables(byte *palette) +{ + if (stretch_tables[0] != NULL) + { + Z_Free(stretch_tables[0]); + Z_Free(stretch_tables[1]); + + printf("I_ResetScaleTables: Regenerating lookup tables..\n"); + stretch_tables[0] = GenerateStretchTable(palette, 20); + stretch_tables[1] = GenerateStretchTable(palette, 40); + } + + if (half_stretch_table != NULL) + { + Z_Free(half_stretch_table); + + printf("I_ResetScaleTables: Regenerating lookup table.."); + + half_stretch_table = GenerateStretchTable(palette, 50); + } +} + // // Aspect ratio correcting scale up functions. diff --git a/src/i_scale.h b/src/i_scale.h index 3553847f..89d5da13 100644 --- a/src/i_scale.h +++ b/src/i_scale.h @@ -31,6 +31,7 @@ #include "doomtype.h" void I_InitScale(byte *_src_buffer, byte *_dest_buffer, int _dest_pitch); +void I_ResetScaleTables(byte *palette); // Scaled modes (direct multiples of 320x200) |