diff options
Diffstat (limited to 'src/v_video.c')
-rw-r--r-- | src/v_video.c | 96 |
1 files changed, 95 insertions, 1 deletions
diff --git a/src/v_video.c b/src/v_video.c index 6549a81b..d18dbb7a 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -48,12 +48,18 @@ byte *tinttable = NULL; +// villsa [STRIFE] Blending table used for Strife +byte *xlatab = NULL; + // The screen buffer that the v_video.c code draws to. static byte *dest_screen = NULL; int dirtybox[4]; +// haleyjd 08/28/10: clipping callback function for patches. +// This is needed for Chocolate Strife, which clips patches to the screen. +static vpatchclipfunc_t patchclip_callback = NULL; // // V_MarkRect @@ -108,6 +114,20 @@ void V_CopyRect(int srcx, int srcy, byte *source, } } +// +// V_SetPatchClipCallback +// +// haleyjd 08/28/10: Added for Strife support. +// By calling this function, you can setup runtime error checking for patch +// clipping. Strife never caused errors by drawing patches partway off-screen. +// Some versions of vanilla DOOM also behaved differently than the default +// implementation, so this could possibly be extended to those as well for +// accurate emulation. +// +void V_SetPatchClipCallback(vpatchclipfunc_t func) +{ + patchclip_callback = func; +} // // V_DrawPatch @@ -127,6 +147,13 @@ void V_DrawPatch(int x, int y, patch_t *patch) y -= SHORT(patch->topoffset); x -= SHORT(patch->leftoffset); + // haleyjd 08/28/10: Strife needs silent error checking here. + if(patchclip_callback) + { + if(!patchclip_callback(patch, x, y)) + return; + } + #ifdef RANGECHECK if (x < 0 || x + SHORT(patch->width) > SCREENWIDTH @@ -184,6 +211,13 @@ void V_DrawPatchFlipped(int x, int y, patch_t *patch) y -= SHORT(patch->topoffset); x -= SHORT(patch->leftoffset); + // haleyjd 08/28/10: Strife needs silent error checking here. + if(patchclip_callback) + { + if(!patchclip_callback(patch, x, y)) + return; + } + #ifdef RANGECHECK if (x < 0 || x + SHORT(patch->width) > SCREENWIDTH @@ -285,6 +319,55 @@ void V_DrawTLPatch(int x, int y, patch_t * patch) } // +// V_DrawXlaPatch +// +// villsa [STRIFE] Masks a column based translucent masked pic to the screen. +// + +void V_DrawXlaPatch(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(patchclip_callback) + { + if(!patchclip_callback(patch, x, y)) + return; + } + + 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 = xlatab[*dest + ((*source) << 8)]; + source++; + dest += SCREENWIDTH; + } + column = (column_t *) ((byte *) column + column->length + 4); + } + } +} + +// // V_DrawAltTLPatch // // Masks a column based translucent masked pic to the screen. @@ -400,6 +483,17 @@ void V_LoadTintTable(void) } // +// V_LoadXlaTable +// +// villsa [STRIFE] Load xla table from XLATAB lump. +// + +void V_LoadXlaTable(void) +{ + xlatab = W_CacheLumpName("XLATAB", PU_STATIC); +} + +// // V_DrawBlock // Draw a linear block of pixels into the view buffer. // @@ -559,7 +653,7 @@ void WritePCXfile(char *filename, byte *data, void V_ScreenShot(char *format) { int i; - char lbmname[12]; + char lbmname[16]; // haleyjd 20110213: BUG FIX - 12 is too small! // find a file name to save it to |