- stripped out the entire software 2D renderer and moved all 2D drawing functions to DFrameBuffer so that they cannot be used with software DSimpleCanvas anymore.

This commit is contained in:
Christoph Oelckers 2018-03-26 23:16:27 +02:00
commit d650e37497
10 changed files with 280 additions and 762 deletions

View file

@ -191,19 +191,6 @@ CUSTOM_CVAR (Int, vid_refreshrate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
}
}
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)
// [RH] Set true when vid_setmode command has been executed
bool setmodeneeded = false;
// [RH] Resolution to change to when setmodeneeded is true
@ -248,78 +235,6 @@ bool DCanvas::IsValid ()
return false;
}
//==========================================================================
//
// DCanvas :: FlatFill
//
// Fill an area with a texture. If local_origin is false, then the origin
// used for the wrapping is (0,0). Otherwise, (left,right) is used.
//
//==========================================================================
void DCanvas::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);
}
}
}
//==========================================================================
//
// DCanvas :: Dim
//
// Applies a colored overlay to the entire screen, with the opacity
// determined by the dimamount cvar.
//
//==========================================================================
void DCanvas::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);
}
//==========================================================================
//
// DCanvas :: GetScreenshotBuffer
@ -1196,7 +1111,7 @@ FNativePalette *DFrameBuffer::CreatePalette(FRemapTable *remap)
bool DFrameBuffer::WipeStartScreen(int type)
{
return wipe_StartScreen(type);
return false;
}
//==========================================================================
@ -1210,8 +1125,6 @@ bool DFrameBuffer::WipeStartScreen(int type)
void DFrameBuffer::WipeEndScreen()
{
wipe_EndScreen();
Unlock();
}
//==========================================================================
@ -1226,8 +1139,7 @@ void DFrameBuffer::WipeEndScreen()
bool DFrameBuffer::WipeDo(int ticks)
{
Lock(true);
return wipe_ScreenWipe(ticks);
return false;
}
//==========================================================================
@ -1238,7 +1150,6 @@ bool DFrameBuffer::WipeDo(int ticks)
void DFrameBuffer::WipeCleanup()
{
wipe_Cleanup();
}
//==========================================================================