From 471f720d95d5bd5559b6eaf5b7f7092bcc965017 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 4 Oct 2019 01:25:10 +0200 Subject: [PATCH] - consolidated console clear functions. --- source/build/src/common.cpp | 11 ++++++++--- source/duke3d/src/osdfuncs.cpp | 33 ++++----------------------------- source/rr/src/osdfuncs.cpp | 33 +++++---------------------------- 3 files changed, 17 insertions(+), 60 deletions(-) diff --git a/source/build/src/common.cpp b/source/build/src/common.cpp index c8332fdba..cbac3f54f 100644 --- a/source/build/src/common.cpp +++ b/source/build/src/common.cpp @@ -246,7 +246,7 @@ int32_t FindDistance3D(int32_t x, int32_t y, int32_t z) // Clear OSD background -void COMMON_clearbackground(int numcols, int numrows) +void COMMON_doclearbackground(int numcols, int height) { UNREFERENCED_PARAMETER(numcols); @@ -260,9 +260,9 @@ void COMMON_clearbackground(int numcols, int numrows) polymostSet2dView(); glColor4f(0.f, 0.f, 0.f, 0.67f); glEnable(GL_BLEND); - glRecti(0, 0, xdim, 8*numrows+8); + glRecti(0, 0, xdim, height); 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(); polymost_useColorOnly(false); @@ -274,3 +274,8 @@ void COMMON_clearbackground(int numcols, int numrows) CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]); } + +void COMMON_clearbackground(int numcols, int numrows) +{ + COMMON_doclearbackground(numcols, 8 * numrows + 8); +} diff --git a/source/duke3d/src/osdfuncs.cpp b/source/duke3d/src/osdfuncs.cpp index 293c147d4..8bfca65ab 100644 --- a/source/duke3d/src/osdfuncs.cpp +++ b/source/duke3d/src/osdfuncs.cpp @@ -140,37 +140,12 @@ void GAME_onshowosd(int shown) // KB_KeyDown[sc_Pause] = 1; } +void COMMON_doclearbackground(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); - - 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]); + int const i8n8 = OSD_SCALE(OSDCHAR_HEIGHT * numrows); + COMMON_doclearbackground(numcols, i8n8 + OSDCHAR_HEIGHT); } #undef OSD_SCALE diff --git a/source/rr/src/osdfuncs.cpp b/source/rr/src/osdfuncs.cpp index 4b1285fd2..b4e8a5efc 100644 --- a/source/rr/src/osdfuncs.cpp +++ b/source/rr/src/osdfuncs.cpp @@ -151,35 +151,12 @@ void GAME_onshowosd(int32_t shown) // 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); - -# 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]); + int const i8n8 = OSD_SCALE(OSDCHAR_HEIGHT * numrows); + COMMON_doclearbackground(numcols, i8n8 + OSDCHAR_HEIGHT); } #undef OSD_SCALE