- implemented RGB256k for screen crossfade and burn

This commit is contained in:
Rachael Alexanderson 2016-12-19 04:27:56 -05:00
parent 2d0960044c
commit e2be28f925
2 changed files with 18 additions and 11 deletions

View file

@ -28,6 +28,7 @@
#include "f_wipe.h" #include "f_wipe.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "templates.h" #include "templates.h"
#include "v_palette.h"
// //
// SCREEN WIPE PACKAGE // SCREEN WIPE PACKAGE
@ -299,12 +300,15 @@ bool wipe_doBurn (int ticks)
else else
{ {
int bglevel = 64-fglevel; int bglevel = 64-fglevel;
DWORD *fg2rgb = Col2RGB8[fglevel];
DWORD *bg2rgb = Col2RGB8[bglevel]; const PalEntry* pal = GPalette.BaseColors;
DWORD fg = fg2rgb[fromnew[x]];
DWORD bg = bg2rgb[fromold[x]]; DWORD fg = fromnew[x];
fg = (fg+bg) | 0x1f07c1f; DWORD bg = fromold[x];
to[x] = RGB32k.All[fg & (fg>>15)]; int r = MIN((pal[fg].r * fglevel + pal[bg].r * bglevel) >> 8, 63);
int g = MIN((pal[fg].g * fglevel + pal[bg].g * bglevel) >> 8, 63);
int b = MIN((pal[fg].b * fglevel + pal[bg].b * bglevel) >> 8, 63);
to[x] = RGB256k.RGB[r][g][b];
done = false; done = false;
} }
} }
@ -347,15 +351,18 @@ bool wipe_doFade (int ticks)
BYTE *fromnew = (BYTE *)wipe_scr_end; BYTE *fromnew = (BYTE *)wipe_scr_end;
BYTE *fromold = (BYTE *)wipe_scr_start; BYTE *fromold = (BYTE *)wipe_scr_start;
BYTE *to = screen->GetBuffer(); BYTE *to = screen->GetBuffer();
const PalEntry *pal = GPalette.BaseColors;
for (y = 0; y < SCREENHEIGHT; y++) for (y = 0; y < SCREENHEIGHT; y++)
{ {
for (x = 0; x < SCREENWIDTH; x++) for (x = 0; x < SCREENWIDTH; x++)
{ {
DWORD fg = fg2rgb[fromnew[x]]; DWORD fg = fromnew[x];
DWORD bg = bg2rgb[fromold[x]]; DWORD bg = fromold[x];
fg = (fg+bg) | 0x1f07c1f; int r = MIN((pal[fg].r * (64-bglevel) + pal[bg].r * bglevel) >> 8, 63);
to[x] = RGB32k.All[fg & (fg>>15)]; int g = MIN((pal[fg].g * (64-bglevel) + pal[bg].g * bglevel) >> 8, 63);
int b = MIN((pal[fg].b * (64-bglevel) + pal[bg].b * bglevel) >> 8, 63);
to[x] = RGB256k.RGB[r][g][b];
} }
fromnew += SCREENWIDTH; fromnew += SCREENWIDTH;
fromold += SCREENWIDTH; fromold += SCREENWIDTH;

View file

@ -450,7 +450,7 @@ namespace swrenderer
uint32_t g = GPART(color); uint32_t g = GPART(color);
uint32_t b = BPART(color); uint32_t b = BPART(color);
// dc_color is used by the rt_* routines. It is indexed into dc_srcblend. // dc_color is used by the rt_* routines. It is indexed into dc_srcblend.
dc_color = RGB32k.RGB[r >> 3][g >> 3][b >> 3]; dc_color = RGB256k.RGB[r >> 2][g >> 2][b >> 2];
if (style.Flags & STYLEF_InvertSource) if (style.Flags & STYLEF_InvertSource)
{ {
r = 255 - r; r = 255 - r;