- handle the view frame with backend features.

This commit is contained in:
Christoph Oelckers 2020-08-02 18:02:13 +02:00
parent fc390e244f
commit 1392f4db01
5 changed files with 31 additions and 48 deletions

View file

@ -794,10 +794,31 @@ private:
} }
}; };
static void UpdateFrame(void)
{
auto tex = tileGetTexture(kBackTile);
twod->AddFlatFill(0, 0, xdim, gViewY0 - 3, tex);
twod->AddFlatFill(0, gViewY1 + 4, xdim, ydim, tex);
twod->AddFlatFill(0, gViewY0 - 3, gViewX0 - 3, gViewY1 + 4, tex);
twod->AddFlatFill(gViewX1 + 4, gViewY0 - 3, xdim, gViewY1 + 4, tex);
twod->AddFlatFill(gViewX0 - 3, gViewY0 - 3, gViewX0, gViewY1 + 1, tex, 0, 1, 0xff545454);
twod->AddFlatFill(gViewX0, gViewY0 - 3, gViewX1 + 4, gViewY0, tex, 0, 1, 0xff545454);
twod->AddFlatFill(gViewX1 + 1, gViewY0, gViewX1 + 4, gViewY1 + 4, tex, 0, 1, 0xff2a2a2a);
twod->AddFlatFill(gViewX0 - 3, gViewY1 + 1, gViewX1 + 1, gViewY1 + 4, tex, 0, 1, 0xff2a2a2a);
}
void UpdateStatusBar(ClockTicks arg) void UpdateStatusBar(ClockTicks arg)
{ {
DBloodStatusBar sbar; DBloodStatusBar sbar;
if (gViewMode == 3 && gViewSize > 2)
{
UpdateFrame();
}
sbar.UpdateStatusBar(arg); sbar.UpdateStatusBar(arg);
} }

View file

@ -1007,28 +1007,6 @@ void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int
} }
// for the screen border
void viewTileSprite(int nTile, int nShade, int nPalette, int x1, int y1, int x2, int y2)
{
Rect rect1 = Rect(x1, y1, x2, y2);
Rect rect2 = Rect(0, 0, xdim, ydim);
rect1 &= rect2;
if (!rect1)
return;
dassert(nTile >= 0 && nTile < kMaxTiles);
int width = tilesiz[nTile].x;
int height = tilesiz[nTile].y;
int bx1 = DecBy(rect1.x0+1, width);
int by1 = DecBy(rect1.y0+1, height);
int bx2 = IncBy(rect1.x1-1, width);
int by2 = IncBy(rect1.y1-1, height);
for (int x = bx1; x < bx2; x += width)
for (int y = by1; y < by2; y += height)
rotatesprite(x<<16, y<<16, 65536, 0, nTile, nShade, nPalette, 64+16+8, x1, y1, x2-1, y2-1);
}
void InitStatusBar(void) void InitStatusBar(void)
{ {
tileLoadTile(2200); tileLoadTile(2200);
@ -1210,27 +1188,9 @@ void viewResizeView(int size)
videoSetViewableArea(gViewX0, gViewY0, gViewX1, gViewY1); videoSetViewableArea(gViewX0, gViewY0, gViewX1, gViewY1);
} }
#define kBackTile 253
void UpdateFrame(void)
{
viewTileSprite(kBackTile, 0, 0, 0, 0, xdim, gViewY0-3);
viewTileSprite(kBackTile, 0, 0, 0, gViewY1+4, xdim, ydim);
viewTileSprite(kBackTile, 0, 0, 0, gViewY0-3, gViewX0-3, gViewY1+4);
viewTileSprite(kBackTile, 0, 0, gViewX1+4, gViewY0-3, xdim, gViewY1+4);
viewTileSprite(kBackTile, 20, 0, gViewX0-3, gViewY0-3, gViewX0, gViewY1+1);
viewTileSprite(kBackTile, 20, 0, gViewX0, gViewY0-3, gViewX1+4, gViewY0);
viewTileSprite(kBackTile, 10, 1, gViewX1+1, gViewY0, gViewX1+4, gViewY1+4);
viewTileSprite(kBackTile, 10, 1, gViewX0-3, gViewY1+1, gViewX1+1, gViewY1+4);
}
void viewDrawInterface(ClockTicks arg) void viewDrawInterface(ClockTicks arg)
{ {
if (gViewMode == 3)
{
UpdateFrame();
}
UpdateStatusBar(arg); UpdateStatusBar(arg);
} }

View file

@ -65,6 +65,8 @@ enum INTERPOLATE_TYPE {
enum enum
{ {
kBackTile = 253,
kCrosshairTile = 2319, kCrosshairTile = 2319,
kLoadScreen = 2049, kLoadScreen = 2049,
kLoadScreenWideBack = 9216, kLoadScreenWideBack = 9216,

View file

@ -739,7 +739,7 @@ float F2DDrawer::GetClassicFlatScalarHeight()
return sh; return sh;
} }
void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin, double flatscale) void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin, double flatscale, PalEntry color)
{ {
float fU1, fU2, fV1, fV2; float fU1, fU2, fV1, fV2;
@ -835,18 +835,18 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu
dg.mVertIndex = (int)mVertices.Reserve(4); dg.mVertIndex = (int)mVertices.Reserve(4);
auto ptr = &mVertices[dg.mVertIndex]; auto ptr = &mVertices[dg.mVertIndex];
ptr->Set(left, top, 0, fU1, fV1, 0xffffffff); ptr++; ptr->Set(left, top, 0, fU1, fV1, color); ptr++;
if (local_origin < 4) if (local_origin < 4)
{ {
ptr->Set(left, bottom, 0, fU1, fV2, 0xffffffff); ptr++; ptr->Set(left, bottom, 0, fU1, fV2, color); ptr++;
ptr->Set(right, top, 0, fU2, fV1, 0xffffffff); ptr++; ptr->Set(right, top, 0, fU2, fV1, color); ptr++;
} }
else else
{ {
ptr->Set(left, bottom, 0, fU2, fV1, 0xffffffff); ptr++; ptr->Set(left, bottom, 0, fU2, fV1, color); ptr++;
ptr->Set(right, top, 0, fU1, fV2, 0xffffffff); ptr++; ptr->Set(right, top, 0, fU1, fV2, color); ptr++;
} }
ptr->Set(right, bottom, 0, fU2, fV2, 0xffffffff); ptr++; ptr->Set(right, bottom, 0, fU2, fV2, color); ptr++;
dg.mIndexIndex = mIndices.Size(); dg.mIndexIndex = mIndices.Size();
dg.mIndexCount += 6; dg.mIndexCount += 6;
AddIndices(dg.mVertIndex, 6, 0, 1, 2, 1, 3, 2); AddIndices(dg.mVertIndex, 6, 0, 1, 2, 1, 3, 2);

View file

@ -188,7 +188,7 @@ public:
void AddPoly(FGameTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2); void AddPoly(FGameTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2);
void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex, void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex,
int clipx1, int clipy1, int clipx2, int clipy2); int clipx1, int clipy1, int clipx2, int clipy2);
void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin = false, double flatscale = 1.0); void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin = false, double flatscale = 1.0, PalEntry color = 0xffffffff);
void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr, bool prepend = false); void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr, bool prepend = false);
void ClearScreen(PalEntry color = 0xff000000); void ClearScreen(PalEntry color = 0xff000000);