From 0044cf8336b5a623b5a56a2827a938276363770e Mon Sep 17 00:00:00 2001 From: James Haley Date: Sun, 29 Aug 2010 14:50:13 +0000 Subject: 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 --- src/strife/d_main.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'src/strife/d_main.c') diff --git a/src/strife/d_main.c b/src/strife/d_main.c index c888438a..1bfaad65 100644 --- a/src/strife/d_main.c +++ b/src/strife/d_main.c @@ -65,6 +65,7 @@ #include "i_system.h" #include "i_timer.h" #include "i_video.h" +#include "i_swap.h" #include "g_game.h" @@ -1106,6 +1107,45 @@ static void D_Endoom(void) I_Endoom(endoom); } +//============================================================================= +// +// haleyjd: Chocolate Strife Specifics +// +// None of the code in here is from the original executable, but is needed for +// other reasons. + +// +// D_PatchClipCallback +// +// haleyjd 08/28/10: Clip patches to the framebuffer without errors. +// Returns false if V_DrawPatch should return without drawing. +// +static boolean D_PatchClipCallback(patch_t *patch, int x, int y) +{ + // note that offsets were already accounted for in V_DrawPatch + return (x >= 0 && y >= 0 + && x + SHORT(patch->width) <= SCREENWIDTH + && y + SHORT(patch->height) <= SCREENHEIGHT); +} + +// +// D_InitChocoStrife +// +// haleyjd 08/28/10: Take care of some Strife-specific initialization +// that is necessitated by Chocolate Doom issues, such as setting global +// callbacks. +// +static void D_InitChocoStrife(void) +{ + // set the V_DrawPatch clipping callback + V_SetPatchClipCallback(D_PatchClipCallback); +} + +// +// End Chocolate Strife Specifics +// +//============================================================================= + // // D_DoomMain // @@ -1568,7 +1608,7 @@ void D_DoomMain (void) SetSaveGameDir(iwadfile); // Check for -file in shareware - if (0 /*modifiedgame*/) // TEST + if (0 /*modifiedgame*/) // STRIFE-FIXME: DISABLED FOR TESTING { // These are the lumps that will be checked in IWAD, // if any one is not present, execution will be aborted. @@ -1744,6 +1784,9 @@ void D_DoomMain (void) I_PrintStartupBanner(gamedescription); PrintDehackedBanners(); + // haleyjd 08/28/10: Init Choco Strife stuff. + D_InitChocoStrife(); + printf (DEH_String("M_Init: Init miscellaneous info.\n")); M_Init (); -- cgit v1.2.3