Merge branch 'f_wipes' into 'master'

Colormapped fades

See merge request STJr/SRB2Internal!469
This commit is contained in:
MascaraSnake 2019-11-18 17:21:09 -05:00
commit 3df0afb7db
18 changed files with 380 additions and 53 deletions

View File

@ -277,7 +277,7 @@ static void D_Display(void)
&& wipetypepre != UINT8_MAX)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeColorFill(31);
F_WipeEndScreen();
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
}
@ -420,6 +420,12 @@ static void D_Display(void)
if (gamestate != GS_TIMEATTACK)
CON_Drawer();
#ifdef LEVELWIPES
// Running a level wipe
if (WipeInAction && WipeInLevel)
F_WipeTicker();
#endif
M_Drawer(); // menu is drawn even on top of everything
// focus lost moved to M_Drawer
@ -439,6 +445,7 @@ static void D_Display(void)
{
F_WipeEndScreen();
// Funny.
#ifndef LEVELWIPES
if (WipeStageTitle && st_overlay)
{
lt_ticker--;
@ -447,6 +454,7 @@ static void D_Display(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeStartScreen();
}
#endif
F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
}

View File

@ -628,6 +628,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#define ROTANGLES 24 // Needs to be a divisor of 360 (45, 60, 90, 120...)
#define ROTANGDIFF (360 / ROTANGLES)
/// Level wipes
//#define LEVELWIPES
#ifndef HAVE_PNG
#define NO_PNG_LUMPS
#endif

View File

@ -856,7 +856,7 @@ void F_IntroDrawer(void)
if (rendermode != render_none)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeColorFill(31);
F_WipeEndScreen();
F_RunWipe(99,true);
}
@ -866,10 +866,11 @@ void F_IntroDrawer(void)
else if (intro_scenenum == 10)
{
// The only fade to white in the entire damn game.
// (not true)
if (rendermode != render_none)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
F_WipeColorFill(0);
F_WipeEndScreen();
F_RunWipe(99,true);
}
@ -879,7 +880,7 @@ void F_IntroDrawer(void)
if (rendermode != render_none)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeColorFill(31);
F_WipeEndScreen();
F_RunWipe(99,true);
}
@ -926,7 +927,7 @@ void F_IntroDrawer(void)
patch_t *radar = W_CachePatchName("RADAR", PU_CACHE);
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeColorFill(31);
V_DrawScaledPatch(0, 0, 0, radar);
W_UnlockCachedPatch(radar);
V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
@ -939,7 +940,7 @@ void F_IntroDrawer(void)
patch_t *grass = W_CachePatchName("SGRASS5", PU_CACHE);
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeColorFill(31);
V_DrawScaledPatch(0, 0, 0, grass);
W_UnlockCachedPatch(grass);
V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
@ -952,7 +953,7 @@ void F_IntroDrawer(void)
patch_t *confront = W_CachePatchName("CONFRONT", PU_CACHE);
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeColorFill(31);
V_DrawSmallScaledPatch(0, 0, 0, confront);
W_UnlockCachedPatch(confront);
V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
@ -965,7 +966,7 @@ void F_IntroDrawer(void)
patch_t *sdo = W_CachePatchName("SONICDO2", PU_CACHE);
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeColorFill(31);
V_DrawSmallScaledPatch(0, 0, 0, sdo);
W_UnlockCachedPatch(sdo);
V_DrawString(224, 8, V_ALLOWLOWERCASE, cutscene_disptext);

View File

@ -141,7 +141,32 @@ void F_MenuPresTicker(boolean run);
#define FORCEWIPEOFF -2
extern boolean WipeInAction;
extern boolean WipeInLevel;
extern boolean WipeStageTitle;
typedef enum
{
WIPESTYLE_NORMAL,
WIPESTYLE_LEVEL
} wipestyle_t;
extern wipestyle_t wipestyle;
typedef enum
{
WSF_FADEOUT = 1,
WSF_FADEIN = 1<<1,
WSF_TOWHITE = 1<<2,
} wipestyleflags_t;
extern wipestyleflags_t wipestyleflags;
#define FADECOLORMAPDIV 8
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
#define FADEREDFACTOR 15
#define FADEGREENFACTOR 15
#define FADEBLUEFACTOR 10
extern UINT8 wipecolorfill;
extern INT32 lastwipetic;
// Don't know where else to place this constant
@ -151,6 +176,9 @@ extern INT32 lastwipetic;
void F_WipeStartScreen(void);
void F_WipeEndScreen(void);
void F_RunWipe(UINT8 wipetype, boolean drawMenu);
void F_WipeTicker(void);
void F_WipeStageTitle(void);
#define F_WipeColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (wipecolorfill = c))
tic_t F_GetWipeLength(UINT8 wipetype);
boolean F_WipeExists(UINT8 wipetype);

View File

@ -18,6 +18,7 @@
#include "r_draw.h" // transtable
#include "p_pspr.h" // tr_transxxx
#include "p_local.h"
#include "st_stuff.h"
#include "w_wad.h"
#include "z_zone.h"
@ -26,16 +27,19 @@
#include "m_menu.h"
#include "console.h"
#include "d_main.h"
#include "g_game.h"
#include "m_misc.h" // movie mode
#include "doomstat.h"
#ifdef HAVE_BLUA
#include "lua_hud.h" // level title
#endif
#ifdef HWRENDER
#include "hardware/hw_main.h"
#endif
#ifdef HAVE_BLUA
#include "lua_hud.h"
#endif
#if NUMSCREENS < 5
#define NOWIPE // do not enable wipe image post processing for ARM, SH and MIPS CPUs
#endif
@ -87,15 +91,23 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
//--------------------------------------------------------------------------
boolean WipeInAction = false;
boolean WipeInLevel = false;
boolean WipeStageTitle = false;
INT32 lastwipetic = 0;
wipestyle_t wipestyle = WIPESTYLE_NORMAL;
wipestyleflags_t wipestyleflags = 0;
#ifndef NOWIPE
static UINT8 *wipe_scr_start; //screen 3
static UINT8 *wipe_scr_end; //screen 4
static UINT8 *wipe_scr; //screen 0 (main drawing)
static fixed_t paldiv = 0;
static UINT8 curwipetype;
static UINT8 curwipeframe;
UINT8 wipecolorfill = 31;
/** Create fademask_t from lump
*
* \param lump Lump name to get data from
@ -154,7 +166,10 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
{
// Determine pixel to use from fademask
pcolor = &pMasterPalette[*lump++];
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
if (wipestyle == WIPESTYLE_LEVEL)
*mask++ = pcolor->s.red / FADECOLORMAPDIV;
else
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
}
fm.xscale = FixedDiv(vid.width<<FRACBITS, fm.width<<FRACBITS);
@ -175,6 +190,21 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
return NULL;
}
/** Draw the stage title.
*/
void F_WipeStageTitle(void)
{
// draw level title
if ((WipeStageTitle && st_overlay)
&& (wipestyle == WIPESTYLE_LEVEL)
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
{
ST_runTitleCard();
ST_drawWipeTitleCard();
}
}
/** Wipe ticker
*
* \param fademask pixels to change
@ -257,7 +287,7 @@ static void F_DoWipe(fademask_t *fademask)
relativepos += vid.width;
}
}
else if (*mask == 10)
else if (*mask >= ((wipestyle == WIPESTYLE_LEVEL) ? FADECOLORMAPROWS : 10))
{
// shortcut - memcpy target to work
while (draw_linestogo--)
@ -268,8 +298,25 @@ static void F_DoWipe(fademask_t *fademask)
}
else
{
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
if (wipestyle == WIPESTYLE_LEVEL)
{
int nmask;
UINT8 *fade = fadecolormap;
if (wipestyleflags & WSF_TOWHITE)
fade = fadecolormap + (FADECOLORMAPROWS * 256);
nmask = *mask;
if (wipestyleflags & WSF_FADEIN)
nmask = (FADECOLORMAPROWS-1) - nmask;
transtbl = fade + (nmask * 256);
}
else
{
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
}
// DRAWING LOOP
while (draw_linestogo--)
@ -279,8 +326,16 @@ static void F_DoWipe(fademask_t *fademask)
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
while (draw_rowstogo--)
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
if (wipestyle == WIPESTYLE_LEVEL)
{
while (draw_rowstogo--)
*w++ = transtbl[*e++];
}
else
{
while (draw_rowstogo--)
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
}
relativepos += vid.width;
}
@ -294,6 +349,8 @@ static void F_DoWipe(fademask_t *fademask)
free(scrxpos);
free(scrypos);
}
if (wipestyle == WIPESTYLE_LEVEL)
F_WipeStageTitle();
}
#endif
@ -352,6 +409,20 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
WipeInAction = true;
wipe_scr = screens[0];
// don't know where else to put this.
// this any good?
if (gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN)
wipestyle = WIPESTYLE_LEVEL;
else
wipestyle = WIPESTYLE_NORMAL;
curwipetype = wipetype;
curwipeframe = 0;
#ifdef LEVELWIPES
if (WipeInLevel)
return;
#endif
// lastwipetic should either be 0 or the tic we last wiped
// on for fade-to-black
for (;;)
@ -368,19 +439,16 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_DoWipe(wipetype, wipeframe-1); // send in the wipe type and wipeframe because we need to cache the graphic
{
// send in the wipe type and wipe frame because we need to cache the graphic
if (wipestyle == WIPESTYLE_LEVEL)
HWR_DoTintedWipe(wipetype, wipeframe-1);
else
HWR_DoWipe(wipetype, wipeframe-1);
}
else
#endif
F_DoWipe(fmask);
// draw level title
if ((WipeStageTitle && st_overlay)
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
{
ST_runTitleCard();
ST_drawWipeTitleCard();
}
F_DoWipe(fmask);
I_OsPolling();
I_UpdateNoBlit();
@ -395,6 +463,47 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
}
WipeInAction = false;
WipeInLevel = false;
WipeStageTitle = false;
#endif
}
/** Run and display the fade with the level.
*/
void F_WipeTicker(void)
{
#ifndef NOWIPE
#ifndef LEVELWIPES
WipeInAction = false;
#else
fademask_t *fmask;
// Wait, what?
if (!WipeInAction)
return;
if (rendermode == render_soft)
wipe_scr_start = wipe_scr_end = screens[0];
// get fademask first so we can tell if it exists or not
fmask = F_GetFadeMask(curwipetype, curwipeframe++);
if (!fmask)
{
// stop
WipeInAction = false;
WipeInLevel = false;
WipeStageTitle = false;
return;
}
#ifdef HWRENDER
// send in the wipe type and wipe frame because we need to cache the graphic
if (rendermode == render_opengl)
HWR_DoLevelWipe(curwipetype, curwipeframe-1, wipecolorfill); // also send the wipe color
else
#endif
F_DoWipe(fmask);
#endif
WipeStageTitle = false;
#endif
}
@ -426,6 +535,8 @@ tic_t F_GetWipeLength(UINT8 wipetype)
#endif
}
/** Does the specified wipe exist?
*/
boolean F_WipeExists(UINT8 wipetype)
{
#ifdef NOWIPE

View File

@ -1728,6 +1728,9 @@ void G_StartTitleCard(void)
// start the title card
WipeStageTitle = (!titlemapinaction);
WipeInLevel = true;
wipestyleflags |= WSF_FADEIN;
wipestyleflags &= ~WSF_FADEOUT;
}
//

View File

@ -71,6 +71,7 @@ EXPORT void HWRAPI(FlushScreenTextures) (void);
EXPORT void HWRAPI(StartScreenWipe) (void);
EXPORT void HWRAPI(EndScreenWipe) (void);
EXPORT void HWRAPI(DoScreenWipe) (void);
EXPORT void HWRAPI(DoScreenWipeLevel) (void);
EXPORT void HWRAPI(DrawIntermissionBG) (void);
EXPORT void HWRAPI(MakeScreenTexture) (void);
EXPORT void HWRAPI(MakeScreenFinalTexture) (void);
@ -112,6 +113,7 @@ struct hwdriver_s
StartScreenWipe pfnStartScreenWipe;
EndScreenWipe pfnEndScreenWipe;
DoScreenWipe pfnDoScreenWipe;
DoScreenWipeLevel pfnDoScreenWipeLevel;
DrawIntermissionBG pfnDrawIntermissionBG;
MakeScreenTexture pfnMakeScreenTexture;
MakeScreenFinalTexture pfnMakeScreenFinalTexture;

View File

@ -40,6 +40,7 @@
#include "../st_stuff.h"
#include "../i_system.h"
#include "../m_cheat.h"
#include "../f_finale.h"
#ifdef ESLOPE
#include "../p_slopes.h"
#endif
@ -111,7 +112,6 @@ static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0,
static consvar_t cv_gralpha = {"gr_alpha", "160", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_grbeta = {"gr_beta", "0", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
static float HWRWipeCounter = 1.0f;
consvar_t cv_grrounddown = {"gr_rounddown", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grfov = {"gr_fov", "90", CV_FLOAT|CV_CALL, grfov_cons_t, CV_grFov_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grfogdensity = {"gr_fogdensity", "150", CV_CALL|CV_NOINIT, CV_Unsigned,
@ -7025,7 +7025,6 @@ void HWR_StartScreenWipe(void)
void HWR_EndScreenWipe(void)
{
HWRWipeCounter = 0.0f;
//CONS_Debug(DBG_RENDER, "In HWR_EndScreenWipe()\n");
HWD.pfnEndScreenWipe();
}
@ -7035,38 +7034,75 @@ void HWR_DrawIntermissionBG(void)
HWD.pfnDrawIntermissionBG();
}
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
//
// hwr mode wipes
//
static lumpnum_t wipelumpnum;
// puts wipe lumpname in wipename[9]
static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum)
{
static char lumpname[9] = "FADEmmss";
lumpnum_t lumpnum;
size_t lsize;
if (wipenum > 99 || scrnnum > 99) // not a valid wipe number
return; // shouldn't end up here really, the loop should've stopped running beforehand
// not a valid wipe number
if (wipenum > 99 || scrnnum > 99)
return false; // shouldn't end up here really, the loop should've stopped running beforehand
// puts the numbers into the lumpname
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum);
lumpnum = W_CheckNumForName(lumpname);
// puts the numbers into the wipename
lumpname[4] = '0'+(wipenum/10);
lumpname[5] = '0'+(wipenum%10);
lumpname[6] = '0'+(scrnnum/10);
lumpname[7] = '0'+(scrnnum%10);
wipelumpnum = W_CheckNumForName(lumpname);
if (lumpnum == LUMPERROR) // again, shouldn't be here really
return;
lsize = W_LumpLength(lumpnum);
// again, shouldn't be here really
if (wipelumpnum == LUMPERROR)
return false;
lsize = W_LumpLength(wipelumpnum);
if (!(lsize == 256000 || lsize == 64000 || lsize == 16000 || lsize == 4000))
{
CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", lumpname);
return; // again, shouldn't get here if it is a bad size
return false; // again, shouldn't get here if it is a bad size
}
HWR_GetFadeMask(lumpnum);
return true;
}
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
{
if (!HWR_WipeCheck(wipenum, scrnnum))
return;
HWR_GetFadeMask(wipelumpnum);
HWD.pfnDoScreenWipe();
}
HWRWipeCounter += 0.05f; // increase opacity of end screen
void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum)
{
// It does the same thing
HWR_DoWipe(wipenum, scrnnum);
}
if (HWRWipeCounter > 1.0f)
HWRWipeCounter = 1.0f;
void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 colfill)
{
#ifndef LEVELWIPES
(void)wipenum;
(void)scrnnum;
(void)colfill;
#else
if (!HWR_WipeCheck(wipenum, scrnnum))
return;
HWR_EndScreenWipe();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, colfill);
HWR_StartScreenWipe();
HWR_GetFadeMask(wipelumpnum);
HWD.pfnDoScreenWipeLevel();
F_WipeStageTitle();
#endif
}
void HWR_MakeScreenFinalTexture(void)

View File

@ -66,6 +66,8 @@ void HWR_StartScreenWipe(void);
void HWR_EndScreenWipe(void);
void HWR_DrawIntermissionBG(void);
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum);
void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill);
void HWR_MakeScreenFinalTexture(void);
void HWR_DrawScreenFinalTexture(int width, int height);

View File

@ -2587,6 +2587,10 @@ EXPORT void HWRAPI(DoScreenWipe)(void)
tex_downloaded = endScreenWipe;
}
EXPORT void HWRAPI(DoScreenWipeLevel)(void)
{
DoScreenWipe();
}
// Create a texture from the screen.
EXPORT void HWRAPI(MakeScreenTexture) (void)

View File

@ -3364,13 +3364,17 @@ boolean M_Responder(event_t *ev)
//
void M_Drawer(void)
{
boolean wipe = WipeInAction;
if (WipeInLevel)
wipe = false;
if (currentMenu == &MessageDef)
menuactive = true;
if (menuactive)
{
// now that's more readable with a faded background (yeah like Quake...)
if (!WipeInAction && (curfadevalue || (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK)))
if (!wipe && (curfadevalue || (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK)))
V_DrawFadeScreen(0xFF00, (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) ? 16 : curfadevalue);
if (currentMenu->drawroutine)

View File

@ -2704,6 +2704,7 @@ boolean P_SetupLevel(boolean skipprecip)
// Cancel all d_main.c fadeouts (keep fade in though).
wipegamestate = FORCEWIPEOFF;
wipestyleflags = 0;
// Special stage fade to white
// This is handled BEFORE sounds are stopped.
@ -2724,11 +2725,22 @@ boolean P_SetupLevel(boolean skipprecip)
S_FadeOutStopMusic(MUSICRATE/4); //FixedMul(FixedDiv(F_GetWipeLength(wipedefs[wipe_speclevel_towhite])*NEWTICRATERATIO, NEWTICRATE), MUSICRATE)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
wipestyleflags |= WSF_FADEOUT|WSF_TOWHITE;
#ifdef HWRENDER
// uh..........
if (rendermode == render_opengl)
F_WipeColorFill(0);
#endif
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
I_OsPolling();
I_FinishUpdate(); // page flip or blit buffer
if (moviemode)
M_SaveFrame();
nowtime = lastwipetic;
// Hold on white for extra effect.
@ -2762,7 +2774,13 @@ boolean P_SetupLevel(boolean skipprecip)
if (rendermode != render_none && !ranspecialwipe)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
wipestyleflags |= WSF_FADEOUT;
#ifdef HWRENDER
// uh..........
if (rendermode == render_opengl)
F_WipeColorFill(31);
#endif
F_WipeEndScreen();
// for titlemap: run a specific wipe if specified
@ -3177,7 +3195,7 @@ boolean P_SetupLevel(boolean skipprecip)
// Remove the loading shit from the screen
if (rendermode != render_none && !titlemapinaction)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeColorFill(levelfadecol);
if (precache || dedicated)
R_PrecacheLevel();

View File

@ -24,6 +24,7 @@
#include "z_zone.h"
#include "p_setup.h" // levelflats
#include "v_video.h" // pMasterPalette
#include "f_finale.h" // wipes
#include "byteptr.h"
#include "dehacked.h"
@ -113,6 +114,7 @@ INT32 *texturetranslation;
sprcache_t *spritecachedinfo;
lighttable_t *colormaps;
lighttable_t *fadecolormap;
// for debugging/info purposes
size_t flatmemory, spritememory, texturememory;
@ -1455,18 +1457,111 @@ static void R_InitSpriteLumps(void)
Z_Malloc(max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo);
}
//
// R_CreateFadeColormaps
//
static void R_CreateFadeColormaps(void)
{
UINT8 px, fade;
RGBA_t rgba;
INT32 r, g, b;
size_t len, i;
len = (256 * FADECOLORMAPROWS);
fadecolormap = Z_MallocAlign(len*2, PU_STATIC, NULL, 8);
for (i = 0; i < len*2; i++)
fadecolormap[i] = (i%256);
// Load in the light tables, now 64k aligned for smokie...
{
lumpnum_t lump = W_CheckNumForName("FADECMAP");
lumpnum_t wlump = W_CheckNumForName("FADEWMAP");
// to black
if (lump != LUMPERROR)
W_ReadLumpHeader(lump, fadecolormap, len, 0U);
// to white
if (wlump != LUMPERROR)
W_ReadLumpHeader(wlump, fadecolormap+len, len, 0U);
// missing "to white" colormap lump
if (lump != LUMPERROR && wlump == LUMPERROR)
goto makewhite;
// missing "to black" colormap lump
else if (lump == LUMPERROR && wlump != LUMPERROR)
goto makeblack;
// both lumps found
else if (lump != LUMPERROR && wlump != LUMPERROR)
return;
}
#define GETCOLOR \
px = colormaps[i%256]; \
fade = (i/256) * (256 / FADECOLORMAPROWS); \
rgba = V_GetColor(px);
// to black
makeblack:
for (i = 0; i < len; i++)
{
// find pixel and fade amount
GETCOLOR;
// subtractive color blending
r = rgba.s.red - FADEREDFACTOR*fade/10;
g = rgba.s.green - FADEGREENFACTOR*fade/10;
b = rgba.s.blue - FADEBLUEFACTOR*fade/10;
// clamp values
if (r < 0) r = 0;
if (g < 0) g = 0;
if (b < 0) b = 0;
// find nearest color in palette
fadecolormap[i] = NearestColor(r,g,b);
}
// to white
makewhite:
for (i = len; i < len*2; i++)
{
// find pixel and fade amount
GETCOLOR;
// additive color blending
r = rgba.s.red + FADEREDFACTOR*fade/10;
g = rgba.s.green + FADEGREENFACTOR*fade/10;
b = rgba.s.blue + FADEBLUEFACTOR*fade/10;
// clamp values
if (r > 255) r = 255;
if (g > 255) g = 255;
if (b > 255) b = 255;
// find nearest color in palette
fadecolormap[i] = NearestColor(r,g,b);
}
#undef GETCOLOR
}
//
// R_InitColormaps
//
static void R_InitColormaps(void)
{
size_t len;
lumpnum_t lump;
// Load in the light tables
lump = W_GetNumForName("COLORMAP");
colormaps = Z_MallocAlign(W_LumpLength (lump), PU_STATIC, NULL, 8);
len = W_LumpLength(lump);
colormaps = Z_MallocAlign(len, PU_STATIC, NULL, 8);
W_ReadLump(lump, colormaps);
// Make colormap for fades
R_CreateFadeColormaps();
// Init Boom colormaps.
R_ClearColormaps();
#ifdef EXTRACOLORMAPLUMPS
@ -1495,6 +1590,9 @@ void R_ReInitColormaps(UINT16 num)
}
W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U);
if (fadecolormap)
Z_Free(fadecolormap);
R_CreateFadeColormaps();
// Init Boom colormaps.
R_ClearColormaps();

View File

@ -38,6 +38,7 @@ typedef struct
extern sprcache_t *spritecachedinfo;
extern lighttable_t *colormaps;
extern lighttable_t *fadecolormap;
// Boom colormaps.
extern extracolormap_t *extra_colormaps;

View File

@ -97,6 +97,7 @@ void *hwSym(const char *funcName,void *handle)
GETFUNC(StartScreenWipe);
GETFUNC(EndScreenWipe);
GETFUNC(DoScreenWipe);
GETFUNC(DoScreenWipeLevel);
GETFUNC(DrawIntermissionBG);
GETFUNC(MakeScreenTexture);
GETFUNC(MakeScreenFinalTexture);

View File

@ -1666,6 +1666,7 @@ void I_StartupGraphics(void)
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
HWD.pfnDoScreenWipeLevel= hwSym("DoScreenWipeLevel",NULL);
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);

View File

@ -1202,7 +1202,7 @@ void ST_startTitleCard(void)
// initialize HUD variables
lt_ticker = lt_exitticker = lt_lasttic = 0;
lt_endtime = 2*TICRATE;
lt_endtime = 2*TICRATE + (10*NEWTICRATERATIO);
lt_scroll = BASEVIDWIDTH * FRACUNIT;
lt_zigzag = -((lt_patches[1])->width * FRACUNIT);
lt_mom = 0;
@ -1294,8 +1294,10 @@ void ST_drawTitleCard(void)
return;
#endif
#ifndef LEVELWIPES
if ((lt_ticker-lt_lasttic) > 1)
lt_ticker = lt_lasttic+1;
#endif
ST_cacheLevelTitle();
actpat = lt_patches[0];
@ -1349,7 +1351,9 @@ luahook:
void ST_preLevelTitleCardDrawer(tic_t ticker, boolean update)
{
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
#ifndef LEVELWIPES
if (ticker < PRELEVELTIME-1)
#endif
ST_drawWipeTitleCard();
I_OsPolling();

View File

@ -121,6 +121,7 @@ static loadfunc_t hwdFuncTable[] = {
{"StartScreenWipe@0", &hwdriver.pfnStartScreenWipe},
{"EndScreenWipe@0", &hwdriver.pfnEndScreenWipe},
{"DoScreenWipe@4", &hwdriver.pfnDoScreenWipe},
{"DoScreenWipeLevel@0", &hwdriver.pfnDoScreenWipeLevel},
{"DrawIntermissionBG@0",&hwdriver.pfnDrawIntermissionBG},
{"MakeScreenTexture@0", &hwdriver.pfnMakeScreenTexture},
{"MakeScreenFinalTexture@0", &hwdriver.pfnMakeScreenFinalTexture},
@ -152,6 +153,7 @@ static loadfunc_t hwdFuncTable[] = {
{"StartScreenWipe", &hwdriver.pfnStartScreenWipe},
{"EndScreenWipe", &hwdriver.pfnEndScreenWipe},
{"DoScreenWipe", &hwdriver.pfnDoScreenWipe},
{"DoScreenWipeLevel", &hwdriver.pfnDoScreenWipeLevel},
{"DrawIntermissionBG", &hwdriver.pfnDrawIntermissionBG},
{"MakeScreenTexture", &hwdriver.pfnMakeScreenTexture},
{"MakeScreenFinalTexture", &hwdriver.pfnMakeScreenFinalTexture},