From 8acf608b4d0fe0498f6037e1bfbdc1628254f656 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Fri, 4 Aug 2023 13:57:30 +0300 Subject: [PATCH 01/13] engine: optimize traces --- engine/cmodel.cpp | 28 ++++++++++++++-------------- engine/cmodel_private.h | 14 +++++++------- engine/gl_rsurf.cpp | 2 +- engine/spatialpartition.cpp | 14 +++++++------- public/mathlib/mathlib.h | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/engine/cmodel.cpp b/engine/cmodel.cpp index e241aa77..373eea3a 100644 --- a/engine/cmodel.cpp +++ b/engine/cmodel.cpp @@ -873,9 +873,9 @@ bool IntersectRayWithBoxBrush( TraceInfo_t *pTraceInfo, const cbrush_t *pBrush, FPExceptionDisabler hideExceptions; // Load the unaligned ray/box parameters into SIMD registers - fltx4 start = LoadUnaligned3SIMD(pTraceInfo->m_start.Base()); - fltx4 extents = LoadUnaligned3SIMD(pTraceInfo->m_extents.Base()); - fltx4 delta = LoadUnaligned3SIMD(pTraceInfo->m_delta.Base()); + fltx4 start = LoadAlignedSIMD(pTraceInfo->m_start.Base()); + fltx4 extents = LoadAlignedSIMD(pTraceInfo->m_extents.Base()); + fltx4 delta = LoadAlignedSIMD(pTraceInfo->m_delta.Base()); fltx4 boxMins = LoadAlignedSIMD( pBox->mins.Base() ); fltx4 boxMaxs = LoadAlignedSIMD( pBox->maxs.Base() ); @@ -899,7 +899,7 @@ bool IntersectRayWithBoxBrush( TraceInfo_t *pTraceInfo, const cbrush_t *pBrush, fltx4 crossPlane = OrSIMD(XorSIMD(startOutMins,endOutMins), XorSIMD(startOutMaxs,endOutMaxs)); // now build the per-axis interval of t for intersections - fltx4 invDelta = LoadUnaligned3SIMD(pTraceInfo->m_invDelta.Base()); + fltx4 invDelta = LoadAlignedSIMD(pTraceInfo->m_invDelta.Base()); fltx4 tmins = MulSIMD( offsetMinsExpanded, invDelta ); fltx4 tmaxs = MulSIMD( offsetMaxsExpanded, invDelta ); // now sort the interval per axis @@ -1037,9 +1037,9 @@ bool IntersectRayWithBox( const Ray_t &ray, const VectorAligned &inInvDelta, con pTrace->fraction = 1.0f; // Load the unaligned ray/box parameters into SIMD registers - fltx4 start = LoadUnaligned3SIMD(ray.m_Start.Base()); - fltx4 extents = LoadUnaligned3SIMD(ray.m_Extents.Base()); - fltx4 delta = LoadUnaligned3SIMD(ray.m_Delta.Base()); + fltx4 start = LoadAlignedSIMD(ray.m_Start.Base()); + fltx4 extents = LoadAlignedSIMD(ray.m_Extents.Base()); + fltx4 delta = LoadAlignedSIMD(ray.m_Delta.Base()); fltx4 boxMins = LoadAlignedSIMD( inBoxMins.Base() ); fltx4 boxMaxs = LoadAlignedSIMD( inBoxMaxs.Base() ); @@ -1372,9 +1372,9 @@ void FASTCALL CM_ClipBoxToBrush( TraceInfo_t * RESTRICT pTraceInfo, const cbrush inline bool IsTraceBoxIntersectingBoxBrush( TraceInfo_t *pTraceInfo, cboxbrush_t *pBox ) { - fltx4 start = LoadUnaligned3SIMD(pTraceInfo->m_start.Base()); - fltx4 mins = LoadUnaligned3SIMD(pTraceInfo->m_mins.Base()); - fltx4 maxs = LoadUnaligned3SIMD(pTraceInfo->m_maxs.Base()); + fltx4 start = LoadAlignedSIMD(pTraceInfo->m_start.Base()); + fltx4 mins = LoadAlignedSIMD(pTraceInfo->m_mins.Base()); + fltx4 maxs = LoadAlignedSIMD(pTraceInfo->m_maxs.Base()); fltx4 boxMins = LoadAlignedSIMD( pBox->mins.Base() ); fltx4 boxMaxs = LoadAlignedSIMD( pBox->maxs.Base() ); @@ -1569,15 +1569,15 @@ void FASTCALL CM_TraceToLeaf( TraceInfo_t * RESTRICT pTraceInfo, int ndxLeaf, fl if (IsX360()) { // set up some relatively constant variables we'll use in the loop below - fltx4 traceStart = LoadUnaligned3SIMD(pTraceInfo->m_start.Base()); - fltx4 traceDelta = LoadUnaligned3SIMD(pTraceInfo->m_delta.Base()); - fltx4 traceInvDelta = LoadUnaligned3SIMD(pTraceInfo->m_invDelta.Base()); + fltx4 traceStart = LoadAlignedSIMD(pTraceInfo->m_start.Base()); + fltx4 traceDelta = LoadAlignedSIMD(pTraceInfo->m_delta.Base()); + fltx4 traceInvDelta = LoadAlignedSIMD(pTraceInfo->m_invDelta.Base()); static const fltx4 vecEpsilon = {DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON}; // only used in !IS_POINT version: fltx4 extents; if (!IS_POINT) { - extents = LoadUnaligned3SIMD(pTraceInfo->m_extents.Base()); + extents = LoadAlignedSIMD(pTraceInfo->m_extents.Base()); } // TODO: this loop probably ought to be unrolled so that we can make a more efficient diff --git a/engine/cmodel_private.h b/engine/cmodel_private.h index 3f712a37..5bf52eee 100644 --- a/engine/cmodel_private.h +++ b/engine/cmodel_private.h @@ -42,13 +42,13 @@ struct TraceInfo_t m_nCheckDepth = -1; } - Vector m_start; - Vector m_end; - Vector m_mins; - Vector m_maxs; - Vector m_extents; - Vector m_delta; - Vector m_invDelta; + VectorAligned m_start; + VectorAligned m_end; + VectorAligned m_mins; + VectorAligned m_maxs; + VectorAligned m_extents; + VectorAligned m_delta; + VectorAligned m_invDelta; trace_t m_trace; trace_t m_stabTrace; diff --git a/engine/gl_rsurf.cpp b/engine/gl_rsurf.cpp index 5731704c..de87c60b 100644 --- a/engine/gl_rsurf.cpp +++ b/engine/gl_rsurf.cpp @@ -4934,7 +4934,7 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_ */ // take advantage of high throughput/high latency - fltx4 planeNormal = LoadUnaligned3SIMD( plane->normal.Base() ); + fltx4 planeNormal = LoadAlignedSIMD( plane->normal.Base() ); fltx4 vecBoxMin = LoadAlignedSIMD(pInfo->m_vecBoxMin); fltx4 vecBoxMax = LoadAlignedSIMD(pInfo->m_vecBoxMax); fltx4 cornermin, cornermax; diff --git a/engine/spatialpartition.cpp b/engine/spatialpartition.cpp index aaeeb62d..4c2047cc 100644 --- a/engine/spatialpartition.cpp +++ b/engine/spatialpartition.cpp @@ -987,7 +987,7 @@ private: int m_iTree; }; - +/* class CIntersectPoint : public CPartitionVisitor { public: @@ -1009,7 +1009,7 @@ public: private: fltx4 m_f4Point; }; - +*/ class CIntersectBox : public CPartitionVisitor { @@ -1040,8 +1040,8 @@ class CIntersectRay : public CPartitionVisitor public: CIntersectRay( CVoxelTree *pPartition, const Ray_t &ray, const Vector &vecInvDelta ) : CPartitionVisitor( pPartition ) { - m_f4Start = LoadUnaligned3SIMD( ray.m_Start.Base() ); - m_f4Delta = LoadUnaligned3SIMD( ray.m_Delta.Base() ); + m_f4Start = LoadAlignedSIMD( ray.m_Start.Base() ); + m_f4Delta = LoadAlignedSIMD( ray.m_Delta.Base() ); m_f4InvDelta = LoadUnaligned3SIMD( vecInvDelta.Base() ); } @@ -1069,10 +1069,10 @@ class CIntersectSweptBox : public CPartitionVisitor public: CIntersectSweptBox( CVoxelTree *pPartition, const Ray_t &ray, const Vector &vecInvDelta ) : CPartitionVisitor( pPartition ) { - m_f4Start = LoadUnaligned3SIMD( ray.m_Start.Base() ); - m_f4Delta = LoadUnaligned3SIMD( ray.m_Delta.Base() ); + m_f4Start = LoadAlignedSIMD( ray.m_Start.Base() ); + m_f4Delta = LoadAlignedSIMD( ray.m_Delta.Base() ); + m_f4Extents = LoadAlignedSIMD( ray.m_Extents.Base() ); m_f4InvDelta = LoadUnaligned3SIMD( vecInvDelta.Base() ); - m_f4Extents = LoadUnaligned3SIMD( ray.m_Extents.Base() ); } bool Intersects( const float *pMins, const float *pMaxs ) const diff --git a/public/mathlib/mathlib.h b/public/mathlib/mathlib.h index 1e8e0266..6503da0f 100644 --- a/public/mathlib/mathlib.h +++ b/public/mathlib/mathlib.h @@ -114,7 +114,7 @@ inline T clamp( T const &val, T const &minVal, T const &maxVal ) // FIXME: this should move to a different file struct cplane_t { - Vector normal; + VectorAligned normal; float dist; byte type; // for fast side tests byte signbits; // signx + (signy<<1) + (signz<<1) From b6cb0c2696961e9694f84399a32d43063fd1dc4e Mon Sep 17 00:00:00 2001 From: nillerusr Date: Fri, 4 Aug 2023 14:55:13 +0300 Subject: [PATCH 02/13] game: fix UB when reading mapcycle --- game/shared/multiplay_gamerules.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/game/shared/multiplay_gamerules.cpp b/game/shared/multiplay_gamerules.cpp index abecba9e..c380aac7 100644 --- a/game/shared/multiplay_gamerules.cpp +++ b/game/shared/multiplay_gamerules.cpp @@ -1151,12 +1151,14 @@ ConVarRef suitcharger( "sk_suitcharger" ); void StripChar(char *szBuffer, const char cWhiteSpace ) { + char *src, *dst; - while ( char *pSpace = strchr( szBuffer, cWhiteSpace ) ) + for (src = dst = szBuffer; *src != '\0'; src++) { - char *pNextChar = pSpace + sizeof(char); - V_strcpy( pSpace, pNextChar ); + *dst = *src; + if (*dst != cWhiteSpace) dst++; } + *dst = '\0'; } void CMultiplayRules::GetNextLevelName( char *pszNextMap, int bufsize, bool bRandom /* = false */ ) From 3d0025b594298e517f9a90402e706c4a4841100f Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 14 Aug 2023 16:33:34 +0300 Subject: [PATCH 03/13] vtf: fix vtf header padding --- public/vtf/vtf.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/public/vtf/vtf.h b/public/vtf/vtf.h index 6cb2e79e..436468fe 100644 --- a/public/vtf/vtf.h +++ b/public/vtf/vtf.h @@ -471,14 +471,11 @@ struct VTFFileHeaderV7_1_t : public VTFFileBaseHeader_t unsigned int flags; unsigned short numFrames; unsigned short startFrame; -#if !defined( POSIX ) && !defined( _X360 ) - VectorAligned reflectivity; -#else + // must manually align in order to maintain pack(1) expected layout with existing binaries - char pad1[4]; - Vector reflectivity; - char pad2[4]; -#endif + char pad1[4]; + VectorAligned reflectivity; + float bumpScale; ImageFormat imageFormat; unsigned char numMipLevels; From 7f267853f4529fba0a19855dc2a741496c89867a Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 14 Aug 2023 18:26:28 +0300 Subject: [PATCH 04/13] vtf: fix vtf loading for windows arm( and for other platforms ) --- public/vtf/vtf.h | 86 ++++++++++++++++++++++++++++++++++-------------- vtf/vtf.cpp | 55 +++++++++++++++++++++---------- 2 files changed, 98 insertions(+), 43 deletions(-) diff --git a/public/vtf/vtf.h b/public/vtf/vtf.h index 436468fe..977d79df 100644 --- a/public/vtf/vtf.h +++ b/public/vtf/vtf.h @@ -455,7 +455,9 @@ bool GetVTFPreload360Data( const char *pDebugName, CUtlBuffer &fileBufferIn, CUt // compiler pads, the 360 compiler does NOT. //----------------------------------------------------------------------------- -struct VTFFileBaseHeader_t +// nillerusr: try to avoid problems with pragma pack, remove c++ inheritance to make this structs platform-independent + +struct alignas(16) VTFFileBaseHeader_t { DECLARE_BYTESWAP_DATADESC(); char fileTypeString[4]; // "VTF" Valve texture file @@ -463,9 +465,13 @@ struct VTFFileBaseHeader_t int headerSize; }; -struct VTFFileHeaderV7_1_t : public VTFFileBaseHeader_t +struct alignas(16) VTFFileHeaderV7_1_t { DECLARE_BYTESWAP_DATADESC(); + char fileTypeString[4]; // "VTF" Valve texture file + int version[2]; // version[0].version[1] + int headerSize; + unsigned short width; unsigned short height; unsigned int flags; @@ -484,13 +490,65 @@ struct VTFFileHeaderV7_1_t : public VTFFileBaseHeader_t unsigned char lowResImageHeight; }; -struct VTFFileHeaderV7_2_t : public VTFFileHeaderV7_1_t +struct alignas(16) VTFFileHeaderV7_2_t { DECLARE_BYTESWAP_DATADESC(); + char fileTypeString[4]; // "VTF" Valve texture file + int version[2]; // version[0].version[1] + int headerSize; + + unsigned short width; + unsigned short height; + unsigned int flags; + unsigned short numFrames; + unsigned short startFrame; + + // must manually align in order to maintain pack(1) expected layout with existing binaries + char pad1[4]; + VectorAligned reflectivity; + + float bumpScale; + ImageFormat imageFormat; + unsigned char numMipLevels; + ImageFormat lowResImageFormat; + unsigned char lowResImageWidth; + unsigned char lowResImageHeight; unsigned short depth; }; +struct alignas(16) VTFFileHeaderV7_3_t +{ + DECLARE_BYTESWAP_DATADESC(); + + char fileTypeString[4]; // "VTF" Valve texture file + int version[2]; // version[0].version[1] + int headerSize; + + unsigned short width; + unsigned short height; + unsigned int flags; + unsigned short numFrames; + unsigned short startFrame; + + // must manually align in order to maintain pack(1) expected layout with existing binaries + char pad1[4]; + VectorAligned reflectivity; + + float bumpScale; + ImageFormat imageFormat; + unsigned char numMipLevels; + ImageFormat lowResImageFormat; + unsigned char lowResImageWidth; + unsigned char lowResImageHeight; + unsigned short depth; + + char pad4[3]; + unsigned int numResources; +}; + +typedef VTFFileHeaderV7_3_t VTFFileHeader_t; + #define BYTE_POS( byteVal, shft ) uint32( uint32(uint8(byteVal)) << uint8(shft * 8) ) #if !defined( _X360 ) #define MK_VTF_RSRC_ID(a, b, c) uint32( BYTE_POS(a, 0) | BYTE_POS(b, 1) | BYTE_POS(c, 2) ) @@ -535,28 +593,6 @@ struct ResourceEntryInfo unsigned int resData; // Resource data or offset from the beginning of the file }; -struct VTFFileHeaderV7_3_t : public VTFFileHeaderV7_2_t -{ - DECLARE_BYTESWAP_DATADESC(); - - char pad4[3]; - unsigned int numResources; - -#if defined( _X360 ) || defined( POSIX ) - // must manually align in order to maintain pack(1) expected layout with existing binaries - char pad5[8]; -#endif - - // AFTER THE IMPLICIT PADDING CAUSED BY THE COMPILER.... - // *** followed by *** ResourceEntryInfo resources[0]; - // Array of resource entry infos sorted ascending by type -}; - -struct VTFFileHeader_t : public VTFFileHeaderV7_3_t -{ - DECLARE_BYTESWAP_DATADESC(); -}; - #define VTF_X360_MAJOR_VERSION 0x0360 #define VTF_X360_MINOR_VERSION 8 struct VTFFileHeaderX360_t : public VTFFileBaseHeader_t diff --git a/vtf/vtf.cpp b/vtf/vtf.cpp index 9209d569..0dad4722 100644 --- a/vtf/vtf.cpp +++ b/vtf/vtf.cpp @@ -27,7 +27,10 @@ BEGIN_BYTESWAP_DATADESC( VTFFileBaseHeader_t ) DEFINE_FIELD( headerSize, FIELD_INTEGER ), END_DATADESC() -BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderV7_1_t, VTFFileBaseHeader_t ) +BEGIN_BYTESWAP_DATADESC( VTFFileHeaderV7_1_t ) + DEFINE_ARRAY( fileTypeString, FIELD_CHARACTER, 4 ), + DEFINE_ARRAY( version, FIELD_INTEGER, 2 ), + DEFINE_FIELD( headerSize, FIELD_INTEGER ), DEFINE_FIELD( width, FIELD_SHORT ), DEFINE_FIELD( height, FIELD_SHORT ), DEFINE_FIELD( flags, FIELD_INTEGER ), @@ -42,17 +45,45 @@ BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderV7_1_t, VTFFileBaseHeader_t ) DEFINE_FIELD( lowResImageHeight, FIELD_CHARACTER ), END_DATADESC() -BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderV7_2_t, VTFFileHeaderV7_1_t ) +BEGIN_BYTESWAP_DATADESC( VTFFileHeaderV7_2_t ) + DEFINE_ARRAY( fileTypeString, FIELD_CHARACTER, 4 ), + DEFINE_ARRAY( version, FIELD_INTEGER, 2 ), + DEFINE_FIELD( headerSize, FIELD_INTEGER ), + DEFINE_FIELD( width, FIELD_SHORT ), + DEFINE_FIELD( height, FIELD_SHORT ), + DEFINE_FIELD( flags, FIELD_INTEGER ), + DEFINE_FIELD( numFrames, FIELD_SHORT ), + DEFINE_FIELD( startFrame, FIELD_SHORT ), + DEFINE_FIELD( reflectivity, FIELD_VECTOR ), + DEFINE_FIELD( bumpScale, FIELD_FLOAT ), + DEFINE_FIELD( imageFormat, FIELD_INTEGER ), + DEFINE_FIELD( numMipLevels, FIELD_CHARACTER ), + DEFINE_FIELD( lowResImageFormat, FIELD_INTEGER ), + DEFINE_FIELD( lowResImageWidth, FIELD_CHARACTER ), + DEFINE_FIELD( lowResImageHeight, FIELD_CHARACTER ), DEFINE_FIELD( depth, FIELD_SHORT ), END_DATADESC() -BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderV7_3_t, VTFFileHeaderV7_2_t ) +BEGIN_BYTESWAP_DATADESC( VTFFileHeaderV7_3_t ) + DEFINE_ARRAY( fileTypeString, FIELD_CHARACTER, 4 ), + DEFINE_ARRAY( version, FIELD_INTEGER, 2 ), + DEFINE_FIELD( headerSize, FIELD_INTEGER ), + DEFINE_FIELD( width, FIELD_SHORT ), + DEFINE_FIELD( height, FIELD_SHORT ), + DEFINE_FIELD( flags, FIELD_INTEGER ), + DEFINE_FIELD( numFrames, FIELD_SHORT ), + DEFINE_FIELD( startFrame, FIELD_SHORT ), + DEFINE_FIELD( reflectivity, FIELD_VECTOR ), + DEFINE_FIELD( bumpScale, FIELD_FLOAT ), + DEFINE_FIELD( imageFormat, FIELD_INTEGER ), + DEFINE_FIELD( numMipLevels, FIELD_CHARACTER ), + DEFINE_FIELD( lowResImageFormat, FIELD_INTEGER ), + DEFINE_FIELD( lowResImageWidth, FIELD_CHARACTER ), + DEFINE_FIELD( lowResImageHeight, FIELD_CHARACTER ), + DEFINE_FIELD( depth, FIELD_SHORT ), DEFINE_FIELD( numResources, FIELD_INTEGER ), END_DATADESC() -BEGIN_BYTESWAP_DATADESC_( VTFFileHeader_t, VTFFileHeaderV7_2_t ) -END_DATADESC() - BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderX360_t, VTFFileBaseHeader_t ) DEFINE_FIELD( flags, FIELD_INTEGER ), DEFINE_FIELD( width, FIELD_SHORT ), @@ -903,23 +934,11 @@ static bool ReadHeaderFromBufferPastBaseHeader( CUtlBuffer &buf, VTFFileHeader_t else if ( header.version[1] == 2 ) { buf.Get( pBuf, sizeof(VTFFileHeaderV7_2_t) - sizeof(VTFFileBaseHeader_t) ); - - #if defined( _X360 ) || defined (POSIX) - // read 15 dummy bytes to be properly positioned with 7.2 PC data - byte dummy[15]; - buf.Get( dummy, 15 ); - #endif } else if ( header.version[1] == 1 || header.version[1] == 0 ) { // previous version 7.0 or 7.1 buf.Get( pBuf, sizeof(VTFFileHeaderV7_1_t) - sizeof(VTFFileBaseHeader_t) ); - - #if defined( _X360 ) || defined (POSIX) - // read a dummy byte to be properly positioned with 7.0/1 PC data - byte dummy; - buf.Get( &dummy, 1 ); - #endif } else { From 02a3c641a63b44bb3e2f82b0c0c602105be52c52 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Tue, 15 Aug 2023 16:47:35 +0300 Subject: [PATCH 05/13] engine: fix loading static prop lump version 7 --- engine/staticpropmgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/staticpropmgr.cpp b/engine/staticpropmgr.cpp index 46a91c0f..931aa0e3 100644 --- a/engine/staticpropmgr.cpp +++ b/engine/staticpropmgr.cpp @@ -1339,7 +1339,6 @@ void CStaticPropMgr::UnserializeModels( CUtlBuffer& buf ) case 5: UnserializeLump(&lump, buf); break; case 6: UnserializeLump(&lump, buf); break; case 7: // Falls down to version 10. We promoted TF to version 10 to deal with SFM. - case 9: UnserializeLump(&lump, buf); break; case 10: { if( s_MapVersion == 21 ) @@ -1348,7 +1347,8 @@ void CStaticPropMgr::UnserializeModels( CUtlBuffer& buf ) UnserializeLump(&lump, buf); break; } - case 11: UnserializeLump(&lump, buf); + case 9: UnserializeLump(&lump, buf); break; + case 11: UnserializeLump(&lump, buf); break; default: Assert("Unexpected version while deserializing lumps."); } From 4f1092829955a73d462193163f774b614234c1a6 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Thu, 17 Aug 2023 14:31:43 +0300 Subject: [PATCH 06/13] inputsystem: fix UB in touch events callback, make touch more responsive --- engine/sys_mainwind.cpp | 2 +- game/client/cdll_client_int.cpp | 20 ++++++--------- inputsystem/inputsystem.cpp | 10 -------- inputsystem/inputsystem.h | 7 +++--- inputsystem/touch_sdl.cpp | 42 ++++++++++++++++++++++--------- public/cdll_int.h | 2 +- public/inputsystem/iinputsystem.h | 1 + vguimatsurface/Input.cpp | 23 +++++++++-------- 8 files changed, 58 insertions(+), 49 deletions(-) diff --git a/engine/sys_mainwind.cpp b/engine/sys_mainwind.cpp index 6003bf7c..8cbb3fdc 100644 --- a/engine/sys_mainwind.cpp +++ b/engine/sys_mainwind.cpp @@ -355,7 +355,7 @@ void CGame::HandleMsg_Close( const InputEvent_t &event ) void CGame::DispatchInputEvent( const InputEvent_t &event ) { - switch( event.m_nType & 0xFFFF ) + switch( event.m_nType ) { // Handle button events specially, // since we have all manner of crazy filtering going on when dealing with them diff --git a/game/client/cdll_client_int.cpp b/game/client/cdll_client_int.cpp index 1bbfae96..e4221104 100644 --- a/game/client/cdll_client_int.cpp +++ b/game/client/cdll_client_int.cpp @@ -729,7 +729,7 @@ public: void PrecacheMaterial( const char *pMaterialName ); virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ); - virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 ); + virtual void IN_TouchEvent( int type, int fingerId, int x, int y ); private: void UncacheAllMaterials( ); @@ -2637,24 +2637,20 @@ CSteamID GetSteamIDForPlayerIndex( int iPlayerIndex ) #endif -void CHLClient::IN_TouchEvent( uint data, uint data2, uint data3, uint data4 ) +void CHLClient::IN_TouchEvent( int type, int fingerId, int x, int y ) { if( enginevgui->IsGameUIVisible() ) return; touch_event_t ev; - ev.type = data & 0xFFFF; - ev.fingerid = (data >> 16) & 0xFFFF; - ev.x = (double)((data2 >> 16) & 0xFFFF) / 0xFFFF; - ev.y = (double)(data2 & 0xFFFF) / 0xFFFF; + ev.type = type; + ev.fingerid = fingerId; + memcpy( &ev.x, &x, sizeof(ev.x) ); + memcpy( &ev.y, &y, sizeof(ev.y) ); - union{uint i;float f;} ifconv; - ifconv.i = data3; - ev.dx = ifconv.f; - - ifconv.i = data4; - ev.dy = ifconv.f; + if( type == IE_FingerMotion ) + inputsystem->GetTouchAccumulators( fingerId, ev.dx, ev.dy ); gTouch.ProcessEvent( &ev ); } diff --git a/inputsystem/inputsystem.cpp b/inputsystem/inputsystem.cpp index 44a0c785..6ec446d9 100644 --- a/inputsystem/inputsystem.cpp +++ b/inputsystem/inputsystem.cpp @@ -1530,16 +1530,6 @@ bool CInputSystem::GetRawMouseAccumulators( int& accumX, int& accumY ) #endif } -bool CInputSystem::GetTouchAccumulators( InputEventType_t &event, int &fingerId, int& accumX, int& accumY ) -{ - event = m_touchAccumEvent; - fingerId = m_touchAccumFingerId; - accumX = m_touchAccumX; - accumY = m_touchAccumY; - - return m_bJoystickInitialized; -} - void CInputSystem::SetConsoleTextMode( bool bConsoleTextMode ) { /* If someone calls this after init, shut it down. */ diff --git a/inputsystem/inputsystem.h b/inputsystem/inputsystem.h index c369851e..8038a1ff 100644 --- a/inputsystem/inputsystem.h +++ b/inputsystem/inputsystem.h @@ -44,6 +44,8 @@ #include "steam/steam_api.h" +#define TOUCH_FINGER_MAX_COUNT 10 + //----------------------------------------------------------------------------- // Implementation of the input system //----------------------------------------------------------------------------- @@ -101,7 +103,7 @@ public: virtual void *GetHapticsInterfaceAddress() const { return NULL;} #endif bool GetRawMouseAccumulators( int& accumX, int& accumY ); - bool GetTouchAccumulators( InputEventType_t &event, int &fingerId, int& accumX, int& accumY ); + virtual bool GetTouchAccumulators( int fingerId, float &dx, float &dy ); virtual void SetConsoleTextMode( bool bConsoleTextMode ); @@ -458,8 +460,7 @@ public: bool m_bRawInputSupported; int m_mouseRawAccumX, m_mouseRawAccumY; - InputEventType_t m_touchAccumEvent; - int m_touchAccumFingerId, m_touchAccumX, m_touchAccumY; + float m_touchAccumX[TOUCH_FINGER_MAX_COUNT], m_touchAccumY[TOUCH_FINGER_MAX_COUNT]; // For the 'SleepUntilInput' feature HANDLE m_hEvent; diff --git a/inputsystem/touch_sdl.cpp b/inputsystem/touch_sdl.cpp index 5e7cf2cf..5eb80844 100644 --- a/inputsystem/touch_sdl.cpp +++ b/inputsystem/touch_sdl.cpp @@ -48,6 +48,9 @@ void CInputSystem::InitializeTouch( void ) // abort startup if user requests no touch if ( CommandLine()->FindParm("-notouch") ) return; + memset( m_touchAccumX, 0, sizeof(m_touchAccumX) ); + memset( m_touchAccumY, 0, sizeof(m_touchAccumY) ); + m_bJoystickInitialized = true; SDL_AddEventWatch(TouchSDLWatcher, this); } @@ -61,20 +64,35 @@ void CInputSystem::ShutdownTouch() m_bTouchInitialized = false; } +bool CInputSystem::GetTouchAccumulators( int fingerId, float &dx, float &dy ) +{ + dx = m_touchAccumX[fingerId]; + dy = m_touchAccumY[fingerId]; + + m_touchAccumX[fingerId] = m_touchAccumY[fingerId] = 0.f; + + return true; +} + void CInputSystem::FingerEvent(int eventType, int fingerId, float x, float y, float dx, float dy) { - // Shit, but should work with arm/x86 + if( fingerId >= TOUCH_FINGER_MAX_COUNT ) + return; - int data0 = fingerId << 16 | eventType; - int _x = (int)((double)x*0xFFFF); - int _y = (int)((double)y*0xFFFF); - int data1 = _x << 16 | (_y & 0xFFFF); + if( eventType == IE_FingerUp ) + { + m_touchAccumX[fingerId] = 0.f; + m_touchAccumY[fingerId] = 0.f; + } + else + { + m_touchAccumX[fingerId] += dx; + m_touchAccumY[fingerId] += dy; + } - union{int i;float f;} ifconv; - ifconv.f = dx; - int _dx = ifconv.i; - ifconv.f = dy; - int _dy = ifconv.i; - - PostEvent(data0, m_nLastSampleTick, data1, _dx, _dy); + int _x,_y; + memcpy( &_x, &x, sizeof(float) ); + memcpy( &_y, &y, sizeof(float) ); + PostEvent(eventType, m_nLastSampleTick, fingerId, _x, _y); } + diff --git a/public/cdll_int.h b/public/cdll_int.h index 85cd7617..d3e6dc44 100644 --- a/public/cdll_int.h +++ b/public/cdll_int.h @@ -790,7 +790,7 @@ public: virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ) = 0; - virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 ) = 0; + virtual void IN_TouchEvent( int type, int fingerId, int x, int y ) = 0; }; #define CLIENT_DLL_INTERFACE_VERSION "VClient017" diff --git a/public/inputsystem/iinputsystem.h b/public/inputsystem/iinputsystem.h index 07bc2fe9..6135a88d 100644 --- a/public/inputsystem/iinputsystem.h +++ b/public/inputsystem/iinputsystem.h @@ -119,6 +119,7 @@ public: // read and clear accumulated raw input values virtual bool GetRawMouseAccumulators( int& accumX, int& accumY ) = 0; + virtual bool GetTouchAccumulators( int fingerId, float &dx, float &dy ) = 0; // tell the input system that we're not a game, we're console text mode. // this is used for dedicated servers to not initialize joystick system. diff --git a/vguimatsurface/Input.cpp b/vguimatsurface/Input.cpp index 744aafbb..85836e00 100644 --- a/vguimatsurface/Input.cpp +++ b/vguimatsurface/Input.cpp @@ -376,7 +376,7 @@ static vgui::MouseCode ButtonCodeToMouseCode( ButtonCode_t buttonCode ) //----------------------------------------------------------------------------- bool InputHandleInputEvent( const InputEvent_t &event ) { - switch( event.m_nType & 0xFFFF ) + switch( event.m_nType ) { case IE_ButtonPressed: { @@ -428,9 +428,10 @@ bool InputHandleInputEvent( const InputEvent_t &event ) case IE_FingerDown: { int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h); - uint data = (uint)event.m_nData; - x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF); - y = h*((double)(data & 0xFFFF) / 0xFFFF); + float _x, _y; + memcpy( &_x, &event.m_nData2, sizeof(_x) ); + memcpy( &_y, &event.m_nData3, sizeof(_y) ); + x = w*_x; y = h*_y; g_pIInput->UpdateCursorPosInternal( x, y ); g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_PRESSED ); g_pIInput->InternalMousePressed( MOUSE_LEFT ); @@ -439,9 +440,10 @@ bool InputHandleInputEvent( const InputEvent_t &event ) case IE_FingerUp: { int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h); - uint data = (uint)event.m_nData; - x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF); - y = h*((double)(data & 0xFFFF) / 0xFFFF); + float _x, _y; + memcpy( &_x, &event.m_nData2, sizeof(_x) ); + memcpy( &_y, &event.m_nData3, sizeof(_y) ); + x = w*_x; y = h*_y; g_pIInput->UpdateCursorPosInternal( x, y ); g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_RELEASED ); g_pIInput->InternalMouseReleased( MOUSE_LEFT ); @@ -450,9 +452,10 @@ bool InputHandleInputEvent( const InputEvent_t &event ) case IE_FingerMotion: { int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h); - uint data = (uint)event.m_nData; - x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF); - y = h*((double)(data & 0xFFFF) / 0xFFFF); + float _x, _y; + memcpy( &_x, &event.m_nData2, sizeof(_x) ); + memcpy( &_y, &event.m_nData3, sizeof(_y) ); + x = w*_x; y = h*_y; g_pIInput->InternalCursorMoved( x, y ); } return true; From 601cfff16404f7c970143b1313a7b89c6ea55d78 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Thu, 17 Aug 2023 15:59:47 +0300 Subject: [PATCH 07/13] game: fix touch transparency mode for cut scenes --- game/client/cdll_client_int.cpp | 1 + game/client/touch.cpp | 7 +++++++ game/client/touch.h | 1 + 3 files changed, 9 insertions(+) diff --git a/game/client/cdll_client_int.cpp b/game/client/cdll_client_int.cpp index e4221104..ab16bd7c 100644 --- a/game/client/cdll_client_int.cpp +++ b/game/client/cdll_client_int.cpp @@ -1631,6 +1631,7 @@ void CHLClient::LevelInitPreEntity( char const* pMapName ) g_RagdollLVManager.SetLowViolence( pMapName ); gHUD.LevelInit(); + gTouch.LevelInit(); #if defined( REPLAY_ENABLED ) // Initialize replay ragdoll recorder diff --git a/game/client/touch.cpp b/game/client/touch.cpp index 33a0817f..2d71646b 100644 --- a/game/client/touch.cpp +++ b/game/client/touch.cpp @@ -425,6 +425,13 @@ void CTouchControls::Init() initialized = true; } +void CTouchControls::LevelInit() +{ + m_bCutScene = false; + m_AlphaDiff = 0; + m_flHideTouch = 0; +} + int nextPowerOfTwo(int x) { if( (x & (x - 1)) == 0) diff --git a/game/client/touch.h b/game/client/touch.h index 847849df..c11fd46a 100644 --- a/game/client/touch.h +++ b/game/client/touch.h @@ -161,6 +161,7 @@ class CTouchControls { public: void Init( ); + void LevelInit( ); void Shutdown( ); void Paint( ); From 5ea9937457a3cb46883985853acf6ea5960cffcb Mon Sep 17 00:00:00 2001 From: nillerusr Date: Fri, 18 Aug 2023 13:49:07 +0300 Subject: [PATCH 08/13] android: fix black screen after minimizing window in materialsystem queue mode --- engine/sys_mainwind.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/engine/sys_mainwind.cpp b/engine/sys_mainwind.cpp index 8cbb3fdc..aecf5ebd 100644 --- a/engine/sys_mainwind.cpp +++ b/engine/sys_mainwind.cpp @@ -263,7 +263,6 @@ GameMessageHandler_t g_GameMessageHandlers[] = { IE_Quit, &CGame::HandleMsg_Close }, }; - void CGame::AppActivate( bool fActive ) { // If text mode, force it to be active. @@ -299,8 +298,18 @@ void CGame::AppActivate( bool fActive ) // Clear keyboard states (should be cleared already but...) // VGui_ActivateMouse will reactivate the mouse soon. ClearIOStates(); - UpdateMaterialSystemConfig(); + +#ifdef ANDROID + ConVarRef mat_queue_mode( "mat_queue_mode" ); + + // Hack to reset internal queue buffers + int nSavedQueueMode = mat_queue_mode.GetInt(); + mat_queue_mode.SetValue( 0 ); + materials->BeginFrame( host_frametime ); + materials->EndFrame(); + mat_queue_mode.SetValue( nSavedQueueMode ); +#endif } else { From 2d3f31d37e24507276ffc37854fae284a2d04b3f Mon Sep 17 00:00:00 2001 From: nillerusr Date: Fri, 18 Aug 2023 15:40:38 +0300 Subject: [PATCH 09/13] android: reset vsync after minimizing window --- appframework/sdlmgr.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/appframework/sdlmgr.cpp b/appframework/sdlmgr.cpp index dd5ee2c2..53ca92d5 100644 --- a/appframework/sdlmgr.cpp +++ b/appframework/sdlmgr.cpp @@ -404,6 +404,9 @@ private: int m_MouseButtonDownX; int m_MouseButtonDownY; + bool m_bResetVsync; + int m_nFramesToSkip; + double m_flPrevGLSwapWindowTime; }; @@ -584,6 +587,9 @@ InitReturnVal_t CSDLMgr::Init() m_nWarpDelta = 0; m_bRawInput = false; + m_nFramesToSkip = 0; + m_bResetVsync = false; + m_flPrevGLSwapWindowTime = 0.0f; memset(m_pixelFormatAttribs, '\0', sizeof (m_pixelFormatAttribs)); @@ -1431,7 +1437,20 @@ void CSDLMgr::ShowPixels( CShowPixelsParams *params ) m_flPrevGLSwapWindowTime = tm.GetDurationInProgress().GetMillisecondsF(); - +#ifdef ANDROID + // ADRENO GPU MOMENT, SKIP 5 FRAMES + if( m_bResetVsync ) + { + if( m_nFramesToSkip <= 0 ) + { + SDL_GL_SetSwapInterval(swapInterval); + m_bResetVsync = false; + } + else + m_nFramesToSkip--; + } +#endif + CheckGLError( __LINE__ ); } #endif // DX_TO_GL_ABSTRACTION @@ -1887,6 +1906,7 @@ void CSDLMgr::PumpWindowsMessageLoop() } case SDL_WINDOWEVENT_FOCUS_GAINED: { + m_bResetVsync = true; m_nFramesToSkip = 3; m_bHasFocus = true; SDL_ShowCursor( m_bCursorVisible ? 1 : 0 ); CCocoaEvent theEvent; From b73f3b70fa83ac6c5c100cce35b0f8a9655ec921 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Tue, 22 Aug 2023 11:11:39 +0300 Subject: [PATCH 10/13] cstrike: add autojump convar --- game/shared/cstrike/cs_gamemovement.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/game/shared/cstrike/cs_gamemovement.cpp b/game/shared/cstrike/cs_gamemovement.cpp index fa5c52a4..54c69287 100644 --- a/game/shared/cstrike/cs_gamemovement.cpp +++ b/game/shared/cstrike/cs_gamemovement.cpp @@ -28,7 +28,7 @@ extern bool g_bMovementOptimizations; ConVar sv_timebetweenducks( "sv_timebetweenducks", "0", FCVAR_REPLICATED, "Minimum time before recognizing consecutive duck key", true, 0.0, true, 2.0 ); ConVar sv_enableboost( "sv_enableboost", "0", FCVAR_REPLICATED | FCVAR_NOTIFY, "Allow boost exploits"); - +ConVar cs_autojump( "cs_autojump", "0", FCVAR_REPLICATED | FCVAR_NOTIFY ); class CCSGameMovement : public CGameMovement { @@ -691,8 +691,11 @@ bool CCSGameMovement::CheckJumpButton( void ) return false; // in air, so no effect } - if ( mv->m_nOldButtons & IN_JUMP ) + if ( (mv->m_nOldButtons & IN_JUMP) && + (!cs_autojump.GetBool() && m_pCSPlayer->GetGroundEntity()) ) + { return false; // don't pogo stick + } if ( !sv_enablebunnyhopping.GetBool() ) { From b5d6051d98befe95012c52149b012303be1368c7 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Tue, 22 Aug 2023 11:38:13 +0300 Subject: [PATCH 11/13] cstrike: optimize flashbang --- game/client/cstrike/cs_view_scene.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/game/client/cstrike/cs_view_scene.cpp b/game/client/cstrike/cs_view_scene.cpp index 9b02442f..34372b91 100644 --- a/game/client/cstrike/cs_view_scene.cpp +++ b/game/client/cstrike/cs_view_scene.cpp @@ -152,13 +152,13 @@ void CCSViewRender::PerformNightVisionEffect( const CViewSetup &view ) render->ViewDrawFade( overlaycolor, pMaterial ); // Only one pass in DX7. - if ( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80 ) +/* if ( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80 ) { CMatRenderContextPtr pRenderContext( materials ); pRenderContext->DrawScreenSpaceQuad( pMaterial ); render->ViewDrawFade( overlaycolor, pMaterial ); pRenderContext->DrawScreenSpaceQuad( pMaterial ); - } + }*/ } } } @@ -211,6 +211,7 @@ void CCSViewRender::PerformFlashbangEffect( const CViewSetup &view ) render->ViewDrawFade( overlaycolor, pMaterial ); // just do one pass for dxlevel < 80. +/* if (g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80) { pRenderContext->DrawScreenSpaceRectangle( pMaterial, view.x, view.y, view.width, view.height, @@ -221,6 +222,7 @@ void CCSViewRender::PerformFlashbangEffect( const CViewSetup &view ) 0, 0, m_pFlashTexture->GetActualWidth()-1, m_pFlashTexture->GetActualHeight()-1, m_pFlashTexture->GetActualWidth(), m_pFlashTexture->GetActualHeight() ); } +*/ } else if ( m_pFlashTexture ) { @@ -233,7 +235,7 @@ void CCSViewRender::PerformFlashbangEffect( const CViewSetup &view ) render->ViewDrawFade( overlaycolor, pMaterial ); // just do one pass for dxlevel < 80. - if (g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80) +/* if (g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80) { pRenderContext->DrawScreenSpaceRectangle( pMaterial, view.x, view.y, view.width, view.height, 0, 0, m_pFlashTexture->GetActualWidth()-1, m_pFlashTexture->GetActualHeight()-1, @@ -242,7 +244,7 @@ void CCSViewRender::PerformFlashbangEffect( const CViewSetup &view ) pRenderContext->DrawScreenSpaceRectangle( pMaterial, view.x, view.y, view.width, view.height, 0, 0, m_pFlashTexture->GetActualWidth()-1, m_pFlashTexture->GetActualHeight()-1, m_pFlashTexture->GetActualWidth(), m_pFlashTexture->GetActualHeight() ); - } + }*/ } // this does the pure white overlay part of the flashbang effect. From 1d4f7fb2cc8c48e22fa038192ffa13860f4abe99 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Tue, 22 Aug 2023 11:47:19 +0300 Subject: [PATCH 12/13] change touch editor colors --- game/client/touch.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/game/client/touch.cpp b/game/client/touch.cpp index 2d71646b..f8c4f718 100644 --- a/game/client/touch.cpp +++ b/game/client/touch.cpp @@ -313,7 +313,7 @@ void CTouchControls::ResetToDefaults() { rgba_t color(255, 255, 255, 155); char buf[MAX_PATH]; - gridcolor = rgba_t(255, 0, 0, 50); + gridcolor = rgba_t(255, 0, 0, 30); RemoveButtons(); @@ -372,7 +372,7 @@ void CTouchControls::Init() mouse_events = 0; move_start_x = move_start_y = 0.0f; m_flPreviousYaw = m_flPreviousPitch = 0.f; - gridcolor = rgba_t(255, 0, 0, 50); + gridcolor = rgba_t(255, 0, 0, 30); m_bCutScene = false; showtexture = hidetexture = resettexture = closetexture = joytexture = 0; @@ -659,6 +659,8 @@ void CTouchControls::Paint() CUtlLinkedList::iterator it; + const rgba_t buttonEditClr = rgba_t( 61, 153, 0, 40 ); + if( state == state_edit ) { vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a*3); // 255, 0, 0, 200 <- default here @@ -685,7 +687,7 @@ void CTouchControls::Paint() g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+40, 255, 255, 255, 255, "RGBA: %d %d %d %d", btn->color.r, btn->color.g, btn->color.b, btn->color.a );// color } - vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a); // 255, 0, 0, 50 <- default here + vgui::surface()->DrawSetColor(buttonEditClr.r, buttonEditClr.g, buttonEditClr.b, buttonEditClr.a); // 255, 0, 0, 50 <- default here vgui::surface()->DrawFilledRect( btn->x1*screen_w, btn->y1*screen_h, btn->x2*screen_w, btn->y2*screen_h ); } } From b7bd94c52ea7c4809e01b5af5bc14ab7061862a2 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Wed, 23 Aug 2023 23:42:08 +0300 Subject: [PATCH 13/13] cstrike: fix uninitialized pointers in hud --- game/client/cstrike/cs_hud_health.cpp | 4 ++-- game/client/cstrike/hud_armor.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/game/client/cstrike/cs_hud_health.cpp b/game/client/cstrike/cs_hud_health.cpp index 26faee20..46db0c1e 100644 --- a/game/client/cstrike/cs_hud_health.cpp +++ b/game/client/cstrike/cs_hud_health.cpp @@ -72,7 +72,7 @@ DECLARE_HUDELEMENT( CHudHealth ); //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- -CHudHealth::CHudHealth( const char *pElementName ) : CHudElement( pElementName ), CHudNumericDisplay(NULL, "HudHealth") +CHudHealth::CHudHealth( const char *pElementName ) : CHudElement( pElementName ), CHudNumericDisplay(NULL, "HudHealth"), m_pHealthIcon( NULL ) { SetHiddenBits( HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD ); } @@ -172,4 +172,4 @@ void CHudHealth::Paint( void ) //draw the health icon BaseClass::Paint(); -} \ No newline at end of file +} diff --git a/game/client/cstrike/hud_armor.cpp b/game/client/cstrike/hud_armor.cpp index cbdb1de6..c9016208 100644 --- a/game/client/cstrike/hud_armor.cpp +++ b/game/client/cstrike/hud_armor.cpp @@ -47,7 +47,7 @@ private: DECLARE_HUDELEMENT( CHudArmor ); -CHudArmor::CHudArmor( const char *pName ) : CHudNumericDisplay( NULL, "HudArmor" ), CHudElement( pName ) +CHudArmor::CHudArmor( const char *pName ) : CHudNumericDisplay( NULL, "HudArmor" ), CHudElement( pName ), m_pArmorIcon( NULL ) { SetHiddenBits( HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD ); }