diff options
author | James Haley | 2010-08-29 14:50:13 +0000 |
---|---|---|
committer | James Haley | 2010-08-29 14:50:13 +0000 |
commit | 0044cf8336b5a623b5a56a2827a938276363770e (patch) | |
tree | b4188bf352de1804db7f475290510fc227209017 /src/v_video.c | |
parent | bc72291b8270486f7b608a569b9675ab63bd80fb (diff) | |
download | chocolate-doom-0044cf8336b5a623b5a56a2827a938276363770e.tar.gz chocolate-doom-0044cf8336b5a623b5a56a2827a938276363770e.tar.bz2 chocolate-doom-0044cf8336b5a623b5a56a2827a938276363770e.zip |
Added patch clipping callback mechanism, since Strife needs to modify
all the V_DrawPatch functions that it uses to return if the patch
overlaps the edge of or is completely outside of the framebuffer. This
could be extended to handle Final DOOM as well if it proves
satisfactory.
Subversion-branch: /branches/strife-branch
Subversion-revision: 1972
Diffstat (limited to 'src/v_video.c')
-rw-r--r-- | src/v_video.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/v_video.c b/src/v_video.c index 6549a81b..b6c621ba 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -54,6 +54,9 @@ 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 +111,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 +144,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 +208,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 |