Browse Source

Merge pull request #34 from FreeSlave/scoreboard_gs_fix

Use old API to draw scoreboard and motd lines in goldsource
asheep
Alibek Omarov 7 years ago committed by GitHub
parent
commit
c9c4c22438
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cl_dll/cdll_int.cpp
  2. 6
      cl_dll/cl_util.h
  3. 42
      cl_dll/hud_redraw.cpp
  4. 3
      cl_dll/input_mouse.cpp

5
cl_dll/cdll_int.cpp

@ -305,3 +305,8 @@ void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs ) @@ -305,3 +305,8 @@ void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs )
return;
gMobileEngfuncs = gpMobileEngfuncs;
}
bool isXashFWGS()
{
return gMobileEngfuncs != NULL;
}

6
cl_dll/cl_util.h

@ -15,7 +15,8 @@ @@ -15,7 +15,8 @@
//
// cl_util.h
//
#ifndef CL_UTIL_H
#define CL_UTIL_H
#include "exportdef.h"
#include "cvardef.h"
@ -179,3 +180,6 @@ inline void UnpackRGB( int &r, int &g, int &b, unsigned long ulRGB )\ @@ -179,3 +180,6 @@ inline void UnpackRGB( int &r, int &g, int &b, unsigned long ulRGB )\
}
HSPRITE LoadSprite( const char *pszName );
bool isXashFWGS();
#endif

42
cl_dll/hud_redraw.cpp

@ -235,29 +235,35 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, const char *szIt, int r, @@ -235,29 +235,35 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, const char *szIt, int r,
int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b )
{
// xash3d: reset unicode state
gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 );
// draw the string until we hit the null character or a newline character
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
if (isXashFWGS())
{
int w = gHUD.m_scrinfo.charWidths['M'];
if( xpos + w > iMaxX )
return xpos;
if( ( *szIt == '^' ) && ( *( szIt + 1 ) >= '0') && ( *( szIt + 1 ) <= '7') )
// xash3d: reset unicode state
gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 );
// draw the string until we hit the null character or a newline character
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
{
szIt++;
r = colors[*szIt - '0'][0];
g = colors[*szIt - '0'][1];
b = colors[*szIt - '0'][2];
if( !*(++szIt) )
int w = gHUD.m_scrinfo.charWidths['M'];
if( xpos + w > iMaxX )
return xpos;
if( ( *szIt == '^' ) && ( *( szIt + 1 ) >= '0') && ( *( szIt + 1 ) <= '7') )
{
szIt++;
r = colors[*szIt - '0'][0];
g = colors[*szIt - '0'][1];
b = colors[*szIt - '0'][2];
if( !*(++szIt) )
return xpos;
}
int c = (unsigned int)(unsigned char)*szIt;
xpos += gEngfuncs.pfnVGUI2DrawCharacterAdditive( xpos, ypos, c, r, g, b, 0 );
}
int c = (unsigned int)(unsigned char)*szIt;
xpos += gEngfuncs.pfnVGUI2DrawCharacterAdditive( xpos, ypos, c, r, g, b, 0 );
return xpos;
}
else
{
return gHUD.DrawHudString(xpos, ypos, iMaxX, szIt, r, g, b);
}
return xpos;
}
int CHud::DrawHudStringLen( const char *szIt )

3
cl_dll/input_mouse.cpp

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
#include "input_mouse.h"
#include "exportdef.h"
#include "hud.h"
#include "cl_util.h"
// shared between backends
Vector dead_viewangles(0, 0, 0);
@ -68,7 +69,7 @@ void IN_Shutdown( void ) @@ -68,7 +69,7 @@ void IN_Shutdown( void )
void IN_Init( void )
{
#ifdef SUPPORT_GOLDSOURCE_INPUT
if (gMobileEngfuncs) {
if (isXashFWGS()) {
gEngfuncs.Con_Printf( "FWGS Xash3D input is in use\n" );
currentInput = &fwgsInput;
} else {

Loading…
Cancel
Save