Merge branch 'master' into modern

This commit is contained in:
Christoph Oelckers 2018-07-14 10:24:41 +02:00
commit 124fe63d00
22 changed files with 463 additions and 165 deletions

View file

@ -190,6 +190,50 @@ void DFrameBuffer::DrawTextureParms(FTexture *img, DrawParms &parms)
m2DDrawer.AddTexture(img, parms);
}
//==========================================================================
//
// ZScript arbitrary textured shape drawing functions
//
//==========================================================================
void DFrameBuffer::DrawShape(FTexture *img, DShape2D *shape, int tags_first, ...)
{
Va_List tags;
va_start(tags.list, tags_first);
DrawParms parms;
bool res = ParseDrawTextureTags(img, 0, 0, tags_first, tags, &parms, false);
va_end(tags.list);
if (!res) return;
m2DDrawer.AddShape(img, shape, parms);
}
void DFrameBuffer::DrawShape(FTexture *img, DShape2D *shape, VMVa_List &args)
{
DrawParms parms;
uint32_t tag = ListGetInt(args);
bool res = ParseDrawTextureTags(img, 0, 0, tag, args, &parms, false);
if (!res) return;
m2DDrawer.AddShape(img, shape, parms);
}
DEFINE_ACTION_FUNCTION(_Screen, DrawShape)
{
PARAM_PROLOGUE;
PARAM_INT(texid);
PARAM_BOOL(animate);
PARAM_POINTER(shape, DShape2D);
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
FTexture *tex = animate ? TexMan(FSetTextureID(texid)) : TexMan[FSetTextureID(texid)];
VMVa_List args = { param + 3, 0, numparam - 3 };
screen->DrawShape(tex, shape, args);
return 0;
}
//==========================================================================
//
// Clipping rect
@ -1451,7 +1495,11 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
V_AddBlend(player->BlendR, player->BlendG, player->BlendB, player->BlendA, blend);
}
screen->Dim(PalEntry(255, uint8_t(blend[0] * 255), uint8_t(blend[1] * 255), uint8_t(blend[2] * 255)), blend[3], 0, 0, screen->GetWidth(), screen->GetHeight());
const float br = clamp(blend[0] * 255.f, 0.f, 255.f);
const float bg = clamp(blend[1] * 255.f, 0.f, 255.f);
const float bb = clamp(blend[2] * 255.f, 0.f, 255.f);
const PalEntry bcolor(255, uint8_t(br), uint8_t(bg), uint8_t(bb));
screen->Dim(bcolor, blend[3], 0, 0, screen->GetWidth(), screen->GetHeight());
}