Merge branch 'truecolor' of https://github.com/dpjudas/zdoom
# Conflicts: # src/v_video.cpp
This commit is contained in:
commit
32f758de41
60 changed files with 8510 additions and 1030 deletions
224
src/r_things.cpp
224
src/r_things.cpp
|
|
@ -58,6 +58,7 @@
|
|||
#include "r_plane.h"
|
||||
#include "r_segs.h"
|
||||
#include "r_3dfloors.h"
|
||||
#include "r_draw_rgba.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
|
@ -251,6 +252,7 @@ bool sprflipvert;
|
|||
|
||||
void R_DrawMaskedColumn (const BYTE *column, const FTexture::Span *span)
|
||||
{
|
||||
int pixelsize = r_swtruecolor ? 4 : 1;
|
||||
const fixed_t centeryfrac = FLOAT2FIXED(CenterY);
|
||||
const fixed_t texturemid = FLOAT2FIXED(dc_texturemid);
|
||||
while (span->Length != 0)
|
||||
|
|
@ -321,7 +323,7 @@ void R_DrawMaskedColumn (const BYTE *column, const FTexture::Span *span)
|
|||
}
|
||||
}
|
||||
dc_source = column + top;
|
||||
dc_dest = ylookup[dc_yl] + dc_x + dc_destorg;
|
||||
dc_dest = (ylookup[dc_yl] + dc_x) * pixelsize + dc_destorg;
|
||||
dc_count = dc_yh - dc_yl + 1;
|
||||
colfunc ();
|
||||
}
|
||||
|
|
@ -414,7 +416,7 @@ void R_DrawVisSprite (vissprite_t *vis)
|
|||
}
|
||||
|
||||
fixed_t centeryfrac = FLOAT2FIXED(CenterY);
|
||||
dc_colormap = vis->Style.colormap;
|
||||
R_SetColorMapLight(vis->Style.BaseColormap, 0, vis->Style.ColormapNum << FRACBITS);
|
||||
|
||||
mode = R_SetPatchStyle (vis->Style.RenderStyle, vis->Style.Alpha, vis->Translation, vis->FillColor);
|
||||
|
||||
|
|
@ -422,7 +424,7 @@ void R_DrawVisSprite (vissprite_t *vis)
|
|||
{ // For shaded sprites, R_SetPatchStyle sets a dc_colormap to an alpha table, but
|
||||
// it is the brightest one. We need to get back to the proper light level for
|
||||
// this sprite.
|
||||
dc_colormap += vis->ColormapNum << COLORMAPSHIFT;
|
||||
R_SetColorMapLight(dc_fcolormap, 0, vis->Style.ColormapNum << FRACBITS);
|
||||
}
|
||||
|
||||
if (mode != DontDraw)
|
||||
|
|
@ -476,7 +478,7 @@ void R_DrawVisSprite (vissprite_t *vis)
|
|||
|
||||
while (dc_x < stop4)
|
||||
{
|
||||
rt_initcols();
|
||||
rt_initcols(nullptr);
|
||||
for (int zz = 4; zz; --zz)
|
||||
{
|
||||
pixels = tex->GetColumn (frac >> FRACBITS, &spans);
|
||||
|
|
@ -544,11 +546,11 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
rw_lightstep = float((GlobVis / spr->wallc.sz2 - rw_lightleft) / (spr->wallc.sx2 - spr->wallc.sx1));
|
||||
rw_light = rw_lightleft + (x1 - spr->wallc.sx1) * rw_lightstep;
|
||||
if (fixedlightlev >= 0)
|
||||
dc_colormap = usecolormap->Maps + fixedlightlev;
|
||||
R_SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
dc_colormap = fixedcolormap;
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||
dc_colormap = usecolormap->Maps;
|
||||
R_SetColorMapLight(usecolormap, 0, 0);
|
||||
else
|
||||
calclighting = true;
|
||||
|
||||
|
|
@ -599,7 +601,7 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
dc_colormap = usecolormap->Maps + (GETPALOOKUP (rw_light, shade) << COLORMAPSHIFT);
|
||||
R_SetColorMapLight(usecolormap, rw_light, shade);
|
||||
}
|
||||
if (!R_ClipSpriteColumnWithPortals(spr))
|
||||
R_WallSpriteColumn(R_DrawMaskedColumn);
|
||||
|
|
@ -610,9 +612,9 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
dc_colormap = usecolormap->Maps + (GETPALOOKUP (rw_light, shade) << COLORMAPSHIFT);
|
||||
R_SetColorMapLight(usecolormap, rw_light, shade);
|
||||
}
|
||||
rt_initcols();
|
||||
rt_initcols(nullptr);
|
||||
for (int zz = 4; zz; --zz)
|
||||
{
|
||||
if (!R_ClipSpriteColumnWithPortals(spr))
|
||||
|
|
@ -626,7 +628,7 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
dc_colormap = usecolormap->Maps + (GETPALOOKUP (rw_light, shade) << COLORMAPSHIFT);
|
||||
R_SetColorMapLight(usecolormap, rw_light, shade);
|
||||
}
|
||||
if (!R_ClipSpriteColumnWithPortals(spr))
|
||||
R_WallSpriteColumn(R_DrawMaskedColumn);
|
||||
|
|
@ -660,14 +662,14 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
|
|||
int flags = 0;
|
||||
|
||||
// Do setup for blending.
|
||||
dc_colormap = spr->Style.colormap;
|
||||
R_SetColorMapLight(spr->Style.BaseColormap, 0, spr->Style.ColormapNum << FRACBITS);
|
||||
mode = R_SetPatchStyle(spr->Style.RenderStyle, spr->Style.Alpha, spr->Translation, spr->FillColor);
|
||||
|
||||
if (mode == DontDraw)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (colfunc == fuzzcolfunc || colfunc == R_FillColumnP)
|
||||
if (colfunc == fuzzcolfunc || colfunc == R_FillColumn)
|
||||
{
|
||||
flags = DVF_OFFSCREEN | DVF_SPANSONLY;
|
||||
}
|
||||
|
|
@ -686,12 +688,13 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
|
|||
|
||||
// Render the voxel, either directly to the screen or offscreen.
|
||||
R_DrawVoxel(spr->pa.vpos, spr->pa.vang, spr->gpos, spr->Angle,
|
||||
spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.colormap, cliptop, clipbot,
|
||||
spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.BaseColormap, spr->Style.ColormapNum, cliptop, clipbot,
|
||||
minslabz, maxslabz, flags);
|
||||
|
||||
// Blend the voxel, if that's what we need to do.
|
||||
if ((flags & ~DVF_MIRRORED) != 0)
|
||||
{
|
||||
int pixelsize = r_swtruecolor ? 4 : 1;
|
||||
for (int x = 0; x < viewwidth; ++x)
|
||||
{
|
||||
if (!(flags & DVF_SPANSONLY) && (x & 3) == 0)
|
||||
|
|
@ -706,15 +709,12 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
|
|||
dc_yl = span->Start;
|
||||
dc_yh = span->Stop - 1;
|
||||
dc_count = span->Stop - span->Start;
|
||||
dc_dest = ylookup[span->Start] + x + dc_destorg;
|
||||
dc_dest = (ylookup[span->Start] + x) * pixelsize + dc_destorg;
|
||||
colfunc();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int **tspan = &dc_ctspan[x & 3];
|
||||
(*tspan)[0] = span->Start;
|
||||
(*tspan)[1] = span->Stop - 1;
|
||||
*tspan += 2;
|
||||
rt_span_coverage(x, span->Start, span->Stop - 1);
|
||||
}
|
||||
}
|
||||
if (!(flags & DVF_SPANSONLY) && (x & 3) == 3)
|
||||
|
|
@ -1073,7 +1073,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
vis->Style.Alpha = float(thing->Alpha);
|
||||
vis->fakefloor = fakefloor;
|
||||
vis->fakeceiling = fakeceiling;
|
||||
vis->ColormapNum = 0;
|
||||
vis->Style.ColormapNum = 0;
|
||||
vis->bInMirror = MirrorFlags & RF_XFLIP;
|
||||
vis->bSplitSprite = false;
|
||||
|
||||
|
|
@ -1125,7 +1125,8 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
// get light level
|
||||
if (fixedcolormap != NULL)
|
||||
{ // fixed map
|
||||
vis->Style.colormap = fixedcolormap;
|
||||
vis->Style.BaseColormap = fixedcolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1135,17 +1136,19 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
}
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
vis->Style.colormap = mybasecolormap->Maps + fixedlightlev;
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (!foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
||||
{ // full bright
|
||||
vis->Style.colormap = mybasecolormap->Maps;
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{ // diminished light
|
||||
vis->ColormapNum = GETPALOOKUP(
|
||||
vis->Style.ColormapNum = GETPALOOKUP(
|
||||
r_SpriteVisibility / MAX(tz, MINZ), spriteshade);
|
||||
vis->Style.colormap = mybasecolormap->Maps + (vis->ColormapNum << COLORMAPSHIFT);
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1214,14 +1217,13 @@ static void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID p
|
|||
vis->Style.Alpha = float(thing->Alpha);
|
||||
vis->fakefloor = NULL;
|
||||
vis->fakeceiling = NULL;
|
||||
vis->ColormapNum = 0;
|
||||
vis->bInMirror = MirrorFlags & RF_XFLIP;
|
||||
vis->pic = pic;
|
||||
vis->bIsVoxel = false;
|
||||
vis->bWallSprite = true;
|
||||
vis->ColormapNum = GETPALOOKUP(
|
||||
vis->Style.ColormapNum = GETPALOOKUP(
|
||||
r_SpriteVisibility / MAX(tz, MINZ), spriteshade);
|
||||
vis->Style.colormap = basecolormap->Maps + (vis->ColormapNum << COLORMAPSHIFT);
|
||||
vis->Style.BaseColormap = basecolormap;
|
||||
vis->wallc = wallc;
|
||||
}
|
||||
|
||||
|
|
@ -1401,7 +1403,7 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
|
|||
vis->yscale = float(pspriteyscale / tex->Scale.Y);
|
||||
vis->Translation = 0; // [RH] Use default colors
|
||||
vis->pic = tex;
|
||||
vis->ColormapNum = 0;
|
||||
vis->Style.ColormapNum = 0;
|
||||
|
||||
if (flip)
|
||||
{
|
||||
|
|
@ -1449,9 +1451,10 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
|
|||
}
|
||||
}
|
||||
|
||||
if (realfixedcolormap != nullptr)
|
||||
if (realfixedcolormap != nullptr && (!r_swtruecolor || (r_shadercolormaps && screen->Accel2D)))
|
||||
{ // fixed color
|
||||
vis->Style.colormap = realfixedcolormap->Colormap;
|
||||
vis->Style.BaseColormap = realfixedcolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1461,35 +1464,38 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
|
|||
}
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
vis->Style.colormap = mybasecolormap->Maps + fixedlightlev;
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (!foggy && pspr->GetState()->GetFullbright())
|
||||
{ // full bright
|
||||
vis->Style.colormap = mybasecolormap->Maps; // [RH] use basecolormap
|
||||
vis->Style.BaseColormap = mybasecolormap; // [RH] use basecolormap
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{ // local light
|
||||
vis->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP(0, spriteshade) << COLORMAPSHIFT);
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.ColormapNum = GETPALOOKUP(0, spriteshade);
|
||||
}
|
||||
}
|
||||
if (camera->Inventory != nullptr)
|
||||
{
|
||||
lighttable_t *oldcolormap = vis->Style.colormap;
|
||||
camera->Inventory->AlterWeaponSprite(&vis->Style);
|
||||
if (vis->Style.colormap != oldcolormap)
|
||||
BYTE oldcolormapnum = vis->Style.ColormapNum;
|
||||
FColormap *oldcolormap = vis->Style.BaseColormap;
|
||||
camera->Inventory->AlterWeaponSprite (&vis->Style);
|
||||
if (vis->Style.BaseColormap != oldcolormap || vis->Style.ColormapNum != oldcolormapnum)
|
||||
{
|
||||
// The colormap has changed. Is it one we can easily identify?
|
||||
// If not, then don't bother trying to identify it for
|
||||
// hardware accelerated drawing.
|
||||
if (vis->Style.colormap < SpecialColormaps[0].Colormap ||
|
||||
vis->Style.colormap > SpecialColormaps.Last().Colormap)
|
||||
if (vis->Style.BaseColormap < &SpecialColormaps[0] ||
|
||||
vis->Style.BaseColormap > &SpecialColormaps.Last())
|
||||
{
|
||||
noaccel = true;
|
||||
}
|
||||
// Has the basecolormap changed? If so, we can't hardware accelerate it,
|
||||
// since we don't know what it is anymore.
|
||||
else if (vis->Style.colormap < mybasecolormap->Maps ||
|
||||
vis->Style.colormap >= mybasecolormap->Maps + NUMCOLORMAPS * 256)
|
||||
else if (vis->Style.BaseColormap != mybasecolormap)
|
||||
{
|
||||
noaccel = true;
|
||||
}
|
||||
|
|
@ -1497,13 +1503,13 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
|
|||
}
|
||||
// If we're drawing with a special colormap, but shaders for them are disabled, do
|
||||
// not accelerate.
|
||||
if (!r_shadercolormaps && (vis->Style.colormap >= SpecialColormaps[0].Colormap &&
|
||||
vis->Style.colormap <= SpecialColormaps.Last().Colormap))
|
||||
if (!r_shadercolormaps && (vis->Style.BaseColormap >= &SpecialColormaps[0] &&
|
||||
vis->Style.BaseColormap <= &SpecialColormaps.Last()))
|
||||
{
|
||||
noaccel = true;
|
||||
}
|
||||
// If drawing with a BOOM colormap, disable acceleration.
|
||||
if (mybasecolormap == &NormalLight && NormalLight.Maps != realcolormaps)
|
||||
if (mybasecolormap == &NormalLight && NormalLight.Maps != realcolormaps.Maps)
|
||||
{
|
||||
noaccel = true;
|
||||
}
|
||||
|
|
@ -1520,7 +1526,8 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
|
|||
else
|
||||
{
|
||||
colormap_to_use = basecolormap;
|
||||
vis->Style.colormap = basecolormap->Maps;
|
||||
vis->Style.BaseColormap = basecolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
vis->Style.RenderStyle = STYLE_Normal;
|
||||
}
|
||||
|
||||
|
|
@ -1691,18 +1698,16 @@ void R_DrawRemainingPlayerSprites()
|
|||
FColormapStyle colormapstyle;
|
||||
bool usecolormapstyle = false;
|
||||
|
||||
if (vis->Style.colormap >= SpecialColormaps[0].Colormap &&
|
||||
vis->Style.colormap < SpecialColormaps[SpecialColormaps.Size()].Colormap)
|
||||
if (vis->Style.BaseColormap >= &SpecialColormaps[0] &&
|
||||
vis->Style.BaseColormap < &SpecialColormaps[SpecialColormaps.Size()])
|
||||
{
|
||||
// Yuck! There needs to be a better way to store colormaps in the vissprite... :(
|
||||
ptrdiff_t specialmap = (vis->Style.colormap - SpecialColormaps[0].Colormap) / sizeof(FSpecialColormap);
|
||||
special = &SpecialColormaps[specialmap];
|
||||
special = static_cast<FSpecialColormap*>(vis->Style.BaseColormap);
|
||||
}
|
||||
else if (colormap->Color == PalEntry(255,255,255) &&
|
||||
colormap->Desaturate == 0)
|
||||
{
|
||||
overlay = colormap->Fade;
|
||||
overlay.a = BYTE(((vis->Style.colormap - colormap->Maps) >> 8) * 255 / NUMCOLORMAPS);
|
||||
overlay.a = BYTE(vis->Style.ColormapNum * 255 / NUMCOLORMAPS);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1710,7 +1715,7 @@ void R_DrawRemainingPlayerSprites()
|
|||
colormapstyle.Color = colormap->Color;
|
||||
colormapstyle.Fade = colormap->Fade;
|
||||
colormapstyle.Desaturate = colormap->Desaturate;
|
||||
colormapstyle.FadeLevel = ((vis->Style.colormap - colormap->Maps) >> 8) / float(NUMCOLORMAPS);
|
||||
colormapstyle.FadeLevel = vis->Style.ColormapNum / float(NUMCOLORMAPS);
|
||||
}
|
||||
screen->DrawTexture(vis->pic,
|
||||
viewwindowx + vispsprites[i].x1,
|
||||
|
|
@ -1955,7 +1960,8 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
int r1, r2;
|
||||
short topclip, botclip;
|
||||
short *clip1, *clip2;
|
||||
lighttable_t *colormap = spr->Style.colormap;
|
||||
FColormap *colormap = spr->Style.BaseColormap;
|
||||
int colormapnum = spr->Style.ColormapNum;
|
||||
F3DFloor *rover;
|
||||
FDynamicColormap *mybasecolormap;
|
||||
|
||||
|
|
@ -2052,17 +2058,19 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
}
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
spr->Style.colormap = mybasecolormap->Maps + fixedlightlev;
|
||||
spr->Style.BaseColormap = mybasecolormap;
|
||||
spr->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||
{ // full bright
|
||||
spr->Style.colormap = mybasecolormap->Maps;
|
||||
spr->Style.BaseColormap = mybasecolormap;
|
||||
spr->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{ // diminished light
|
||||
spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight);
|
||||
spr->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP (
|
||||
r_SpriteVisibility / MAX(MINZ, (double)spr->depth), spriteshade) << COLORMAPSHIFT);
|
||||
spr->Style.BaseColormap = mybasecolormap;
|
||||
spr->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(MINZ, (double)spr->depth), spriteshade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2210,7 +2218,8 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
|
||||
if (topclip >= botclip)
|
||||
{
|
||||
spr->Style.colormap = colormap;
|
||||
spr->Style.BaseColormap = colormap;
|
||||
spr->Style.ColormapNum = colormapnum;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2340,7 +2349,8 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
}
|
||||
if (i == x2)
|
||||
{
|
||||
spr->Style.colormap = colormap;
|
||||
spr->Style.BaseColormap = colormap;
|
||||
spr->Style.ColormapNum = colormapnum;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2358,7 +2368,8 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
int maxvoxely = spr->gzb > hzb ? INT_MAX : xs_RoundToInt((spr->gzt - hzb) / spr->yscale);
|
||||
R_DrawVisVoxel(spr, minvoxely, maxvoxely, cliptop, clipbot);
|
||||
}
|
||||
spr->Style.colormap = colormap;
|
||||
spr->Style.BaseColormap = colormap;
|
||||
spr->Style.ColormapNum = colormapnum;
|
||||
}
|
||||
|
||||
// kg3D:
|
||||
|
|
@ -2475,7 +2486,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
int x1, x2, y1, y2;
|
||||
vissprite_t* vis;
|
||||
sector_t* heightsec = NULL;
|
||||
BYTE* map;
|
||||
FColormap* map;
|
||||
|
||||
// [ZZ] Particle not visible through the portal plane
|
||||
if (CurrentPortal && !!P_PointOnLineSide(particle->Pos, CurrentPortal->dst))
|
||||
|
|
@ -2548,7 +2559,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
botplane = &heightsec->ceilingplane;
|
||||
toppic = sector->GetTexture(sector_t::ceiling);
|
||||
botpic = heightsec->GetTexture(sector_t::ceiling);
|
||||
map = heightsec->ColorMap->Maps;
|
||||
map = heightsec->ColorMap;
|
||||
}
|
||||
else if (fakeside == FAKED_BelowFloor)
|
||||
{
|
||||
|
|
@ -2556,7 +2567,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
botplane = §or->floorplane;
|
||||
toppic = heightsec->GetTexture(sector_t::floor);
|
||||
botpic = sector->GetTexture(sector_t::floor);
|
||||
map = heightsec->ColorMap->Maps;
|
||||
map = heightsec->ColorMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2564,7 +2575,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
botplane = &heightsec->floorplane;
|
||||
toppic = heightsec->GetTexture(sector_t::ceiling);
|
||||
botpic = heightsec->GetTexture(sector_t::floor);
|
||||
map = sector->ColorMap->Maps;
|
||||
map = sector->ColorMap;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2573,7 +2584,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
botplane = §or->floorplane;
|
||||
toppic = sector->GetTexture(sector_t::ceiling);
|
||||
botpic = sector->GetTexture(sector_t::floor);
|
||||
map = sector->ColorMap->Maps;
|
||||
map = sector->ColorMap;
|
||||
}
|
||||
|
||||
if (botpic != skyflatnum && particle->Pos.Z < botplane->ZatPoint (particle->Pos))
|
||||
|
|
@ -2602,25 +2613,28 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
vis->renderflags = particle->trans;
|
||||
vis->FakeFlatStat = fakeside;
|
||||
vis->floorclip = 0;
|
||||
vis->ColormapNum = 0;
|
||||
vis->Style.ColormapNum = 0;
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
vis->Style.colormap = map + fixedlightlev;
|
||||
vis->Style.BaseColormap = map;
|
||||
vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (fixedcolormap)
|
||||
{
|
||||
vis->Style.colormap = fixedcolormap;
|
||||
vis->Style.BaseColormap = fixedcolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else if (particle->bright)
|
||||
{
|
||||
vis->Style.colormap = map;
|
||||
vis->Style.BaseColormap = map;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Particles are slightly more visible than regular sprites.
|
||||
vis->ColormapNum = GETPALOOKUP(tiz * r_SpriteVisibility * 0.5, shade);
|
||||
vis->Style.colormap = map + (vis->ColormapNum << COLORMAPSHIFT);
|
||||
vis->Style.ColormapNum = GETPALOOKUP(tiz * r_SpriteVisibility * 0.5, shade);
|
||||
vis->Style.BaseColormap = map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2649,13 +2663,13 @@ static void R_DrawMaskedSegsBehindParticle (const vissprite_t *vis)
|
|||
}
|
||||
}
|
||||
|
||||
void R_DrawParticle (vissprite_t *vis)
|
||||
void R_DrawParticle_C (vissprite_t *vis)
|
||||
{
|
||||
DWORD *bg2rgb;
|
||||
int spacing;
|
||||
BYTE *dest;
|
||||
DWORD fg;
|
||||
BYTE color = vis->Style.colormap[vis->startfrac];
|
||||
BYTE color = vis->Style.BaseColormap->Maps[(vis->Style.ColormapNum << COLORMAPSHIFT) + vis->startfrac];
|
||||
int yl = vis->y1;
|
||||
int ycount = vis->y2 - yl + 1;
|
||||
int x1 = vis->x1;
|
||||
|
|
@ -2714,12 +2728,64 @@ void R_DrawParticle (vissprite_t *vis)
|
|||
}
|
||||
}
|
||||
|
||||
void R_DrawParticle_rgba(vissprite_t *vis)
|
||||
{
|
||||
int spacing;
|
||||
uint32_t *dest;
|
||||
BYTE color = vis->Style.BaseColormap->Maps[vis->startfrac];
|
||||
int yl = vis->y1;
|
||||
int ycount = vis->y2 - yl + 1;
|
||||
int x1 = vis->x1;
|
||||
int countbase = vis->x2 - x1;
|
||||
|
||||
R_DrawMaskedSegsBehindParticle(vis);
|
||||
|
||||
DrawerCommandQueue::WaitForWorkers();
|
||||
|
||||
uint32_t fg = LightBgra::shade_pal_index_simple(color, LightBgra::calc_light_multiplier(LIGHTSCALE(0, vis->Style.ColormapNum << FRACBITS)));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
// vis->renderflags holds translucency level (0-255)
|
||||
fixed_t fglevel = ((vis->renderflags + 1) << 8) & ~0x3ff;
|
||||
uint32_t alpha = fglevel * 256 / FRACUNIT;
|
||||
uint32_t inv_alpha = 256 - alpha;
|
||||
|
||||
fg_red *= alpha;
|
||||
fg_green *= alpha;
|
||||
fg_blue *= alpha;
|
||||
|
||||
spacing = RenderTarget->GetPitch();
|
||||
|
||||
for (int x = x1; x < (x1 + countbase); x++)
|
||||
{
|
||||
dc_x = x;
|
||||
if (R_ClipSpriteColumnWithPortals(vis))
|
||||
continue;
|
||||
dest = ylookup[yl] + x + (uint32_t*)dc_destorg;
|
||||
for (int y = 0; y < ycount; y++)
|
||||
{
|
||||
uint32_t bg_red = (*dest >> 16) & 0xff;
|
||||
uint32_t bg_green = (*dest >> 8) & 0xff;
|
||||
uint32_t bg_blue = (*dest) & 0xff;
|
||||
|
||||
uint32_t red = (fg_red + bg_red * inv_alpha) / 256;
|
||||
uint32_t green = (fg_green + bg_green * inv_alpha) / 256;
|
||||
uint32_t blue = (fg_blue + bg_blue * inv_alpha) / 256;
|
||||
|
||||
*dest = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
dest += spacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern double BaseYaspectMul;;
|
||||
|
||||
void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
||||
const FVector3 &dasprpos, DAngle dasprang,
|
||||
fixed_t daxscale, fixed_t dayscale, FVoxel *voxobj,
|
||||
lighttable_t *colormap, short *daumost, short *dadmost, int minslabz, int maxslabz, int flags)
|
||||
FColormap *colormap, int colormapnum, short *daumost, short *dadmost, int minslabz, int maxslabz, int flags)
|
||||
{
|
||||
int i, j, k, x, y, syoff, ggxstart, ggystart, nxoff;
|
||||
fixed_t cosang, sinang, sprcosang, sprsinang;
|
||||
|
|
@ -2761,7 +2827,9 @@ void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
|||
sprcosang = FLOAT2FIXED(dasprang.Cos()) >> 2;
|
||||
sprsinang = FLOAT2FIXED(-dasprang.Sin()) >> 2;
|
||||
|
||||
R_SetupDrawSlab(colormap);
|
||||
R_SetupDrawSlab(colormap, 0.0f, colormapnum << FRACBITS);
|
||||
|
||||
int pixelsize = r_swtruecolor ? 4 : 1;
|
||||
|
||||
// Select mip level
|
||||
i = abs(DMulScale6(dasprx - globalposx, cosang, daspry - globalposy, sinang));
|
||||
|
|
@ -3016,7 +3084,7 @@ void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
|||
if (!(flags & DVF_OFFSCREEN))
|
||||
{
|
||||
// Draw directly to the screen.
|
||||
R_DrawSlab(xxr - xxl, yplc[xxl], z2 - z1, yinc, col, ylookup[z1] + lxt + xxl + dc_destorg);
|
||||
R_DrawSlab(xxr - xxl, yplc[xxl], z2 - z1, yinc, col, (ylookup[z1] + lxt + xxl) * pixelsize + dc_destorg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3247,12 +3315,12 @@ void R_CheckOffscreenBuffer(int width, int height, bool spansonly)
|
|||
{
|
||||
if (OffscreenColorBuffer == NULL)
|
||||
{
|
||||
OffscreenColorBuffer = new BYTE[width * height];
|
||||
OffscreenColorBuffer = new BYTE[width * height * 4];
|
||||
}
|
||||
else if (OffscreenBufferWidth != width || OffscreenBufferHeight != height)
|
||||
{
|
||||
delete[] OffscreenColorBuffer;
|
||||
OffscreenColorBuffer = new BYTE[width * height];
|
||||
OffscreenColorBuffer = new BYTE[width * height * 4];
|
||||
}
|
||||
}
|
||||
OffscreenBufferWidth = width;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue