summaryrefslogtreecommitdiff
path: root/src/v_video.c
diff options
context:
space:
mode:
authorSimon Howard2008-09-20 21:26:30 +0000
committerSimon Howard2008-09-20 21:26:30 +0000
commit7c1407ea7171f83287b720ec65450940c9cbf158 (patch)
tree5b727c28aaba5328ff113a9022af4feda8f6cd24 /src/v_video.c
parent221a00eba5f46470e92f9259fe1202851703ac8c (diff)
downloadchocolate-doom-7c1407ea7171f83287b720ec65450940c9cbf158.tar.gz
chocolate-doom-7c1407ea7171f83287b720ec65450940c9cbf158.tar.bz2
chocolate-doom-7c1407ea7171f83287b720ec65450940c9cbf158.zip
Merge heretic/v_video.c to common code.
Subversion-branch: /branches/raven-branch Subversion-revision: 1252
Diffstat (limited to 'src/v_video.c')
-rw-r--r--src/v_video.c125
1 files changed, 122 insertions, 3 deletions
diff --git a/src/v_video.c b/src/v_video.c
index e2fc7eea..db2779c2 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -26,9 +26,6 @@
//
//-----------------------------------------------------------------------------
-
-
-
#include "i_system.h"
#include "doomtype.h"
@@ -42,6 +39,11 @@
#include "w_wad.h"
#include "z_zone.h"
+// Blending table used for fuzzpatch, etc.
+// Only used in Heretic/Hexen
+
+byte *tinttable = NULL;
+
// The screen buffer that the v_video.c code draws to.
static byte *dest_screen = NULL;
@@ -312,6 +314,114 @@ void V_DrawPatchDirect(int x, int y, patch_t *patch)
{
V_DrawPatch(x, y, patch);
}
+
+//
+// V_DrawFuzzPatch
+//
+// Masks a column based translucent masked pic to the screen.
+//
+
+void V_DrawFuzzPatch(int x, int y, patch_t * patch)
+{
+ int count, col;
+ column_t *column;
+ byte *desttop, *dest, *source;
+ int w;
+
+ y -= SHORT(patch->topoffset);
+ x -= SHORT(patch->leftoffset);
+
+ if (x < 0
+ || x + SHORT(patch->width) > SCREENWIDTH
+ || y < 0
+ || y + SHORT(patch->height) > SCREENHEIGHT)
+ {
+ I_Error("Bad V_DrawFuzzPatch");
+ }
+
+ col = 0;
+ desttop = dest_screen + y * SCREENWIDTH + x;
+
+ w = SHORT(patch->width);
+ for (; col < w; x++, col++, desttop++)
+ {
+ column = (column_t *) ((byte *) patch + LONG(patch->columnofs[col]));
+
+ // step through the posts in a column
+
+ while (column->topdelta != 0xff)
+ {
+ source = (byte *) column + 3;
+ dest = desttop + column->topdelta * SCREENWIDTH;
+ count = column->length;
+
+ while (count--)
+ {
+ *dest = tinttable[((*dest) << 8) + *source++];
+ dest += SCREENWIDTH;
+ }
+ column = (column_t *) ((byte *) column + column->length + 4);
+ }
+ }
+}
+
+//
+// V_DrawShadowedPatch
+//
+// Masks a column based masked pic to the screen.
+//
+
+void V_DrawShadowedPatch(int x, int y, patch_t *patch)
+{
+ int count, col;
+ column_t *column;
+ byte *desttop, *dest, *source;
+ byte *desttop2, *dest2;
+ int w;
+
+ y -= SHORT(patch->topoffset);
+ x -= SHORT(patch->leftoffset);
+
+ if (x < 0
+ || x + SHORT(patch->width) > SCREENWIDTH
+ || y < 0
+ || y + SHORT(patch->height) > SCREENHEIGHT)
+ {
+ I_Error("Bad V_DrawShadowedPatch");
+ }
+
+ col = 0;
+ desttop = dest_screen + y * SCREENWIDTH + x;
+ desttop2 = dest_screen + (y + 2) * SCREENWIDTH + x + 2;
+
+ w = SHORT(patch->width);
+ for (; col < w; x++, col++, desttop++, desttop2++)
+ {
+ column = (column_t *) ((byte *) patch + LONG(patch->columnofs[col]));
+
+ // step through the posts in a column
+
+ while (column->topdelta != 0xff)
+ {
+ source = (byte *) column + 3;
+ dest = desttop + column->topdelta * SCREENWIDTH;
+ dest2 = desttop2 + column->topdelta * SCREENWIDTH;
+ count = column->length;
+
+ while (count--)
+ {
+ *dest2 = tinttable[((*dest2) << 8)];
+ dest2 += SCREENWIDTH;
+ *dest = *source++;
+ dest += SCREENWIDTH;
+
+ }
+ column = (column_t *) ((byte *) column + column->length + 4);
+ }
+ }
+}
+
+
@@ -345,7 +455,16 @@ void V_DrawBlock(int x, int y, int width, int height, byte *src)
dest += SCREENWIDTH;
}
}
+
+//
+// Draw a "raw" screen (lump containing raw data to blit directly
+// to the screen)
+//
+void V_DrawRawScreen(byte *raw)
+{
+ memcpy(dest_screen, raw, SCREENWIDTH * SCREENHEIGHT);
+}
//
// V_Init