mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-27 13:31:43 +00:00
Genesis wipe stuff
Very unoptimized, lags in anything besides 320x200
This commit is contained in:
parent
f7f27199a6
commit
94081f469e
3 changed files with 89 additions and 5 deletions
90
src/f_wipe.c
90
src/f_wipe.c
|
|
@ -12,12 +12,19 @@
|
|||
/// \file f_wipe.c
|
||||
/// \brief SRB2 2.1 custom fade mask "wipe" behavior.
|
||||
|
||||
#define GENESIS_WIPE // Sal: experimental Genesis-style colorful wipes
|
||||
|
||||
#include "f_finale.h"
|
||||
#include "i_video.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#ifdef GENESIS_WIPE
|
||||
#include "r_data.h" // NearestColor
|
||||
#else
|
||||
#include "r_draw.h" // transtable
|
||||
#include "p_pspr.h" // tr_transxxx
|
||||
#endif
|
||||
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
|
|
@ -89,6 +96,7 @@ INT32 lastwipetic = 0;
|
|||
static UINT8 *wipe_scr_start; //screen 3
|
||||
static UINT8 *wipe_scr_end; //screen 4
|
||||
static UINT8 *wipe_scr; //screen 0 (main drawing)
|
||||
static UINT8 pallen;
|
||||
static fixed_t paldiv;
|
||||
|
||||
/** Create fademask_t from lump
|
||||
|
|
@ -211,7 +219,12 @@ static void F_DoWipe(fademask_t *fademask)
|
|||
const UINT8 *e_base = e;
|
||||
|
||||
// mask data, end
|
||||
UINT8 *transtbl;
|
||||
#ifdef GENESIS_WIPE
|
||||
UINT8 i;
|
||||
RGBA_t wcolor, *ecolor;
|
||||
#else
|
||||
UINT8 *transtbl;
|
||||
#endif
|
||||
const UINT8 *mask = fademask->mask;
|
||||
const UINT8 *maskend = mask + fademask->size;
|
||||
|
||||
|
|
@ -259,7 +272,7 @@ static void F_DoWipe(fademask_t *fademask)
|
|||
relativepos += vid.width;
|
||||
}
|
||||
}
|
||||
else if (*mask == 10)
|
||||
else if (*mask == pallen)
|
||||
{
|
||||
// shortcut - memcpy target to work
|
||||
while (draw_linestogo--)
|
||||
|
|
@ -270,6 +283,70 @@ static void F_DoWipe(fademask_t *fademask)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef GENESIS_WIPE
|
||||
// DRAWING LOOP
|
||||
while (draw_linestogo--)
|
||||
{
|
||||
w = w_base + relativepos;
|
||||
s = s_base + relativepos;
|
||||
e = e_base + relativepos;
|
||||
draw_rowstogo = draw_rowend - draw_rowstart;
|
||||
|
||||
ecolor = &pLocalPalette[*e];
|
||||
|
||||
while (draw_rowstogo--)
|
||||
{
|
||||
memcpy(&wcolor, &pLocalPalette[*s++], sizeof(RGBA_t));
|
||||
|
||||
// GENESIS WIPE:
|
||||
// Change red until it reaches the intended value
|
||||
// Then green, then blue.
|
||||
|
||||
for (i = 0; i < *mask; i++)
|
||||
{
|
||||
if (abs(wcolor.s.red - ecolor->s.red) > 34)
|
||||
{
|
||||
if (wcolor.s.red < ecolor->s.red)
|
||||
wcolor.s.red += 34;
|
||||
else
|
||||
wcolor.s.red -= 34;
|
||||
}
|
||||
else
|
||||
{
|
||||
wcolor.s.red = ecolor->s.red;
|
||||
|
||||
if (abs(wcolor.s.green - ecolor->s.green) > 34)
|
||||
{
|
||||
if (wcolor.s.green < ecolor->s.green)
|
||||
wcolor.s.green += 34;
|
||||
else
|
||||
wcolor.s.green -= 34;
|
||||
}
|
||||
else
|
||||
{
|
||||
wcolor.s.green = ecolor->s.green;
|
||||
|
||||
if (abs(wcolor.s.blue - ecolor->s.blue) > 34)
|
||||
{
|
||||
if (wcolor.s.blue < ecolor->s.blue)
|
||||
wcolor.s.blue += 34;
|
||||
else
|
||||
wcolor.s.blue -= 34;
|
||||
|
||||
}
|
||||
else
|
||||
wcolor.s.blue = ecolor->s.blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*w++ = NearestColor(wcolor.s.red, wcolor.s.green, wcolor.s.blue);
|
||||
}
|
||||
|
||||
relativepos += vid.width;
|
||||
}
|
||||
// END DRAWING LOOP
|
||||
#else
|
||||
// pointer to transtable that this mask would use
|
||||
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
||||
|
||||
|
|
@ -287,6 +364,7 @@ static void F_DoWipe(fademask_t *fademask)
|
|||
relativepos += vid.width;
|
||||
}
|
||||
// END DRAWING LOOP
|
||||
#endif
|
||||
}
|
||||
|
||||
if (++maskx >= fademask->width)
|
||||
|
|
@ -347,7 +425,13 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
|||
UINT8 wipeframe = 0;
|
||||
fademask_t *fmask;
|
||||
|
||||
paldiv = FixedDiv(257<<FRACBITS, 11<<FRACBITS);
|
||||
#ifndef GENESIS_WIPE
|
||||
pallen = 21; // 21 steps
|
||||
#else
|
||||
pallen = 10; // 10 steps
|
||||
#endif
|
||||
|
||||
paldiv = FixedDiv(257<<FRACBITS, (pallen+1)<<FRACBITS);
|
||||
|
||||
// Init the wipe
|
||||
WipeInAction = true;
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,6 @@ void R_ClearColormaps(void)
|
|||
//
|
||||
static double deltas[256][3], map[256][3];
|
||||
|
||||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||
static int RoundUp(double number);
|
||||
|
||||
#ifdef HASINVERT
|
||||
|
|
@ -1403,7 +1402,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
|||
|
||||
// Thanks to quake2 source!
|
||||
// utils3/qdata/images.c
|
||||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
||||
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
||||
{
|
||||
int dr, dg, db;
|
||||
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap);
|
|||
void R_ClearColormaps(void);
|
||||
INT32 R_ColormapNumForName(char *name);
|
||||
INT32 R_CreateColormap(char *p1, char *p2, char *p3);
|
||||
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||
#ifdef HASINVERT
|
||||
void R_MakeInvertmap(void);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue