summaryrefslogtreecommitdiff
path: root/src/strife/d_main.c
diff options
context:
space:
mode:
authorJames Haley2010-08-29 14:50:13 +0000
committerJames Haley2010-08-29 14:50:13 +0000
commit0044cf8336b5a623b5a56a2827a938276363770e (patch)
treeb4188bf352de1804db7f475290510fc227209017 /src/strife/d_main.c
parentbc72291b8270486f7b608a569b9675ab63bd80fb (diff)
downloadchocolate-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/strife/d_main.c')
-rw-r--r--src/strife/d_main.c45
1 files changed, 44 insertions, 1 deletions
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 ();