From 7c1407ea7171f83287b720ec65450940c9cbf158 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 20 Sep 2008 21:26:30 +0000 Subject: Merge heretic/v_video.c to common code. Subversion-branch: /branches/raven-branch Subversion-revision: 1252 --- src/v_video.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 3 deletions(-) (limited to 'src/v_video.c') 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 -- cgit v1.2.3