- consolidated console clear functions.

This commit is contained in:
Christoph Oelckers 2019-10-04 01:25:10 +02:00
parent 63a733b934
commit 471f720d95
3 changed files with 17 additions and 60 deletions

View file

@ -246,7 +246,7 @@ int32_t FindDistance3D(int32_t x, int32_t y, int32_t z)
// Clear OSD background // Clear OSD background
void COMMON_clearbackground(int numcols, int numrows) void COMMON_doclearbackground(int numcols, int height)
{ {
UNREFERENCED_PARAMETER(numcols); UNREFERENCED_PARAMETER(numcols);
@ -260,9 +260,9 @@ void COMMON_clearbackground(int numcols, int numrows)
polymostSet2dView(); polymostSet2dView();
glColor4f(0.f, 0.f, 0.f, 0.67f); glColor4f(0.f, 0.f, 0.f, 0.67f);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glRecti(0, 0, xdim, 8*numrows+8); glRecti(0, 0, xdim, height);
glColor4f(0.f, 0.f, 0.f, 1.f); glColor4f(0.f, 0.f, 0.f, 1.f);
glRecti(0, 8*numrows+4, xdim, 8*numrows+8); glRecti(0, height-4, xdim, height);
// glPopAttrib(); // glPopAttrib();
polymost_useColorOnly(false); polymost_useColorOnly(false);
@ -274,3 +274,8 @@ void COMMON_clearbackground(int numcols, int numrows)
CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]); CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]);
} }
void COMMON_clearbackground(int numcols, int numrows)
{
COMMON_doclearbackground(numcols, 8 * numrows + 8);
}

View file

@ -140,37 +140,12 @@ void GAME_onshowosd(int shown)
// KB_KeyDown[sc_Pause] = 1; // KB_KeyDown[sc_Pause] = 1;
} }
void COMMON_doclearbackground(int numcols, int numrows);
void GAME_clearbackground(int numcols, int numrows) void GAME_clearbackground(int numcols, int numrows)
{
UNREFERENCED_PARAMETER(numcols);
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST && in3dmode())
{ {
int const i8n8 = OSD_SCALE(OSDCHAR_HEIGHT * numrows); int const i8n8 = OSD_SCALE(OSDCHAR_HEIGHT * numrows);
COMMON_doclearbackground(numcols, i8n8 + OSDCHAR_HEIGHT);
polymost_setFogEnabled(false);
polymost_useColorOnly(true);
polymostSet2dView();
glColor4f(0.f, 0.f, 0.f, 0.67f);
glEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glRecti(0, 0, xdim, i8n8+OSDCHAR_HEIGHT);
glColor4f(0.f, 0.f, 0.f, 1.f);
glRecti(0, i8n8+4, xdim, i8n8+OSDCHAR_HEIGHT);
polymost_useColorOnly(false);
if (!nofog)
polymost_setFogEnabled(true);
return;
}
#endif
CLEARLINES2D(0, min(ydim, OSD_SCALE(numrows * OSDCHAR_HEIGHT + OSDCHAR_HEIGHT)), editorcolors[16]);
} }
#undef OSD_SCALE #undef OSD_SCALE

View file

@ -151,35 +151,12 @@ void GAME_onshowosd(int32_t shown)
// KB_KeyDown[sc_Pause] = 1; // KB_KeyDown[sc_Pause] = 1;
} }
void GAME_clearbackground(int32_t numcols, int32_t numrows) void COMMON_doclearbackground(int numcols, int numrows);
void GAME_clearbackground(int numcols, int numrows)
{ {
UNREFERENCED_PARAMETER(numcols); int const i8n8 = OSD_SCALE(OSDCHAR_HEIGHT * numrows);
COMMON_doclearbackground(numcols, i8n8 + OSDCHAR_HEIGHT);
# ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST && in3dmode())
{
const int32_t i8n8 = OSD_SCALE(OSDCHAR_HEIGHT*numrows);
// glPushAttrib(GL_FOG_BIT);
polymost_setFogEnabled(false);
polymost_useColorOnly(true);
polymostSet2dView();
glColor4f(0.f, 0.f, 0.f, 0.67f);
glEnable(GL_BLEND);
glRecti(0, 0, xdim, i8n8+OSDCHAR_HEIGHT);
glColor4f(0.f, 0.f, 0.f, 1.f);
glRecti(0, i8n8+4, xdim, i8n8+OSDCHAR_HEIGHT);
polymost_useColorOnly(false);
if (!nofog)
polymost_setFogEnabled(true);
// glPopAttrib();
return;
}
# endif
CLEARLINES2D(0, min(ydim, OSD_SCALE(numrows*OSDCHAR_HEIGHT+OSDCHAR_HEIGHT)), editorcolors[16]);
} }
#undef OSD_SCALE #undef OSD_SCALE