foxygit / doom Log in
commit 738e91cd6052ddfd12651cd2f639888cbc64b05e
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Wed Oct 1 18:31:38 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Wed Oct 1 18:31:38 2008 +0000

    Finish merge of hexen/v_video.c to common (oops)

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1315
---
 src/v_video.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/v_video.h |  1 +
 2 files changed, 51 insertions(+)

diff --git a/src/v_video.c b/src/v_video.c
index 9d125255..564359a4 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -365,6 +365,56 @@ void V_DrawTLPatch(int x, int y, patch_t * patch)
     }
 }

+//
+// V_DrawAltTLPatch
+//
+// Masks a column based translucent masked pic to the screen.
+//
+
+void V_DrawAltTLPatch(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_DrawAltTLPatch");
+    }
+
+    col = 0;
+    desttop = 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
 //
diff --git a/src/v_video.h b/src/v_video.h
index 1d4569b9..34c36f79 100644
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -58,6 +58,7 @@ void V_CopyRect(int srcx, int srcy, byte *source,
 void V_DrawPatch(int x, int y, patch_t *patch);
 void V_DrawPatchFlipped(int x, int y, patch_t *patch);
 void V_DrawTLPatch(int x, int y, patch_t *patch);
+void V_DrawAltTLPatch(int x, int y, patch_t * patch);
 void V_DrawShadowedPatch(int x, int y, patch_t *patch);

 void V_DrawPatchDirect(int x, int y, patch_t *patch);