From b7990e270d398a0ecd431cdbc37d37856e7f9e40 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 3 Jan 2017 00:49:22 +0300 Subject: [PATCH 01/14] Remove usage of MOVETYPE_COMPOUND to prevent crash --- dlls/crossbow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/crossbow.cpp b/dlls/crossbow.cpp index d34ad25d..63d2efac 100644 --- a/dlls/crossbow.cpp +++ b/dlls/crossbow.cpp @@ -168,8 +168,8 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) pev->nextthink = gpGlobals->time + 10.0; // g-cont. Setup movewith feature - pev->movetype = MOVETYPE_COMPOUND; // set movewith type - pev->aiment = ENT( pOther->pev ); // set parent + //pev->movetype = MOVETYPE_COMPOUND; // set movewith type + //pev->aiment = ENT( pOther->pev ); // set parent } if( UTIL_PointContents( pev->origin ) != CONTENTS_WATER ) From 56aa9f4a9c9ab7704af9dbaf1cb72acc5623c1a5 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 4 Jan 2017 22:05:21 +0300 Subject: [PATCH 02/14] Put MOVETYPE_COMPOUND usage under if --- dlls/crossbow.cpp | 10 +++++++--- dlls/world.cpp | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/crossbow.cpp b/dlls/crossbow.cpp index 63d2efac..45fd922c 100644 --- a/dlls/crossbow.cpp +++ b/dlls/crossbow.cpp @@ -27,6 +27,8 @@ #define BOLT_AIR_VELOCITY 2000 #define BOLT_WATER_VELOCITY 1000 +extern BOOL gPhysicsInterfaceInitialized; + // UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS() // // OVERLOADS SOME ENTVARS: @@ -167,9 +169,11 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) pev->angles.z = RANDOM_LONG( 0, 360 ); pev->nextthink = gpGlobals->time + 10.0; - // g-cont. Setup movewith feature - //pev->movetype = MOVETYPE_COMPOUND; // set movewith type - //pev->aiment = ENT( pOther->pev ); // set parent + if (gPhysicsInterfaceInitialized) { + // g-cont. Setup movewith feature + pev->movetype = MOVETYPE_COMPOUND; // set movewith type + pev->aiment = ENT( pOther->pev ); // set parent + } } if( UTIL_PointContents( pev->origin ) != CONTENTS_WATER ) diff --git a/dlls/world.cpp b/dlls/world.cpp index fe119919..a065b5be 100644 --- a/dlls/world.cpp +++ b/dlls/world.cpp @@ -822,6 +822,8 @@ static physics_interface_t gPhysicsInterface = DispatchPhysicsEntity, }; +BOOL gPhysicsInterfaceInitialized = FALSE; + int Server_GetPhysicsInterface( int iVersion, server_physics_api_t *pfuncsFromEngine, physics_interface_t *pFunctionTable ) { if( !pFunctionTable || !pfuncsFromEngine || iVersion != SV_PHYSICS_INTERFACE_VERSION ) @@ -834,6 +836,6 @@ int Server_GetPhysicsInterface( int iVersion, server_physics_api_t *pfuncsFromEn // fill engine callbacks memcpy( pFunctionTable, &gPhysicsInterface, sizeof(physics_interface_t) ); - + gPhysicsInterfaceInitialized = TRUE; return TRUE; } From 02532a478bfa63b6abdbbaf6c62e385ec8ba4eef Mon Sep 17 00:00:00 2001 From: mittorn Date: Tue, 10 Jan 2017 16:09:44 +0700 Subject: [PATCH 03/14] Fix visual studio server build --- dlls/effects.cpp | 4 ++-- dlls/nodes.cpp | 2 ++ dlls/weapons.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/effects.cpp b/dlls/effects.cpp index e9492dd6..ecc04a19 100644 --- a/dlls/effects.cpp +++ b/dlls/effects.cpp @@ -410,7 +410,7 @@ LINK_ENTITY_TO_CLASS( trip_beam, CTripBeam ) void CTripBeam::Spawn( void ) { CLightning::Spawn(); - SetTouch( &TriggerTouch ); + SetTouch( &CLightning::TriggerTouch ); pev->solid = SOLID_TRIGGER; RelinkBeam(); } @@ -1267,7 +1267,7 @@ void CSprite::TurnOn( void ) pev->effects = 0; if( ( pev->framerate && m_maxFrame > 1.0 ) || ( pev->spawnflags & SF_SPRITE_ONCE ) ) { - SetThink( &CSprite::CSprite::AnimateThink ); + SetThink( &CSprite::AnimateThink ); pev->nextthink = gpGlobals->time; m_lastTime = gpGlobals->time; } diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index ed4b4033..a97b6a80 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -45,6 +45,8 @@ LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt ) #include #include #define CreateDirectory(p, n) mkdir(p, 0777) +#else +#define CreateDirectory(p, n) CreateDirectoryA(p, n) #endif //========================================================= diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 3e2ef386..ff03bbfc 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -1080,7 +1080,7 @@ void CBasePlayerAmmo::DefaultTouch( CBaseEntity *pOther ) //========================================================= int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { - int iReturn; + int iReturn = 0; if( pszAmmo1() != NULL ) { From 5da21e38d23be01669fade2747425dcc8692e0e9 Mon Sep 17 00:00:00 2001 From: mittorn Date: Tue, 10 Jan 2017 16:45:52 +0700 Subject: [PATCH 04/14] Fix client visual studio build --- cl_dll/hud_spectator.cpp | 2 +- cl_dll/input_xash3d.cpp | 2 +- cl_dll/util.cpp | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cl_dll/hud_spectator.cpp b/cl_dll/hud_spectator.cpp index 91e8fa37..ff6eb8ff 100644 --- a/cl_dll/hud_spectator.cpp +++ b/cl_dll/hud_spectator.cpp @@ -993,7 +993,7 @@ void CHudSpectator::DrawOverviewLayer() if ( hasMapImage) { i = m_MapSprite->numframes / (4*3); - i = sqrt(i); + i = sqrt(float(i)); xTiles = i*4; yTiles = i*3; } diff --git a/cl_dll/input_xash3d.cpp b/cl_dll/input_xash3d.cpp index 033af962..63cdfbeb 100644 --- a/cl_dll/input_xash3d.cpp +++ b/cl_dll/input_xash3d.cpp @@ -54,7 +54,7 @@ float rel_pitch; #define IMPULSE_DOWN 2 #define IMPULSE_UP 4 -bool CL_IsDead(); +int CL_IsDead( void ); Vector dead_viewangles(0, 0, 0); void IN_ToggleButtons( float forwardmove, float sidemove ) diff --git a/cl_dll/util.cpp b/cl_dll/util.cpp index 52dc2f61..655bde64 100644 --- a/cl_dll/util.cpp +++ b/cl_dll/util.cpp @@ -32,6 +32,10 @@ extern vec3_t vec3_origin; +#ifdef _MSC_VER +vec3_t vec3_origin; +#endif + double sqrt( double x ); float Length( const float *v ) From a9f2549c5785582bb08e0f6d76aeba48f23c68f4 Mon Sep 17 00:00:00 2001 From: mittorn Date: Wed, 1 Feb 2017 14:11:06 +0000 Subject: [PATCH 05/14] Add aggregate-return hack for mingw --- pm_shared/pm_defs.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index 70b8369d..d29bff19 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -194,7 +194,12 @@ typedef struct playermove_s int (*PM_PointContents)( float *p, int *truecontents /*filled in if this is non-null*/ ); int (*PM_TruePointContents)( float *p ); int (*PM_HullPointContents)( struct hull_s *hull, int num, float *p ); +#ifdef __MINGW32__ + pmtrace_t *(*PM_PlayerTrace_real)( pmtrace_t * retvalue, float *start, float *end, int traceFlags, int ignore_pe ); + +#else pmtrace_t (*PM_PlayerTrace)( float *start, float *end, int traceFlags, int ignore_pe ); +#endif struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehulll, int ignore_pe ); long (*RandomLong)( long lLow, long lHigh ); float (*RandomFloat)( float flLow, float flHigh ); @@ -213,9 +218,32 @@ typedef struct playermove_s void (*PM_PlaySound)( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ); const char *(*PM_TraceTexture)( int ground, float *vstart, float *vend ); void (*PM_PlaybackEventFull)( int flags, int clientindex, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); +#ifdef __MINGW32__ + pmtrace_t *(*PM_PlayerTraceEx_real) (pmtrace_t *retvalue, float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe )); +#else pmtrace_t (*PM_PlayerTraceEx) (float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe )); +#endif int (*PM_TestPlayerPositionEx) (float *pos, pmtrace_t *ptrace, int (*pfnIgnore)( physent_t *pe )); struct pmtrace_s *(*PM_TraceLineEx)( float *start, float *end, int flags, int usehulll, int (*pfnIgnore)( physent_t *pe )); struct msurface_s *(*PM_TraceSurface)( int ground, float *vstart, float *vend ); } playermove_t; + +#ifdef __MINGW32__ +static pmtrace_t _pm_globalresult, _pm_globaltmp; + static inline pmtrace_t PM_PlayerTrace_wrap( float *start, float *end, int traceFlags, int ignore_pe, playermove_t *pmove ) + { + _pm_globaltmp = pmove->touchindex[MAX_PHYSENTS -1]; + pmove->PM_PlayerTrace_real( &_pm_globalresult, start, end, traceFlags, ignore_pe ); + return _pm_globalresult; + } + static inline pmtrace_t PM_PlayerTraceEx_wrap( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), playermove_t *pmove ) + { + _pm_globaltmp = pmove->touchindex[MAX_PHYSENTS -1]; + pmove->PM_PlayerTraceEx_real( &_pm_globalresult, start, end, traceFlags, pfnIgnore ); + return _pm_globalresult; + } +#define PM_PlayerTrace(a,b,c,d) touchindex[MAX_PHYSENTS -1] = PM_PlayerTrace_wrap( a, b, c, d, pmove );pmove->touchindex[MAX_PHYSENTS -1] = _pm_globaltmp +#define PM_PlayerTraceEx(a,b,c,d) touchindex[MAX_PHYSENTS -1] = PM_PlayerTraceEx_wrap( a, b, c, d, pmove );pmove->touchindex[MAX_PHYSENTS -1] = _pm_globaltmp +#endif + #endif//PM_DEFS_H From 80593d29bdde8c8afa7e1f66a44505d5dc3f0fbe Mon Sep 17 00:00:00 2001 From: mittorn Date: Wed, 1 Feb 2017 14:55:40 +0000 Subject: [PATCH 06/14] Apply fixes from gravgun branch --- cl_dll/MOTD.cpp | 2 +- cl_dll/hl/hl_weapons.cpp | 2 +- cl_dll/message.cpp | 2 +- dlls/mpstubb.cpp | 2 +- dlls/stats.cpp | 2 +- engine/cdll_int.h | 8 +++++++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp index 4273b0bf..6ab3a161 100644 --- a/cl_dll/MOTD.cpp +++ b/cl_dll/MOTD.cpp @@ -130,7 +130,7 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ) BEGIN_READ( pbuf, iSize ); int is_finished = READ_BYTE(); - strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) ); + strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - 1 ); if( is_finished ) { diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 5a17e858..6d555b4c 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -288,7 +288,7 @@ Only produces random numbers to match the server ones. */ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker, int shared_rand ) { - float x, y, z; + float x = 0, y = 0, z; for( ULONG iShot = 1; iShot <= cShots; iShot++ ) { diff --git a/cl_dll/message.cpp b/cl_dll/message.cpp index a9c706ec..5d52d413 100644 --- a/cl_dll/message.cpp +++ b/cl_dll/message.cpp @@ -310,7 +310,7 @@ int CHudMessage::Draw( float fTime ) { int i, drawn; client_textmessage_t *pMessage; - float endTime; + float endTime = 0; drawn = 0; diff --git a/dlls/mpstubb.cpp b/dlls/mpstubb.cpp index 3cc2e5c2..703a4dba 100644 --- a/dlls/mpstubb.cpp +++ b/dlls/mpstubb.cpp @@ -74,7 +74,7 @@ void CBaseMonster::MonsterInitDead( void ) // Setup health counters, etc. BecomeDead(); - SetThink( &CorpseFallThink ); + SetThink( &CBaseMonster::CorpseFallThink ); pev->nextthink = gpGlobals->time + 0.5; } diff --git a/dlls/stats.cpp b/dlls/stats.cpp index 038e1667..9b21f792 100644 --- a/dlls/stats.cpp +++ b/dlls/stats.cpp @@ -15,7 +15,7 @@ #include "weapons.h" #include "soundent.h" #include "monsters.h" -#include "..\engine\shake.h" +#include "../engine/shake.h" #include "decals.h" #include "gamerules.h" diff --git a/engine/cdll_int.h b/engine/cdll_int.h index b77a174a..eaa7f4e8 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -93,6 +93,12 @@ typedef struct client_textmessage_s const char *pMessage; } client_textmessage_t; +#if __MSC_VER == 1200 +#define ulonglong_t __int64 +#else +#define ulonglong_t unsigned long long +#endif + typedef struct hud_player_info_s { char *name; @@ -106,7 +112,7 @@ typedef struct hud_player_info_s short topcolor; short bottomcolor; - unsigned long long m_nSteamID; + ulonglong_t m_nSteamID; } hud_player_info_t; typedef struct cl_enginefuncs_s From 617d75545f2ecb9b2d46cc30728dc37c9eb6d35e Mon Sep 17 00:00:00 2001 From: mittorn Date: Thu, 9 Feb 2017 22:30:11 +0600 Subject: [PATCH 07/14] Fix unaligned access when built by clang --- dlls/util.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/util.cpp b/dlls/util.cpp index 47eaf2f8..9be35472 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -2228,22 +2228,22 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou *( (EOFFSET *)pOutputData ) = 0; break; case FIELD_VECTOR: + #ifdef __VFP_FP__ + memcpy( pOutputData, pInputData, sizeof( Vector ) ); + #else ( (float *)pOutputData )[0] = ( (float *)pInputData )[0]; ( (float *)pOutputData )[1] = ( (float *)pInputData )[1]; ( (float *)pOutputData )[2] = ( (float *)pInputData )[2]; + #endif break; case FIELD_POSITION_VECTOR: #ifdef __VFP_FP__ - float tmp; - memcpy( &tmp, (char *)pInputData + 0, 4 ); - tmp += position.x; - memcpy( (char *)pOutputData + 0, &tmp, 4 ); - memcpy( &tmp, (char *)pInputData + 4, 4 ); - tmp += position.y; - memcpy( (char *)pOutputData + 4, &tmp, 4 ); - memcpy( &tmp, (char *)pInputData + 8, 4 ); - tmp += position.z; - memcpy( (char *)pOutputData + 8, &tmp, 4 ); + { + Vector tmp; + memcpy( &tmp, pInputData, sizeof( Vector ) ); + tmp += position; + memcpy( pOutputData, &tmp, sizeof( Vector ) ); + } #else ( (float *)pOutputData )[0] = ( (float *)pInputData )[0] + position.x; ( (float *)pOutputData )[1] = ( (float *)pInputData )[1] + position.y; From 55a3ab741adf617aec3ae4968238a8697e58159d Mon Sep 17 00:00:00 2001 From: mittorn Date: Thu, 9 Feb 2017 22:46:48 +0600 Subject: [PATCH 08/14] Fix build --- dlls/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/util.cpp b/dlls/util.cpp index 9be35472..d1fceb0a 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -2241,7 +2241,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou { Vector tmp; memcpy( &tmp, pInputData, sizeof( Vector ) ); - tmp += position; + tmp = tmp + position; memcpy( pOutputData, &tmp, sizeof( Vector ) ); } #else From e099224bc5948dd604632f1602017b99cb29cc90 Mon Sep 17 00:00:00 2001 From: mittorn Date: Wed, 29 Mar 2017 19:59:50 +0000 Subject: [PATCH 09/14] Use vgui2 functions for utf-8 print --- cl_dll/MOTD.cpp | 2 +- cl_dll/cl_util.h | 2 ++ cl_dll/hud_redraw.cpp | 29 +++++++++++++++++++++++++++++ cl_dll/scoreboard.cpp | 24 ++++++++++++------------ 4 files changed, 44 insertions(+), 13 deletions(-) diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp index 6ab3a161..179ae4a8 100644 --- a/cl_dll/MOTD.cpp +++ b/cl_dll/MOTD.cpp @@ -103,7 +103,7 @@ int CHudMOTD::Draw( float fTime ) // find where to start drawing the line if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) ) - gHUD.DrawHudString( xpos, ypos, xmax, ch, 255, 180, 0 ); + DrawUtfString( xpos, ypos, xmax, ch, 255, 180, 0 ); ypos += LINE_HEIGHT; diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index 84488050..54dcede0 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -115,6 +115,8 @@ inline void GetConsoleStringSize( const char *string, int *width, int *height ) gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height ); } +int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b ); + inline int ConsoleStringLen( const char *string ) { int _width = 0, _height = 0; diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index aed98455..b5314961 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -226,6 +226,35 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g return xpos; } + + +int DrawUtfString( int xpos, int ypos, int iMaxX, 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++ ) + { + 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 ); + } + + return xpos; +} + int CHud::DrawHudStringLen( char *szIt ) { int l = 0; diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index 2e0722f9..3a780baf 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -146,18 +146,18 @@ int CHudScoreboard::Draw( float fTime ) FAR_RIGHT += 5; gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX ); if( !gHUD.m_Teamplay ) - gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 ); + DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 ); else - gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 ); + DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 ); gHUD.DrawHudStringReverse( KILLS_RANGE_MAX + xpos_rel, ypos, 0, "kills", 255, 140, 0 ); - gHUD.DrawHudString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 ); - gHUD.DrawHudString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 ); - gHUD.DrawHudString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 ); + DrawUtfString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 ); + DrawUtfString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 ); + DrawUtfString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 ); if( can_show_packetloss ) { - gHUD.DrawHudString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 ); + DrawUtfString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 ); } list_slot += 1.2; @@ -272,7 +272,7 @@ int CHudScoreboard::Draw( float fTime ) } // draw their name (left to right) - gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b ); + DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b ); // draw kills (right to left) xpos = KILLS_RANGE_MAX + xpos_rel; @@ -280,7 +280,7 @@ int CHudScoreboard::Draw( float fTime ) // draw divider xpos = DIVIDER_POS + xpos_rel; - gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b ); + DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b ); // draw deaths xpos = DEATHS_RANGE_MAX + xpos_rel; @@ -300,7 +300,7 @@ int CHudScoreboard::Draw( float fTime ) xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2) + PL_RANGE_MIN + xpos_rel + 25; sprintf( buf, " %d", team_info->packetloss ); - gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b ); + DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b ); } team_info->already_drawn = TRUE; // set the already_drawn to be TRUE, so this team won't get drawn again @@ -400,7 +400,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, } // draw their name (left to right) - gHUD.DrawHudString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b ); + DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b ); // draw kills (right to left) xpos = KILLS_RANGE_MAX + xpos_rel; @@ -408,7 +408,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, // draw divider xpos = DIVIDER_POS + xpos_rel; - gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b ); + DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b ); // draw deaths xpos = DEATHS_RANGE_MAX + xpos_rel; @@ -435,7 +435,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2 ) + PL_RANGE_MIN + xpos_rel + 25; - gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b ); + DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b ); } pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again From 409848b80fd02893f6eb34cd97e18cd93c2ada04 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 3 Apr 2017 21:16:25 +0500 Subject: [PATCH 10/14] Do not break menuselect behavior. --- dlls/client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index 21e5d810..5fb7c221 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -466,10 +466,10 @@ void ClientCommand( edict_t *pEntity ) edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot( pPlayer ); pPlayer->StartObserver( pev->origin, VARS( pentSpawnSpot )->angles ); } - /*else if( g_pGameRules->ClientCommand( GetClassPtr( (CBasePlayer *)pev ), pcmd ) ) + else if( g_pGameRules->ClientCommand( GetClassPtr( (CBasePlayer *)pev ), pcmd ) ) { // MenuSelect returns true only if the command is properly handled, so don't print a warning - }*/ + } else if( FStrEq( pcmd, "VModEnable" ) ) { // clear 'Unknown command: VModEnable' in singleplayer From 4fbb070e7d59c8dc660f5895ba8470fe869cd49a Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 4 Apr 2017 01:15:16 +0500 Subject: [PATCH 11/14] Implement cl_scoreboard_bg cvar. --- cl_dll/scoreboard.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index 3a780baf..507e0415 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -26,6 +26,7 @@ #include #include +cvar_t *cl_scoreboard_bg; cvar_t *cl_showpacketloss; hud_player_info_t g_PlayerInfoList[MAX_PLAYERS + 1]; // player info from the engine extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS + 1]; // additional player info sent directly to the client dll @@ -59,6 +60,7 @@ int CHudScoreboard::Init( void ) InitHUDData(); + cl_scoreboard_bg = CVAR_CREATE( "cl_scoreboard_bg", "1", 0 ); cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE ); return 1; @@ -144,7 +146,8 @@ int CHudScoreboard::Draw( float fTime ) FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX; FAR_RIGHT += 5; - gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX ); + if( cl_scoreboard_bg && cl_scoreboard_bg->value ) + gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX ); if( !gHUD.m_Teamplay ) DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 ); else From 6f8d64df898ba58f1d5c3cd6f81951f38d6f74dd Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 4 Apr 2017 01:43:21 +0500 Subject: [PATCH 12/14] Make cl_scoreboard_bg cvar archive. --- cl_dll/scoreboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index 507e0415..b20e316c 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -60,7 +60,7 @@ int CHudScoreboard::Init( void ) InitHUDData(); - cl_scoreboard_bg = CVAR_CREATE( "cl_scoreboard_bg", "1", 0 ); + cl_scoreboard_bg = CVAR_CREATE( "cl_scoreboard_bg", "1", FCVAR_ARCHIVE ); cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE ); return 1; From 8163bced2c29e22629b3c3c3541d131fed00bfdf Mon Sep 17 00:00:00 2001 From: Night Owl Date: Wed, 12 Apr 2017 02:02:18 +0500 Subject: [PATCH 13/14] Do not break hud_takesshots cvar behavior. --- cl_dll/hud_redraw.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index b5314961..c30df36d 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -93,6 +93,13 @@ int CHud::Redraw( float flTime, int intermission ) if( m_flTimeDelta < 0 ) m_flTimeDelta = 0; + if( !m_iIntermission && intermission ) + { + // Take a screenshot if the client's got the cvar set + if( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 ) + m_flShotTime = flTime + 1.0; // Take a screenshot in a second + } + if( m_flShotTime && m_flShotTime < flTime ) { gEngfuncs.pfnClientCmd( "snapshot\n" ); From fc276ad52f51ec128352ac680ef9cbac038e6b23 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Fri, 16 Jun 2017 19:18:24 +0500 Subject: [PATCH 14/14] Do not use -frtti flag. --- dlls/Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/Android.mk b/dlls/Android.mk index 7f107a12..7fcdf581 100644 --- a/dlls/Android.mk +++ b/dlls/Android.mk @@ -16,7 +16,7 @@ endif LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \ -fno-exceptions -DNO_VOICEGAMEMGR -w -LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) -frtti +LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) LOCAL_C_INCLUDES := $(SDL_PATH)/include \ $(LOCAL_PATH)/. \