Moved client screen to C++
diff --git a/src/engine/API/cgame_api.h b/src/engine/API/cgame_api.h
index 6e02d71..d1a19c9 100644
--- a/src/engine/API/cgame_api.h
+++ b/src/engine/API/cgame_api.h
@@ -29,13 +29,6 @@
#ifndef __CG_API_H__
#define __CG_API_H__
-#ifndef __Q_SHARED_H__
-#include <qcommon/q_shared.h>
-#endif
-#ifndef __R_TYPES_H__
-#include <GPURenderer/r_types.h>
-#endif
-
#define CGAME_IMPORT_API_VERSION 5
#define CAM_PRIMARY 0
@@ -62,7 +55,6 @@ struct cgameImports_t
void( *AddCommand )( StringEntry cmdName, StringEntry cmdDesc );
void( *RemoveCommand )( StringEntry cmdName );
void( *SendClientCommand )( StringEntry s );
- void( *UpdateScreen )( void );
void( *GetCurrentSnapshotNumber )( S32* snapshotNumber, S32* serverTime );
S32( *MemoryRemaining )( void );
bool( *loadCamera )( S32 camNum, StringEntry name );
@@ -121,6 +113,7 @@ struct cgameImports_t
idCmdSystem* cmdSystem;
idSystem* idsystem;
idClientGUISystem* idGUISystem;
+ idClientScreenSystem* clientScreenSystem;
};
class idCGame
diff --git a/src/engine/API/clientScreen_api.h b/src/engine/API/clientScreen_api.h
new file mode 100644
index 0000000..b670f0b
--- /dev/null
+++ b/src/engine/API/clientScreen_api.h
@@ -0,0 +1,42 @@
+////////////////////////////////////////////////////////////////////////////////////////
+// Copyright(C) 2020 Dusan Jocic <dusanjocic@msn.com>
+//
+// This file is part of the OpenWolf GPL Source Code.
+// OpenWolf Source Code is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// OpenWolf Source Code is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with OpenWolf Source Code. If not, see <http://www.gnu.org/licenses/>.
+//
+// -------------------------------------------------------------------------------------
+// File name: clientScreen_api.h
+// Created:
+// Compilers: Microsoft Visual C++ 2019, gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
+// Description:
+// -------------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __CLIENTSCREEN_API_H__
+#define __CLIENTSCREEN_API_H__
+
+//
+// idClientScreenSystem
+//
+class idClientScreenSystem
+{
+public:
+
+ virtual void UpdateScreen( void ) = 0;
+};
+
+extern idClientScreenSystem* clientScreenSystem;
+
+#endif // !__CLIENTSCREEN_API_H__
+
diff --git a/src/engine/API/gui_api.h b/src/engine/API/gui_api.h
index b616469..9b4f7aa 100644
--- a/src/engine/API/gui_api.h
+++ b/src/engine/API/gui_api.h
@@ -29,16 +29,6 @@
#ifndef __GUI_PUBLIC_H__
#define __GUI_PUBLIC_H__
-#ifndef __Q_SHARED_H__
-#include <qcommon/q_shared.h>
-#endif
-#ifndef __R_TYPES_H__
-#include <GPURenderer/r_types.h>
-#endif
-#ifndef __CGAME_API__
-#include <API/cgame_api.h>
-#endif
-
#define UI_API_VERSION 1
typedef enum
@@ -191,7 +181,6 @@ struct guiImports_t
{
void( *Print )( StringEntry fmt, ... );
void( *Error )( S32 level, StringEntry fmt, ... );
- void( *UpdateScreen )( void );
void( *CheckAutoUpdate )( void );
void( *GetAutoUpdate )( void );
S32( *Parse_LoadSourceHandle )( StringEntry filename );
@@ -227,6 +216,7 @@ struct guiImports_t
idCGame* idcgame;
idClientLANSystem* idLANSystem;
idClientGUISystem* idGUISystem;
+ idClientScreenSystem* clientScreenSystem;
};
//
diff --git a/src/engine/client/cl_cin.cpp b/src/engine/client/cl_cin.cpp
index 77ac61c..0570087 100644
--- a/src/engine/client/cl_cin.cpp
+++ b/src/engine/client/cl_cin.cpp
@@ -1640,8 +1640,7 @@ void CIN_DrawCinematic( S32 handle )
w = cinTable[handle].width;
h = cinTable[handle].height;
buf = cinTable[handle].buf;
- SCR_AdjustFrom640( &x, &y, &w, &h );
-
+ idClientScreenSystemLocal::AdjustFrom640( &x, &y, &w, &h );
if( cinTable[handle].letterBox )
{
diff --git a/src/engine/client/cl_console.cpp b/src/engine/client/cl_console.cpp
index 90f7245..836d62a 100644
--- a/src/engine/client/cl_console.cpp
+++ b/src/engine/client/cl_console.cpp
@@ -79,8 +79,6 @@ convar_t* con_notifytime;
convar_t* con_autoclear;
// Color and alpha for console
-convar_t* scr_conUseShader;
-
convar_t* scr_conColorAlpha;
convar_t* scr_conColorRed;
convar_t* scr_conColorBlue;
@@ -94,7 +92,6 @@ convar_t* scr_conBarColorRed;
convar_t* scr_conBarColorBlue;
convar_t* scr_conBarColorGreen;
-convar_t* scr_conUseOld;
convar_t* scr_conBarSize;
convar_t* scr_conHeight;
@@ -545,14 +542,8 @@ void Con_CheckResize( void )
if( cls.glconfig.vidWidth )
{
- if( scr_conUseOld->integer )
- {
- width = cls.glconfig.vidWidth / SCR_ConsoleFontCharWidth( 'W' );
- }
- else
- {
- width = ( cls.glconfig.vidWidth - 30 ) / SCR_ConsoleFontCharWidth( 'W' );
- }
+ width = ( cls.glconfig.vidWidth - 30 ) / idClientScreenSystemLocal::ConsoleFontCharWidth( 'W' );
+
g_consoleField.widthInChars = width - Q_PrintStrlen( cl_consolePrompt->string ) - 1;
}
else
@@ -623,16 +614,11 @@ void Con_Init( void )
con_autoclear = cvarSystem->Get( "con_autoclear", "1", CVAR_ARCHIVE, "^1Toggles clearing of unfinished text after closing console." );
con_restricted = cvarSystem->Get( "con_restricted", "0", CVAR_INIT, "^1Toggles clearing of unfinished text after closing console." );
- // Defines cvar for color and alpha for console/bar under console
- scr_conUseShader = cvarSystem->Get( "scr_conUseShader", "0", CVAR_ARCHIVE, "^1Use console shader. " );
-
scr_conColorAlpha = cvarSystem->Get( "scr_conColorAlpha", "0.5", CVAR_ARCHIVE, "^1Defines the backgroud Alpha color of the console." );
scr_conColorRed = cvarSystem->Get( "scr_conColorRed", "0", CVAR_ARCHIVE, "^1Defines the backgroud Red color of the console." );
scr_conColorBlue = cvarSystem->Get( "scr_conColorBlue", "0.3", CVAR_ARCHIVE, "^1Defines the backgroud Blue color of the console." );
scr_conColorGreen = cvarSystem->Get( "scr_conColorGreen", "0.23", CVAR_ARCHIVE, "^1Defines the backgroud Green color of the console." );
- scr_conUseOld = cvarSystem->Get( "scr_conUseOld", "0", CVAR_ARCHIVE, "^1Use old console." );
-
scr_conBarHeight = cvarSystem->Get( "scr_conBarHeight", "2", CVAR_ARCHIVE, "^1Defines the bar height of the console." );
scr_conBarColorAlpha = cvarSystem->Get( "scr_conBarColorAlpha", "0.3", CVAR_ARCHIVE, "^1Defines the bar Alpha color of the console." );
@@ -870,19 +856,19 @@ void Con_DrawInput( void )
Com_RealTime( &realtime );
- y = con.vislines - ( SCR_ConsoleFontCharHeight() * 2 ) + 2 ;
+ y = con.vislines - ( idClientScreenSystemLocal::ConsoleFontCharHeight() * 2 ) + 2 ;
Com_sprintf( prompt, sizeof( prompt ), "^0[^3%02d%c%02d^0]^7 %s", realtime.tm_hour, ( realtime.tm_sec & 1 ) ? ':' : ' ', realtime.tm_min, cl_consolePrompt->string );
color[0] = 1.0f;
color[1] = 1.0f;
color[2] = 1.0f;
- color[3] = ( scr_conUseOld->integer ? 1.0f : con.displayFrac * 2.0f );
+ color[3] = con.displayFrac * 2.0f;
- SCR_DrawSmallStringExt( con.xadjust + cl_conXOffset->integer, y + 10, prompt, color, false, false );
+ idClientScreenSystemLocal::DrawSmallStringExt( con.xadjust + cl_conXOffset->integer, y + 10, prompt, color, false, false );
Q_CleanStr( prompt );
[... diff too long, it was truncated ...]
GitHub
sha: 9dd11ba1