mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 23:41:56 +00:00
- Reimplemented rgb555 into burn/crossfade in f_wipe.cpp.
This commit is contained in:
parent
785b58f57a
commit
9ece249dbb
1 changed files with 101 additions and 40 deletions
141
src/f_wipe.cpp
141
src/f_wipe.cpp
|
@ -30,6 +30,8 @@
|
|||
#include "templates.h"
|
||||
#include "v_palette.h"
|
||||
|
||||
EXTERN_CVAR(Bool, r_blendmethod)
|
||||
|
||||
//
|
||||
// SCREEN WIPE PACKAGE
|
||||
//
|
||||
|
@ -281,42 +283,80 @@ bool wipe_doBurn (int ticks)
|
|||
fromold = (BYTE *)wipe_scr_start;
|
||||
fromnew = (BYTE *)wipe_scr_end;
|
||||
|
||||
for (y = 0, firey = 0; y < SCREENHEIGHT; y++, firey += ystep)
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
for (x = 0, firex = 0; x < SCREENWIDTH; x++, firex += xstep)
|
||||
for (y = 0, firey = 0; y < SCREENHEIGHT; y++, firey += ystep)
|
||||
{
|
||||
int fglevel;
|
||||
|
||||
fglevel = burnarray[(firex>>SHIFT)+(firey>>SHIFT)*FIREWIDTH] / 2;
|
||||
if (fglevel >= 63)
|
||||
for (x = 0, firex = 0; x < SCREENWIDTH; x++, firex += xstep)
|
||||
{
|
||||
to[x] = fromnew[x];
|
||||
}
|
||||
else if (fglevel == 0)
|
||||
{
|
||||
to[x] = fromold[x];
|
||||
done = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bglevel = 64-fglevel;
|
||||
int fglevel;
|
||||
|
||||
const PalEntry* pal = GPalette.BaseColors;
|
||||
|
||||
DWORD fg = fromnew[x];
|
||||
DWORD bg = fromold[x];
|
||||
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;
|
||||
fglevel = burnarray[(firex>>SHIFT)+(firey>>SHIFT)*FIREWIDTH] / 2;
|
||||
if (fglevel >= 63)
|
||||
{
|
||||
to[x] = fromnew[x];
|
||||
}
|
||||
else if (fglevel == 0)
|
||||
{
|
||||
to[x] = fromold[x];
|
||||
done = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bglevel = 64-fglevel;
|
||||
DWORD *fg2rgb = Col2RGB8[fglevel];
|
||||
DWORD *bg2rgb = Col2RGB8[bglevel];
|
||||
DWORD fg = fg2rgb[fromnew[x]];
|
||||
DWORD bg = bg2rgb[fromold[x]];
|
||||
fg = (fg+bg) | 0x1f07c1f;
|
||||
to[x] = RGB32k.All[fg & (fg>>15)];
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
fromold += SCREENWIDTH;
|
||||
fromnew += SCREENWIDTH;
|
||||
to += SCREENPITCH;
|
||||
}
|
||||
fromold += SCREENWIDTH;
|
||||
fromnew += SCREENWIDTH;
|
||||
to += SCREENPITCH;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0, firey = 0; y < SCREENHEIGHT; y++, firey += ystep)
|
||||
{
|
||||
for (x = 0, firex = 0; x < SCREENWIDTH; x++, firex += xstep)
|
||||
{
|
||||
int fglevel;
|
||||
|
||||
fglevel = burnarray[(firex>>SHIFT)+(firey>>SHIFT)*FIREWIDTH] / 2;
|
||||
if (fglevel >= 63)
|
||||
{
|
||||
to[x] = fromnew[x];
|
||||
}
|
||||
else if (fglevel == 0)
|
||||
{
|
||||
to[x] = fromold[x];
|
||||
done = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bglevel = 64-fglevel;
|
||||
|
||||
const PalEntry* pal = GPalette.BaseColors;
|
||||
|
||||
DWORD fg = fromnew[x];
|
||||
DWORD bg = fromold[x];
|
||||
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;
|
||||
}
|
||||
}
|
||||
fromold += SCREENWIDTH;
|
||||
fromnew += SCREENWIDTH;
|
||||
to += SCREENPITCH;
|
||||
}
|
||||
}
|
||||
return done || (burntime > 40);
|
||||
}
|
||||
|
||||
|
@ -346,25 +386,46 @@ bool wipe_doFade (int ticks)
|
|||
{
|
||||
int x, y;
|
||||
int bglevel = 64 - fade;
|
||||
DWORD *fg2rgb = Col2RGB8[fade];
|
||||
DWORD *bg2rgb = Col2RGB8[bglevel];
|
||||
BYTE *fromnew = (BYTE *)wipe_scr_end;
|
||||
BYTE *fromold = (BYTE *)wipe_scr_start;
|
||||
BYTE *to = screen->GetBuffer();
|
||||
const PalEntry *pal = GPalette.BaseColors;
|
||||
|
||||
for (y = 0; y < SCREENHEIGHT; y++)
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
for (x = 0; x < SCREENWIDTH; x++)
|
||||
for (y = 0; y < SCREENHEIGHT; y++)
|
||||
{
|
||||
DWORD fg = fromnew[x];
|
||||
DWORD bg = fromold[x];
|
||||
int r = MIN((pal[fg].r * (64-bglevel) + pal[bg].r * bglevel) >> 8, 63);
|
||||
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];
|
||||
for (x = 0; x < SCREENWIDTH; x++)
|
||||
{
|
||||
DWORD fg = fg2rgb[fromnew[x]];
|
||||
DWORD bg = bg2rgb[fromold[x]];
|
||||
fg = (fg+bg) | 0x1f07c1f;
|
||||
to[x] = RGB32k.All[fg & (fg>>15)];
|
||||
}
|
||||
fromnew += SCREENWIDTH;
|
||||
fromold += SCREENWIDTH;
|
||||
to += SCREENPITCH;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < SCREENHEIGHT; y++)
|
||||
{
|
||||
for (x = 0; x < SCREENWIDTH; x++)
|
||||
{
|
||||
DWORD fg = fromnew[x];
|
||||
DWORD bg = fromold[x];
|
||||
int r = MIN((pal[fg].r * (64-bglevel) + pal[bg].r * bglevel) >> 8, 63);
|
||||
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;
|
||||
fromold += SCREENWIDTH;
|
||||
to += SCREENPITCH;
|
||||
}
|
||||
fromnew += SCREENWIDTH;
|
||||
fromold += SCREENWIDTH;
|
||||
to += SCREENPITCH;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue