Skip to content
Snippets Groups Projects
Commit eb1b6eed authored by Lactozilla's avatar Lactozilla :speech_balloon:
Browse files

some adjusts

parent f0788598
No related branches found
No related tags found
No related merge requests found
...@@ -126,6 +126,13 @@ typedef enum ...@@ -126,6 +126,13 @@ typedef enum
} wipestyleflags_t; } wipestyleflags_t;
extern wipestyleflags_t wipestyleflags; extern wipestyleflags_t wipestyleflags;
#define FADECOLORMAPDIV 8
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
#define FADEREDFACTOR 20
#define FADEGREENFACTOR 20
#define FADEBLUEFACTOR 10
void F_WipeStartScreen(void); void F_WipeStartScreen(void);
void F_WipeEndScreen(void); void F_WipeEndScreen(void);
void F_RunWipe(UINT8 wipetype, boolean drawMenu); void F_RunWipe(UINT8 wipetype, boolean drawMenu);
......
...@@ -103,7 +103,6 @@ static fixed_t paldiv = 0; ...@@ -103,7 +103,6 @@ static fixed_t paldiv = 0;
static UINT8 curwipetype; static UINT8 curwipetype;
static UINT8 curwipeframe; static UINT8 curwipeframe;
static UINT8 maxwipeframe;
/** Create fademask_t from lump /** Create fademask_t from lump
* *
...@@ -164,7 +163,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { ...@@ -164,7 +163,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
// Determine pixel to use from fademask // Determine pixel to use from fademask
pcolor = &pMasterPalette[*lump++]; pcolor = &pMasterPalette[*lump++];
if (wipestyle == WIPESTYLE_LEVEL) if (wipestyle == WIPESTYLE_LEVEL)
*mask++ = pcolor->s.red/8; // 0-31 range *mask++ = pcolor->s.red / FADECOLORMAPDIV;
else else
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS; *mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
} }
...@@ -282,7 +281,7 @@ static void F_DoWipe(fademask_t *fademask) ...@@ -282,7 +281,7 @@ static void F_DoWipe(fademask_t *fademask)
relativepos += vid.width; relativepos += vid.width;
} }
} }
else if ((*mask >= maxwipeframe) && (wipestyle == WIPESTYLE_NORMAL)) else if ((*mask >= 10) && (wipestyle == WIPESTYLE_NORMAL))
{ {
// shortcut - memcpy target to work // shortcut - memcpy target to work
while (draw_linestogo--) while (draw_linestogo--)
...@@ -299,11 +298,11 @@ static void F_DoWipe(fademask_t *fademask) ...@@ -299,11 +298,11 @@ static void F_DoWipe(fademask_t *fademask)
UINT8 *fade = fadecolormap; UINT8 *fade = fadecolormap;
if (wipestyleflags & WSF_TOWHITE) if (wipestyleflags & WSF_TOWHITE)
fade = fadecolormap + (32 * 256); fade = fadecolormap + (FADECOLORMAPROWS * 256);
nmask = *mask; nmask = *mask;
if (wipestyleflags & WSF_FADEIN) if (wipestyleflags & WSF_FADEIN)
nmask = 31 - nmask; nmask = (FADECOLORMAPROWS-1) - nmask;
transtbl = fade + (nmask * 256); transtbl = fade + (nmask * 256);
} }
...@@ -406,15 +405,9 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) ...@@ -406,15 +405,9 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
// don't know where else to put this. // don't know where else to put this.
// this any good? // this any good?
if (gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN) if (gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN)
{
wipestyle = WIPESTYLE_LEVEL; wipestyle = WIPESTYLE_LEVEL;
maxwipeframe = 31;
}
else else
{
wipestyle = WIPESTYLE_NORMAL; wipestyle = WIPESTYLE_NORMAL;
maxwipeframe = 10;
}
curwipetype = wipetype; curwipetype = wipetype;
curwipeframe = 0; curwipeframe = 0;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "z_zone.h" #include "z_zone.h"
#include "p_setup.h" // levelflats #include "p_setup.h" // levelflats
#include "v_video.h" // pMasterPalette #include "v_video.h" // pMasterPalette
#include "f_finale.h" // wipes
#include "dehacked.h" #include "dehacked.h"
#ifdef _WIN32 #ifdef _WIN32
...@@ -112,7 +113,7 @@ INT32 *texturetranslation; ...@@ -112,7 +113,7 @@ INT32 *texturetranslation;
sprcache_t *spritecachedinfo; sprcache_t *spritecachedinfo;
lighttable_t *colormaps; lighttable_t *colormaps;
lighttable_t *fadecolormap = NULL; lighttable_t *fadecolormap;
// for debugging/info purposes // for debugging/info purposes
static size_t flatmemory, spritememory, texturememory; static size_t flatmemory, spritememory, texturememory;
...@@ -1298,30 +1299,58 @@ static void R_InitSpriteLumps(void) ...@@ -1298,30 +1299,58 @@ static void R_InitSpriteLumps(void)
// //
// R_CreateFadeColormaps // R_CreateFadeColormaps
// //
static void R_CreateFadeColormaps(size_t len)
static void R_CreateFadeColormaps()
{ {
UINT8 px, fade; UINT8 px, fade;
RGBA_t rgba; RGBA_t rgba;
INT32 r, g, b; INT32 r, g, b;
size_t i; size_t len, i;
len = (256 * FADECOLORMAPROWS);
fadecolormap = Z_MallocAlign(len*2, PU_STATIC, NULL, 8); 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 \ #define GETCOLOR \
px = colormaps[i%256]; \ px = colormaps[i%256]; \
fade = (i/256) * 8; \ fade = (i/256) * (256 / FADECOLORMAPROWS); \
rgba = V_GetColor(px); rgba = V_GetColor(px);
// to black // to black
makeblack:
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
// find pixel and fade amount // find pixel and fade amount
GETCOLOR; GETCOLOR;
// subtractive color blending // subtractive color blending
r = rgba.s.red - fade*3; r = rgba.s.red - FADEREDFACTOR*fade/10;
g = rgba.s.green - fade*2; g = rgba.s.green - FADEGREENFACTOR*fade/10;
b = rgba.s.blue - fade; b = rgba.s.blue - FADEBLUEFACTOR*fade/10;
// clamp values // clamp values
if (r < 0) r = 0; if (r < 0) r = 0;
...@@ -1333,15 +1362,16 @@ static void R_CreateFadeColormaps(size_t len) ...@@ -1333,15 +1362,16 @@ static void R_CreateFadeColormaps(size_t len)
} }
// to white // to white
makewhite:
for (i = len; i < len*2; i++) for (i = len; i < len*2; i++)
{ {
// find pixel and fade amount // find pixel and fade amount
GETCOLOR; GETCOLOR;
// additive color blending // additive color blending
r = rgba.s.red + fade*3; r = rgba.s.red + FADEREDFACTOR*fade/10;
g = rgba.s.green + fade*2; g = rgba.s.green + FADEGREENFACTOR*fade/10;
b = rgba.s.blue + fade; b = rgba.s.blue + FADEBLUEFACTOR*fade/10;
// clamp values // clamp values
if (r > 255) r = 255; if (r > 255) r = 255;
...@@ -1369,7 +1399,7 @@ static void R_InitColormaps(void) ...@@ -1369,7 +1399,7 @@ static void R_InitColormaps(void)
W_ReadLump(lump, colormaps); W_ReadLump(lump, colormaps);
// Make colormap for fades // Make colormap for fades
R_CreateFadeColormaps(len); R_CreateFadeColormaps();
// Init Boom colormaps. // Init Boom colormaps.
R_ClearColormaps(); R_ClearColormaps();
...@@ -1401,7 +1431,7 @@ void R_ReInitColormaps(UINT16 num) ...@@ -1401,7 +1431,7 @@ void R_ReInitColormaps(UINT16 num)
W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U); W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U);
if (fadecolormap) if (fadecolormap)
Z_Free(fadecolormap); Z_Free(fadecolormap);
R_CreateFadeColormaps(W_LumpLength(lump)); R_CreateFadeColormaps();
// Init Boom colormaps. // Init Boom colormaps.
R_ClearColormaps(); R_ClearColormaps();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment