summaryrefslogtreecommitdiff
path: root/src/i_scale.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/i_scale.c')
-rw-r--r--src/i_scale.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/i_scale.c b/src/i_scale.c
index 8cecb1f8..56a7fb5b 100644
--- a/src/i_scale.c
+++ b/src/i_scale.c
@@ -26,7 +26,10 @@
//
//-----------------------------------------------------------------------------
-#include "doomdef.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "doomtype.h"
#include "i_video.h"
@@ -37,7 +40,7 @@
#define inline __inline
#endif
-// Should be screens[0]
+// Should be I_VideoBuffer
static byte *src_buffer;
@@ -402,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..\n");
+
+ half_stretch_table = GenerateStretchTable(palette, 50);
+ }
+}
+
//
// Aspect ratio correcting scale up functions.