From 3061f0a15edc2737426c27091b184e201df3c78b Mon Sep 17 00:00:00 2001
From: yellowtd <ren_amon@hotmail.com>
Date: Mon, 19 Sep 2016 22:35:05 -0400
Subject: [PATCH] Enable Access to fadingmasks/Custom Wipes
enables custom fade wipes or access to fademasks for individual
mapheaders
---
src/d_main.c | 20 ++++++++++++++++++--
src/dehacked.c | 14 ++++++++++++++
src/doomstat.h | 5 +++++
src/g_game.c | 13 +++++++++++--
src/p_setup.c | 36 ++++++++++++++++++++++++++++++++----
5 files changed, 80 insertions(+), 8 deletions(-)
diff --git a/src/d_main.c b/src/d_main.c
index b61ec41435..fcec1726f9 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -446,8 +446,24 @@ static void D_Display(void)
if (rendermode != render_none)
{
- F_WipeEndScreen();
- F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
+ // miru: we can use the mapheaderinfo to change the forced wipe the instant the map loads
+ if (!mapheaderinfo[gamemap-1]->postlevelwipe)
+ {
+ F_WipeEndScreen();
+ F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
+ }
+ else
+ {
+ if (mapheaderinfo[gamemap-1]->postlevelwipe < 100)
+ {
+ F_WipeStartScreen();
+ V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, mapheaderinfo[gamemap-1]->wipecolor);
+ F_WipeEndScreen();
+ F_RunWipe(mapheaderinfo[gamemap-1]->postlevelwipe, gamestate != GS_TIMEATTACK);
+ }
+ }
+ //F_WipeEndScreen();
+ //F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
}
}
diff --git a/src/dehacked.c b/src/dehacked.c
index c31c226430..dde986a47e 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -1321,6 +1321,20 @@ static void readlevelheader(MYFILE *f, INT32 num)
else
mapheaderinfo[num-1]->menuflags &= ~LF2_NOVISITNEEDED;
}
+
+ // miru: we can build custom map header words here
+ else if (fastcmp(word, "LEVELWIPE"))
+ {
+ mapheaderinfo[num-1]->levelwipe = (INT16)i;
+ }
+ else if (fastcmp(word, "POSTLEVELWIPE"))
+ {
+ mapheaderinfo[num-1]->postlevelwipe = (INT16)i;
+ }
+ else if (fastcmp(word, "WIPECOLOR"))
+ {
+ mapheaderinfo[num-1]->wipecolor = (INT16)i;
+ }
else
deh_warning("Level header %d: unknown word '%s'", num, word);
}
diff --git a/src/doomstat.h b/src/doomstat.h
index 8072a15528..4aa7984b74 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -245,6 +245,11 @@ typedef struct
UINT8 numGradedMares; ///< Internal. For grade support.
nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful.
+ // miru: to use custom mapheaderinfo options, we need to add them to the struct first
+ INT16 levelwipe;
+ INT16 postlevelwipe;
+ INT16 wipecolor;
+
// Lua stuff.
// (This is not ifdeffed so the map header structure can stay identical, just in case.)
UINT8 numCustomOptions; ///< Internal. For Lua custom value support.
diff --git a/src/g_game.c b/src/g_game.c
index 6effd9f09d..196ef98f36 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1620,8 +1620,17 @@ void G_DoLoadLevel(boolean resetplayer)
levelstarttic = gametic; // for time calculation
- if (wipegamestate == GS_LEVEL)
- wipegamestate = -1; // force a wipe
+ // miru: postlevelwipe - just in case
+ if (!mapheaderinfo[gamemap-1]->postlevelwipe)
+ {
+ if (wipegamestate == GS_LEVEL)
+ wipegamestate = -1; // force a wipe
+ }
+ else
+ {
+ if (wipegamestate == GS_LEVEL)
+ wipegamestate = -1; // force a wipe
+ }
if (gamestate == GS_INTERMISSION)
Y_EndIntermission();
diff --git a/src/p_setup.c b/src/p_setup.c
index e56c44c706..76a3c5bf0e 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -223,6 +223,15 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->levelflags = 0;
DEH_WriteUndoline("MENUFLAGS", va("%d", mapheaderinfo[num]->menuflags), UNDO_NONE);
mapheaderinfo[num]->menuflags = 0;
+
+ // miru: in order for the custom mapheaderinfo values to work properly, we need to do this
+ DEH_WriteUndoline("LEVELWIPE", va("%d", mapheaderinfo[num]->levelwipe), UNDO_NONE);
+ mapheaderinfo[num]->levelwipe = 0;
+ DEH_WriteUndoline("POSTLEVELWIPE", va("%d", mapheaderinfo[num]->postlevelwipe), UNDO_NONE);
+ mapheaderinfo[num]->postlevelwipe = 0;
+ DEH_WriteUndoline("WIPECOLOR", va("%d", mapheaderinfo[num]->wipecolor), UNDO_NONE);
+ mapheaderinfo[num]->wipecolor = 31;
+
// TODO grades support for delfile (pfft yeah right)
P_DeleteGrades(num);
// an even further impossibility, delfile custom opts support
@@ -2529,11 +2538,30 @@ boolean P_SetupLevel(boolean skipprecip)
// But only if we didn't do the special stage wipe
if (rendermode != render_none && !ranspecialwipe)
{
- F_WipeStartScreen();
- V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
+ // miru: we could add the option to render different wipes here
- F_WipeEndScreen();
- F_RunWipe(wipedefs[wipe_level_toblack], false);
+ // if the map header doesn't even call the option
+ // then don't bother turning off
+ if (!mapheaderinfo[gamemap-1]->levelwipe)
+ {
+ F_WipeStartScreen();
+ V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
+
+ F_WipeEndScreen();
+ F_RunWipe(wipedefs[wipe_level_toblack], false);
+ }
+ // if it does then we can load custom fades from the fadingmask
+ else
+ {
+ if (mapheaderinfo[gamemap-1]->levelwipe < 100)
+ {
+ F_WipeStartScreen();
+ V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, mapheaderinfo[gamemap-1]->wipecolor);
+
+ F_WipeEndScreen();
+ F_RunWipe(mapheaderinfo[gamemap-1]->levelwipe, false);
+ }
+ }
}
// Print "SPEEDING OFF TO [ZONE] [ACT 1]..."
--
GitLab