- added a ClearScreen function to the 2D drawer to wrap the frequent occurence of this use case.

This commit is contained in:
Christoph Oelckers 2020-01-05 10:48:44 +01:00
parent a3020ed867
commit 746aa4da82
12 changed files with 34 additions and 27 deletions

View file

@ -385,6 +385,11 @@ void F2DDrawer::AddColorOnlyQuad(int x1, int y1, int w, int h, PalEntry color, F
AddCommand(&dg);
}
void F2DDrawer::ClearScreen(PalEntry color)
{
AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), color);
}
//==========================================================================
//
//

View file

@ -133,7 +133,7 @@ public:
void AddFlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin);
void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr);
void ClearScreen(PalEntry color = 0xff000000);
void AddLine(float x1, float y1, float x2, float y2, uint32_t color, uint8_t alpha = 255);
void AddLine(float x1, float y1, float x2, float y2, int cx, int cy, int cx2, int cy2, uint32_t color, uint8_t alpha = 255);

View file

@ -227,7 +227,7 @@ void DMessageBoxMenu::Drawer()
}
else
{
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xa0000000);
twod->ClearScreen(0xa0000000);
gi->DrawCenteredTextScreen(origin, mFullMessage, 100, false);
}
}

View file

@ -1288,25 +1288,25 @@ void G_PlayE4Cutscene(void)
renderFlushPerms();
videoSetViewableArea(0, 0, xdim-1, ydim-1);
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
if (Anim_Play("vol41a.anm"))
goto end_vol4a;
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
if (Anim_Play("vol42a.anm"))
goto end_vol4a;
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
Anim_Play("vol43a.anm");
end_vol4a:
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
FX_StopAllSounds();

View file

@ -898,7 +898,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on == 2)
{
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
G_DrawBackground(); // Necessary GL fills the entire screen with black
renderDrawMapView(cposx, cposy, pp->zoom, cang);
}

View file

@ -622,7 +622,7 @@ void DrawMap()
//drawoverheadmap(initx, inity, lMapZoom, inita);
if (nMapMode == 2)
{
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
RefreshBackground();
renderDrawMapView(initx, inity, lMapZoom, inita);
}

View file

@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "light.h"
#include "cd.h"
#include "menu/menu.h"
#include "v_2ddrawer.h"
#include <string>
#include <assert.h>
@ -672,6 +673,7 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
while (nIdleSeconds < 12)
{
HandleAsync();
twod->ClearScreen();
if (((int)totalclock - startTime) / kTimerTicks)
{

View file

@ -256,7 +256,7 @@ void PlayMovie(const char* fileName)
}
}
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
rotatesprite(160 << 16, 100 << 16, z, angle, kMovieTile, 0, 1, 2, 0, 0, xdim - 1, ydim - 1);
if (bDoFade) {

View file

@ -1907,23 +1907,23 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
renderFlushPerms();
videoSetViewableArea(0,0,xdim-1,ydim-1);
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
int animReturn = Anim_Play("vol41a.anm");
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
if (animReturn)
goto end_vol4a;
animReturn = Anim_Play("vol42a.anm");
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
if (animReturn)
goto end_vol4a;
Anim_Play("vol43a.anm");
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
end_vol4a:

View file

@ -928,7 +928,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on == 2)
{
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
G_DrawBackground();
renderDrawMapView(cposx, cposy, pp->zoom, cang);
}

View file

@ -326,7 +326,7 @@ playanm(short anim_num)
ENDOFANIMLOOP:
GLInterface.EnableNonTransparent255(false);
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
videoSetPalette(0, BASEPAL, 2);

View file

@ -1462,7 +1462,7 @@ void LogoLevel(void)
DSPRINTF(ds,"About to display 3drealms pic...");
MONO_PRINT(ds);
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
rotatesprite(0, 0, RS_SCALE, 0, THREED_REALMS_PIC, 0, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1);
videoNextPage();
//FadeIn(0, 3);
@ -1486,7 +1486,7 @@ void LogoLevel(void)
}
}
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
videoSetPalette(0, BASEPAL, 2);
@ -1517,7 +1517,7 @@ void CreditsLevel(void)
save = gs.BorderNum;
ClearStartMost();
gs.BorderNum = save;
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
// Lo Wang feel like singing!
@ -1580,7 +1580,7 @@ void CreditsLevel(void)
}
// put up a blank screen while loading
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
inputState.ClearAllInput();
Mus_Stop();
@ -1618,7 +1618,7 @@ TitleLevel(void)
tempbuf[i] = i;
palookup[0] = tempbuf;
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
ready2send = 0;
@ -1675,19 +1675,19 @@ TitleLevel(void)
void DrawMenuLevelScreen(void)
{
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
rotatesprite(0, 0, RS_SCALE, 0, TITLE_PIC, 20, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1);
}
void DrawStatScreen(void)
{
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
rotatesprite(0, 0, RS_SCALE, 0, STAT_SCREEN_PIC, 0, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1);
}
void DrawLoadLevelScreen(void)
{
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
rotatesprite(0, 0, RS_SCALE, 0, TITLE_PIC, 20, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1);
}
@ -1723,7 +1723,7 @@ void MenuLevel(void)
DemoMode = FALSE;
DemoPlaying = FALSE;
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
//FadeOut(0, 0);
@ -1833,7 +1833,7 @@ void MenuLevel(void)
inputState.ClearAllInput();
M_ClearMenus();
InMenuLevel = FALSE;
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
}
@ -2058,7 +2058,7 @@ void BonusScreen(PLAYERp pp)
if (Level < 0) Level = 0;
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
videoNextPage();
inputState.ClearAllInput();
@ -2101,7 +2101,7 @@ void BonusScreen(PLAYERp pp)
gStateControl(&State, &Tics);
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
twod->ClearScreen();
rotatesprite(0, 0, RS_SCALE, 0, 5120, 0, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1);
if (UserMapName[0])