From 756fa2bbd80480d20382d81317f5dc0341bc3f49 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 12 Dec 2017 05:13:53 +0000 Subject: [PATCH] New userdef structure "screenfade" Set to zero to disable the hard-coded fade to black transition between screens, menu or when the level ends. Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@6556 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/config.cpp | 1 + source/duke3d/src/game.h | 1 + source/duke3d/src/gamedef.cpp | 1 + source/duke3d/src/gamedef.h | 1 + source/duke3d/src/gamestructures.cpp | 2 ++ source/duke3d/src/screens.cpp | 6 ++++++ 6 files changed, 12 insertions(+) diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index c22646be8..0f846d0dc 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -247,6 +247,7 @@ void CONFIG_SetDefaults(void) ud.configversion = 0; ud.weaponscale = 100; ud.textscale = 200; + ud.screenfade = 1; ud.config.CheckForUpdates = 1; diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index e7206bf3d..538ffae28 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -246,6 +246,7 @@ typedef struct { char wchoice[MAX_WEAPONS]; uint8_t user_map; + uint8_t screenfade; } user_defs; extern user_defs ud; diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 7a790f58f..26cd66177 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -1227,6 +1227,7 @@ const memberlabel_t UserdefsLabels[]= { "screenarea_y1", USERDEFS_SCREENAREA_Y1, 0, 0 }, { "screenarea_x2", USERDEFS_SCREENAREA_X2, 0, 0 }, { "screenarea_y2", USERDEFS_SCREENAREA_Y2, 0, 0 }, + { "screenfade", USERDEFS_SCREENFADE, 0, 0 }, { NULL, -1, 0, 0 } // END OF LIST }; diff --git a/source/duke3d/src/gamedef.h b/source/duke3d/src/gamedef.h index 44f222000..b4f0d8443 100644 --- a/source/duke3d/src/gamedef.h +++ b/source/duke3d/src/gamedef.h @@ -530,6 +530,7 @@ enum UserdefsLabel_t USERDEFS_SCREENAREA_Y1, USERDEFS_SCREENAREA_X2, USERDEFS_SCREENAREA_Y2, + USERDEFS_SCREENFADE, USERDEFS_END }; diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 615475aae..6581df610 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -177,6 +177,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum) case USERDEFS_SCREENAREA_Y1: labelNum = ud.screenarea_y1; break; case USERDEFS_SCREENAREA_X2: labelNum = ud.screenarea_x2; break; case USERDEFS_SCREENAREA_Y2: labelNum = ud.screenarea_y2; break; + case USERDEFS_SCREENFADE: labelNum = ud.screenfade; break; default: labelNum = -1; break; } @@ -304,6 +305,7 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const iSet) case USERDEFS_SCREENAREA_Y1: ud.screenarea_y1 = iSet; break; case USERDEFS_SCREENAREA_X2: ud.screenarea_x2 = iSet; break; case USERDEFS_SCREENAREA_Y2: ud.screenarea_y2 = iSet; break; + case USERDEFS_SCREENFADE: ud.screenfade = iSet; break; default: break; } } diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index b1c4c315e..d5f3acca9 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -1299,6 +1299,8 @@ void G_DisplayRest(int32_t smoothratio) void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e) { + if (ud.screenfade == 0) + return; setpalettefade(r, g, b, e); nextpage(); @@ -1311,6 +1313,8 @@ void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e) // STEP must evenly divide END-START, i.e. abs(end-start)%step == 0 void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step) { + if (ud.screenfade == 0) + return; if (getrendermode() >= REND_POLYMOST) { G_FadePalette(r, g, b, end); @@ -1336,6 +1340,8 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_ // START and END limits are always inclusive! static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t tile) { + if (ud.screenfade == 0) + return; // STEP must evenly divide END-START Bassert(klabs(end-start)%step == 0);