- it compiles again.
This won't work, though, because no backend for the new 2D code exists yet.
This commit is contained in:
parent
33289ade49
commit
16480a3f4b
18 changed files with 195 additions and 1907 deletions
124
src/v_draw.cpp
124
src/v_draw.cpp
|
|
@ -59,19 +59,6 @@
|
|||
#include "textures.h"
|
||||
#include "vm.h"
|
||||
|
||||
CUSTOM_CVAR(Float, dimamount, -1.f, CVAR_ARCHIVE)
|
||||
{
|
||||
if (self < 0.f && self != -1.f)
|
||||
{
|
||||
self = -1.f;
|
||||
}
|
||||
else if (self > 1.f)
|
||||
{
|
||||
self = 1.f;
|
||||
}
|
||||
}
|
||||
CVAR(Color, dimcolor, 0xffd700, CVAR_ARCHIVE)
|
||||
|
||||
CUSTOM_CVAR(Int, uiscale, 0, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
if (self < 0)
|
||||
|
|
@ -476,6 +463,7 @@ bool DFrameBuffer::ParseDrawTextureTags(FTexture *img, double x, double y, uint3
|
|||
parms->colorOverlay = 0;
|
||||
parms->alphaChannel = false;
|
||||
parms->flipX = false;
|
||||
parms->flipY = false;
|
||||
parms->color = 0xffffffff;
|
||||
//parms->shadowAlpha = 0;
|
||||
parms->shadowColor = 0;
|
||||
|
|
@ -492,6 +480,10 @@ bool DFrameBuffer::ParseDrawTextureTags(FTexture *img, double x, double y, uint3
|
|||
parms->cellx = parms->celly = 0;
|
||||
parms->maxstrlen = INT_MAX;
|
||||
parms->virtBottom = false;
|
||||
parms->srcx = 0.;
|
||||
parms->srcy = 0.;
|
||||
parms->srcwidth = 1.;
|
||||
parms->srcheight = 1.;
|
||||
|
||||
// Parse the tag list for attributes. (For floating point attributes,
|
||||
// consider that the C ABI dictates that all floats be promoted to
|
||||
|
|
@ -661,6 +653,26 @@ bool DFrameBuffer::ParseDrawTextureTags(FTexture *img, double x, double y, uint3
|
|||
parms->flipX = ListGetInt(tags);
|
||||
break;
|
||||
|
||||
case DTA_FlipY:
|
||||
parms->flipY = ListGetInt(tags);
|
||||
break;
|
||||
|
||||
case DTA_SrcX:
|
||||
parms->srcx = ListGetDouble(tags) / img->GetScaledWidthDouble();
|
||||
break;
|
||||
|
||||
case DTA_SrcY:
|
||||
parms->srcy = ListGetDouble(tags) / img->GetScaledHeightDouble();
|
||||
break;
|
||||
|
||||
case DTA_SrcWidth:
|
||||
parms->srcwidth = ListGetDouble(tags) / img->GetScaledWidthDouble();
|
||||
break;
|
||||
|
||||
case DTA_SrcHeight:
|
||||
parms->srcheight = ListGetDouble(tags) / img->GetScaledHeightDouble();
|
||||
break;
|
||||
|
||||
case DTA_TopOffset:
|
||||
assert(fortext == false);
|
||||
if (fortext) return false;
|
||||
|
|
@ -1029,6 +1041,7 @@ void DFrameBuffer::FillBorder (FTexture *img)
|
|||
|
||||
void DFrameBuffer::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor)
|
||||
{
|
||||
m2DDrawer.AddLine(x0, y0, x1, y1, palColor, realcolor);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Screen, DrawLine)
|
||||
|
|
@ -1052,6 +1065,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawLine)
|
|||
|
||||
void DFrameBuffer::DrawPixel(int x, int y, int palColor, uint32_t realcolor)
|
||||
{
|
||||
m2DDrawer.AddPixel(x, y, palColor, realcolor);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -1062,10 +1076,6 @@ void DFrameBuffer::DrawPixel(int x, int y, int palColor, uint32_t realcolor)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::DoClear (int left, int top, int right, int bottom, int palcolor, uint32_t color)
|
||||
{
|
||||
}
|
||||
|
||||
void DFrameBuffer::Clear(int left, int top, int right, int bottom, int palcolor, uint32_t color)
|
||||
{
|
||||
if (clipwidth >= 0 && clipheight >= 0)
|
||||
|
|
@ -1090,7 +1100,12 @@ void DFrameBuffer::Clear(int left, int top, int right, int bottom, int palcolor,
|
|||
right = left + w;
|
||||
bottom = top + h;
|
||||
}
|
||||
DoClear(left, top, right, bottom, palcolor, color);
|
||||
|
||||
if (palcolor >= 0 && color == 0)
|
||||
{
|
||||
color = GPalette.BaseColors[palcolor] | 0xff000000;
|
||||
}
|
||||
m2DDrawer.AddColorOnlyQuad(left, top, right - left, bottom - top, color | 0xFF000000);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Screen, Clear)
|
||||
|
|
@ -1115,8 +1130,17 @@ DEFINE_ACTION_FUNCTION(_Screen, Clear)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::DoDim(PalEntry color, float damount, int x1, int y1, int w, int h)
|
||||
void DFrameBuffer::DoDim(PalEntry color, float amount, int x1, int y1, int w, int h)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (amount > 1)
|
||||
{
|
||||
amount = 1;
|
||||
}
|
||||
m2DDrawer.AddColorOnlyQuad(x1, y1, w, h, color | (int(amount * 255) << 24));
|
||||
}
|
||||
|
||||
void DFrameBuffer::Dim(PalEntry color, float damount, int x1, int y1, int w, int h)
|
||||
|
|
@ -1175,6 +1199,7 @@ void DFrameBuffer::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
double originx, double originy, double scalex, double scaley, DAngle rotation,
|
||||
const FColormap &colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
|
||||
{
|
||||
m2DDrawer.AddPoly(tex, points, npoints, originx, originy, scalex, scaley, rotation, colormap, flatcolor, lightlevel);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -1188,68 +1213,9 @@ void DFrameBuffer::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
|
||||
void DFrameBuffer::FlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin)
|
||||
{
|
||||
int w = src->GetWidth();
|
||||
int h = src->GetHeight();
|
||||
|
||||
// Repeatedly draw the texture, left-to-right, top-to-bottom.
|
||||
for (int y = local_origin ? top : (top / h * h); y < bottom; y += h)
|
||||
{
|
||||
for (int x = local_origin ? left : (left / w * w); x < right; x += w)
|
||||
{
|
||||
DrawTexture(src, x, y,
|
||||
DTA_ClipLeft, left,
|
||||
DTA_ClipRight, right,
|
||||
DTA_ClipTop, top,
|
||||
DTA_ClipBottom, bottom,
|
||||
DTA_TopOffset, 0,
|
||||
DTA_LeftOffset, 0,
|
||||
TAG_DONE);
|
||||
}
|
||||
}
|
||||
m2DDrawer.AddFlatFill(left, top, right, bottom, src, local_origin);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DCanvas :: Dim
|
||||
//
|
||||
// Applies a colored overlay to the entire screen, with the opacity
|
||||
// determined by the dimamount cvar.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::Dim(PalEntry color)
|
||||
{
|
||||
PalEntry dimmer;
|
||||
float amount;
|
||||
|
||||
if (dimamount >= 0)
|
||||
{
|
||||
dimmer = PalEntry(dimcolor);
|
||||
amount = dimamount;
|
||||
}
|
||||
else
|
||||
{
|
||||
dimmer = gameinfo.dimcolor;
|
||||
amount = gameinfo.dimamount;
|
||||
}
|
||||
|
||||
if (gameinfo.gametype == GAME_Hexen && gamestate == GS_DEMOSCREEN)
|
||||
{ // On the Hexen title screen, the default dimming is not
|
||||
// enough to make the menus readable.
|
||||
amount = MIN<float>(1.f, amount*2.f);
|
||||
}
|
||||
// Add the cvar's dimming on top of the color passed to the function
|
||||
if (color.a != 0)
|
||||
{
|
||||
float dim[4] = { color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f };
|
||||
V_AddBlend(dimmer.r / 255.f, dimmer.g / 255.f, dimmer.b / 255.f, amount, dim);
|
||||
dimmer = PalEntry(uint8_t(dim[0] * 255), uint8_t(dim[1] * 255), uint8_t(dim[2] * 255));
|
||||
amount = dim[3];
|
||||
}
|
||||
Dim(dimmer, amount, 0, 0, Width, Height);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// V_SetBorderNeedRefresh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue