Browse Source

game: init uninitialized variables

sanitize
nillerusr 3 years ago
parent
commit
600695b15f
  1. 4
      game/client/c_baseanimating.cpp
  2. 9
      game/client/c_baseentity.cpp
  3. 2
      game/client/c_baseflex.h
  4. 2
      game/client/c_func_occluder.cpp
  5. 2
      game/client/c_te_legacytempents.cpp
  6. 1
      game/client/hud_basechat.cpp
  7. 2
      game/client/view.cpp
  8. 39
      game/client/viewrender.cpp
  9. 1
      game/server/ai_basenpc.cpp
  10. 2
      game/server/ai_behavior_lead.cpp
  11. 2
      game/server/ai_squad.cpp
  12. 2
      game/server/func_dust.cpp
  13. 2
      game/server/hl1/hl1_ents.cpp
  14. 2
      game/server/hl2/npc_scanner.cpp
  15. 2
      game/server/nav_mesh.h
  16. 2
      game/shared/Sprite.cpp
  17. 3
      game/shared/basecombatweapon_shared.cpp

4
game/client/c_baseanimating.cpp

@ -677,6 +677,8 @@ C_BaseAnimating::C_BaseAnimating() :
m_pRagdoll = NULL; m_pRagdoll = NULL;
m_builtRagdoll = false; m_builtRagdoll = false;
m_hitboxBoneCacheHandle = 0; m_hitboxBoneCacheHandle = 0;
m_nHitboxSet = 0;
int i; int i;
for ( i = 0; i < ARRAYSIZE( m_flEncodedController ); i++ ) for ( i = 0; i < ARRAYSIZE( m_flEncodedController ); i++ )
{ {
@ -694,6 +696,8 @@ C_BaseAnimating::C_BaseAnimating() :
m_bStoreRagdollInfo = false; m_bStoreRagdollInfo = false;
m_pRagdollInfo = NULL; m_pRagdollInfo = NULL;
m_pJiggleBones = NULL;
m_pBoneMergeCache = NULL;
m_flPlaybackRate = 1.0f; m_flPlaybackRate = 1.0f;

9
game/client/c_baseentity.cpp

@ -903,6 +903,7 @@ C_BaseEntity::C_BaseEntity() :
m_DataChangeEventRef = -1; m_DataChangeEventRef = -1;
m_EntClientFlags = 0; m_EntClientFlags = 0;
m_bEnableRenderingClipPlane = false;
m_iParentAttachment = 0; m_iParentAttachment = 0;
m_nRenderFXBlend = 255; m_nRenderFXBlend = 255;
@ -940,10 +941,12 @@ C_BaseEntity::C_BaseEntity() :
#if !defined( NO_ENTITY_PREDICTION ) #if !defined( NO_ENTITY_PREDICTION )
m_pPredictionContext = NULL; m_pPredictionContext = NULL;
#endif #endif
//NOTE: not virtual! we are in the constructor! //NOTE: not virtual! we are in the constructor!
C_BaseEntity::Clear(); C_BaseEntity::Clear();
SetModelName( NULL_STRING );
m_iClassname = NULL_STRING;
m_InterpolationListEntry = 0xFFFF; m_InterpolationListEntry = 0xFFFF;
m_TeleportListEntry = 0xFFFF; m_TeleportListEntry = 0xFFFF;
@ -984,7 +987,6 @@ C_BaseEntity::~C_BaseEntity()
void C_BaseEntity::Clear( void ) void C_BaseEntity::Clear( void )
{ {
m_bDormant = true; m_bDormant = true;
m_nCreationTick = -1; m_nCreationTick = -1;
m_RefEHandle.Term(); m_RefEHandle.Term();
m_ModelInstance = MODEL_INSTANCE_INVALID; m_ModelInstance = MODEL_INSTANCE_INVALID;
@ -998,6 +1000,7 @@ void C_BaseEntity::Clear( void )
SetLocalOrigin( vec3_origin ); SetLocalOrigin( vec3_origin );
SetLocalAngles( vec3_angle ); SetLocalAngles( vec3_angle );
model = NULL; model = NULL;
m_pOriginalData = NULL;
m_vecAbsOrigin.Init(); m_vecAbsOrigin.Init();
m_angAbsRotation.Init(); m_angAbsRotation.Init();
m_vecVelocity.Init(); m_vecVelocity.Init();
@ -3741,7 +3744,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd
case mod_brush: case mod_brush:
{ {
color32 cColor32 = { cColor.r(), cColor.g(), cColor.b(), cColor.a() }; color32 cColor32 = { (uint8)cColor.r(), (uint8)cColor.g(), (uint8)cColor.b(), (uint8)cColor.a() };
effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 ); effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
} }
break; break;

2
game/client/c_baseflex.h

@ -91,7 +91,7 @@ struct FS_LocalToGlobal_t
const flexsettinghdr_t *m_Key; const flexsettinghdr_t *m_Key;
int m_nCount; int m_nCount;
int *m_Mapping; int *m_Mapping = NULL;
}; };
bool FlexSettingLessFunc( const FS_LocalToGlobal_t& lhs, const FS_LocalToGlobal_t& rhs ); bool FlexSettingLessFunc( const FS_LocalToGlobal_t& lhs, const FS_LocalToGlobal_t& rhs );

2
game/client/c_func_occluder.cpp

@ -24,7 +24,7 @@ public:
private: private:
int m_nOccluderIndex; int m_nOccluderIndex;
bool m_bActive; bool m_bActive = false;
}; };
IMPLEMENT_CLIENTCLASS_DT( C_FuncOccluder, DT_FuncOccluder, CFuncOccluder ) IMPLEMENT_CLIENTCLASS_DT( C_FuncOccluder, DT_FuncOccluder, CFuncOccluder )

2
game/client/c_te_legacytempents.cpp

@ -1539,7 +1539,7 @@ void CTempEnts::BloodSprite( const Vector &org, int r, int g, int b, int a, int
{ {
C_LocalTempEntity *pTemp; C_LocalTempEntity *pTemp;
int frameCount = modelinfo->GetModelFrameCount( model ); int frameCount = modelinfo->GetModelFrameCount( model );
color32 impactcolor = { r, g, b, a }; color32 impactcolor = { (uint8)r, (uint8)g, (uint8)b, (uint8)a };
//Large, single blood sprite is a high-priority tent //Large, single blood sprite is a high-priority tent
if ( ( pTemp = TempEntAllocHigh( org, model ) ) != NULL ) if ( ( pTemp = TempEntAllocHigh( org, model ) ) != NULL )

1
game/client/hud_basechat.cpp

@ -633,6 +633,7 @@ CBaseHudChat::CBaseHudChat( const char *pElementName )
} }
m_pChatHistory = new CHudChatHistory( this, "HudChatHistory" ); m_pChatHistory = new CHudChatHistory( this, "HudChatHistory" );
m_pFilterPanel = NULL;
CreateChatLines(); CreateChatLines();
CreateChatInputLine(); CreateChatInputLine();

2
game/client/view.cpp

@ -931,7 +931,7 @@ void CViewRender::WriteSaveGameScreenshotOfSize( const char *pFilename, int widt
{ {
// Write TGA format to buffer // Write TGA format to buffer
int iMaxTGASize = 1024 + ( nSrcWidth * nSrcHeight * 4 ); int iMaxTGASize = 1024 + ( nSrcWidth * nSrcHeight * 4 );
void *pTGA = malloc( iMaxTGASize ); void *pTGA = new char[ iMaxTGASize ];
buffer.SetExternalBuffer( pTGA, iMaxTGASize, 0 ); buffer.SetExternalBuffer( pTGA, iMaxTGASize, 0 );
bWriteResult = TGAWriter::WriteToBuffer( pSrcImage, buffer, nSrcWidth, nSrcHeight, IMAGE_FORMAT_RGB888, IMAGE_FORMAT_RGB888 ); bWriteResult = TGAWriter::WriteToBuffer( pSrcImage, buffer, nSrcWidth, nSrcHeight, IMAGE_FORMAT_RGB888, IMAGE_FORMAT_RGB888 );

39
game/client/viewrender.cpp

@ -1435,8 +1435,8 @@ static void GetFogColorTransition( fogparams_t *pFogParams, float *pColorPrimary
{ {
float flPercent = 1.0f - (( pFogParams->lerptime - gpGlobals->curtime ) / pFogParams->duration ); float flPercent = 1.0f - (( pFogParams->lerptime - gpGlobals->curtime ) / pFogParams->duration );
float flPrimaryColorLerp[3] = { pFogParams->colorPrimaryLerpTo.GetR(), pFogParams->colorPrimaryLerpTo.GetG(), pFogParams->colorPrimaryLerpTo.GetB() }; float flPrimaryColorLerp[3] = { (float)pFogParams->colorPrimaryLerpTo.GetR(), (float)pFogParams->colorPrimaryLerpTo.GetG(), (float)pFogParams->colorPrimaryLerpTo.GetB() };
float flSecondaryColorLerp[3] = { pFogParams->colorSecondaryLerpTo.GetR(), pFogParams->colorSecondaryLerpTo.GetG(), pFogParams->colorSecondaryLerpTo.GetB() }; float flSecondaryColorLerp[3] = { (float)pFogParams->colorSecondaryLerpTo.GetR(), (float)pFogParams->colorSecondaryLerpTo.GetG(), (float)pFogParams->colorSecondaryLerpTo.GetB() };
CheckAndTransitionColor( flPercent, pColorPrimary, flPrimaryColorLerp ); CheckAndTransitionColor( flPercent, pColorPrimary, flPrimaryColorLerp );
CheckAndTransitionColor( flPercent, pColorSecondary, flSecondaryColorLerp ); CheckAndTransitionColor( flPercent, pColorSecondary, flSecondaryColorLerp );
@ -1459,8 +1459,8 @@ static void GetFogColor( fogparams_t *pFogParams, float *pColor )
} }
else else
{ {
float flPrimaryColor[3] = { pFogParams->colorPrimary.GetR(), pFogParams->colorPrimary.GetG(), pFogParams->colorPrimary.GetB() }; float flPrimaryColor[3] = { (float)pFogParams->colorPrimary.GetR(), (float)pFogParams->colorPrimary.GetG(), (float)pFogParams->colorPrimary.GetB() };
float flSecondaryColor[3] = { pFogParams->colorSecondary.GetR(), pFogParams->colorSecondary.GetG(), pFogParams->colorSecondary.GetB() }; float flSecondaryColor[3] = { (float)pFogParams->colorSecondary.GetR(), (float)pFogParams->colorSecondary.GetG(), (float)pFogParams->colorSecondary.GetB() };
GetFogColorTransition( pFogParams, flPrimaryColor, flSecondaryColor ); GetFogColorTransition( pFogParams, flPrimaryColor, flSecondaryColor );
@ -2689,6 +2689,7 @@ bool DoesViewPlaneIntersectWater( float waterZ, int leafWaterDataID )
// &view - the camera view to render from // &view - the camera view to render from
// nClearFlags - how to clear the buffer // nClearFlags - how to clear the buffer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCustomVisibility_t *pCustomVisibility ) void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCustomVisibility_t *pCustomVisibility )
{ {
VPROF( "CViewRender::ViewDrawScene_PortalStencil" ); VPROF( "CViewRender::ViewDrawScene_PortalStencil" );
@ -2700,28 +2701,6 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus
QAngle vecOldAngles = CurrentViewAngles(); QAngle vecOldAngles = CurrentViewAngles();
int iCurrentViewID = g_CurrentViewID; int iCurrentViewID = g_CurrentViewID;
int iRecursionLevel = g_pPortalRender->GetViewRecursionLevel();
Assert( iRecursionLevel > 0 );
//get references to reflection textures
CTextureReference pPrimaryWaterReflectionTexture;
pPrimaryWaterReflectionTexture.Init( GetWaterReflectionTexture() );
CTextureReference pReplacementWaterReflectionTexture;
pReplacementWaterReflectionTexture.Init( portalrendertargets->GetWaterReflectionTextureForStencilDepth( iRecursionLevel ) );
//get references to refraction textures
CTextureReference pPrimaryWaterRefractionTexture;
pPrimaryWaterRefractionTexture.Init( GetWaterRefractionTexture() );
CTextureReference pReplacementWaterRefractionTexture;
pReplacementWaterRefractionTexture.Init( portalrendertargets->GetWaterRefractionTextureForStencilDepth( iRecursionLevel ) );
//swap texture contents for the primary render targets with those we set aside for this recursion level
if( pReplacementWaterReflectionTexture != NULL )
pPrimaryWaterReflectionTexture->SwapContents( pReplacementWaterReflectionTexture );
if( pReplacementWaterRefractionTexture != NULL )
pPrimaryWaterRefractionTexture->SwapContents( pReplacementWaterRefractionTexture );
bool bDrew3dSkybox = false; bool bDrew3dSkybox = false;
SkyboxVisibility_t nSkyboxVisible = SKYBOX_NOT_VISIBLE; SkyboxVisibility_t nSkyboxVisible = SKYBOX_NOT_VISIBLE;
@ -2813,14 +2792,6 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus
// Return to the previous view // Return to the previous view
SetupCurrentView( vecOldOrigin, vecOldAngles, (view_id_t)iCurrentViewID ); SetupCurrentView( vecOldOrigin, vecOldAngles, (view_id_t)iCurrentViewID );
g_CurrentViewID = iCurrentViewID; //just in case the cast to view_id_t screwed up the id # g_CurrentViewID = iCurrentViewID; //just in case the cast to view_id_t screwed up the id #
//swap back the water render targets
if( pReplacementWaterReflectionTexture != NULL )
pPrimaryWaterReflectionTexture->SwapContents( pReplacementWaterReflectionTexture );
if( pReplacementWaterRefractionTexture != NULL )
pPrimaryWaterRefractionTexture->SwapContents( pReplacementWaterRefractionTexture );
} }
void CViewRender::Draw3dSkyboxworld_Portal( const CViewSetup &view, int &nClearFlags, bool &bDrew3dSkybox, SkyboxVisibility_t &nSkyboxVisible, ITexture *pRenderTarget ) void CViewRender::Draw3dSkyboxworld_Portal( const CViewSetup &view, int &nClearFlags, bool &bDrew3dSkybox, SkyboxVisibility_t &nSkyboxVisible, ITexture *pRenderTarget )

1
game/server/ai_basenpc.cpp

@ -11331,6 +11331,7 @@ CAI_BaseNPC::CAI_BaseNPC(void)
m_flHeadYaw = 0; m_flHeadYaw = 0;
m_flHeadPitch = 0; m_flHeadPitch = 0;
m_spawnEquipment = NULL_STRING; m_spawnEquipment = NULL_STRING;
m_SquadName = NULL_STRING;
m_pEnemies = new CAI_Enemies; m_pEnemies = new CAI_Enemies;
m_bIgnoreUnseenEnemies = false; m_bIgnoreUnseenEnemies = false;
m_flEyeIntegRate = 0.95; m_flEyeIntegRate = 0.95;

2
game/server/ai_behavior_lead.cpp

@ -1543,7 +1543,7 @@ void CAI_LeadGoal::InputActivate( inputdata_t &inputdata )
AI_LeadArgs_t leadArgs = { AI_LeadArgs_t leadArgs = {
GetGoalEntityName(), GetGoalEntityName(),
STRING(m_iszWaitPointName), STRING(m_iszWaitPointName),
m_spawnflags, (unsigned)m_spawnflags,
m_flWaitDistance, m_flWaitDistance,
m_flLeadDistance, m_flLeadDistance,
m_flRetrieveDistance, m_flRetrieveDistance,

2
game/server/ai_squad.cpp

@ -175,7 +175,7 @@ CAI_Squad::CAI_Squad()
void CAI_Squad::Init(string_t newName) void CAI_Squad::Init(string_t newName)
{ {
m_Name = AllocPooledString( STRING(newName) ); m_Name = newName;
m_pNextSquad = NULL; m_pNextSquad = NULL;
m_flSquadSoundWaitTime = 0; m_flSquadSoundWaitTime = 0;
m_SquadMembers.RemoveAll(); m_SquadMembers.RemoveAll();

2
game/server/func_dust.cpp

@ -162,7 +162,7 @@ void CFunc_Dust::Spawn()
//Since keyvalues can arrive in any order, and UTIL_StringToColor32 stomps alpha, //Since keyvalues can arrive in any order, and UTIL_StringToColor32 stomps alpha,
//install the alpha value here. //install the alpha value here.
color32 clr = { m_Color.m_Value.r, m_Color.m_Value.g, m_Color.m_Value.b, m_iAlpha }; color32 clr = { m_Color.m_Value.r, m_Color.m_Value.g, m_Color.m_Value.b, (uint8)m_iAlpha };
m_Color.Set( clr ); m_Color.Set( clr );
BaseClass::Spawn(); BaseClass::Spawn();

2
game/server/hl1/hl1_ents.cpp

@ -289,7 +289,7 @@ bool CMultiManager::KeyValue( const char *szKeyName, const char *szValue )
{ {
char tmp[128]; char tmp[128];
UTIL_StripToken( szKeyName, tmp, Q_ARRAYSIZE( tmp ) ); UTIL_StripToken( szKeyName, tmp );
m_iTargetName [ m_cTargets ] = AllocPooledString( tmp ); m_iTargetName [ m_cTargets ] = AllocPooledString( tmp );
m_flTargetDelay [ m_cTargets ] = atof (szValue); m_flTargetDelay [ m_cTargets ] = atof (szValue);
m_cTargets++; m_cTargets++;

2
game/server/hl2/npc_scanner.cpp

@ -1988,7 +1988,7 @@ void CNPC_CScanner::BlindFlashTarget( CBaseEntity *pTarget )
if ( tr.startsolid == false && tr.fraction == 1.0) if ( tr.startsolid == false && tr.fraction == 1.0)
{ {
color32 white = { 255, 255, 255, SCANNER_FLASH_MAX_VALUE * dotPr }; color32 white = { 255, 255, 255, (uint8)(SCANNER_FLASH_MAX_VALUE * dotPr) };
if ( ( g_pMaterialSystemHardwareConfig != NULL ) && ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE ) ) if ( ( g_pMaterialSystemHardwareConfig != NULL ) && ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE ) )
{ {

2
game/server/nav_mesh.h

@ -199,7 +199,7 @@ public:
unsigned int operator()( const NavVisPair_t &item ) const unsigned int operator()( const NavVisPair_t &item ) const
{ {
COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 4 ); COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 4 );
int key[2] = { (int)item.pAreas[0] + item.pAreas[1]->GetID(), (int)item.pAreas[1] + item.pAreas[0]->GetID() }; int key[2] = { (int)(item.pAreas[0] + item.pAreas[1]->GetID()), (int)(item.pAreas[1] + item.pAreas[0]->GetID()) };
return Hash8( key ); return Hash8( key );
} }
}; };

2
game/shared/Sprite.cpp

@ -174,7 +174,7 @@ BEGIN_NETWORK_TABLE( CSprite, DT_Sprite )
END_NETWORK_TABLE() END_NETWORK_TABLE()
CSprite::CSprite() CSprite::CSprite() : BaseClass()
{ {
m_flGlowProxySize = 2.0f; m_flGlowProxySize = 2.0f;
m_flHDRColorScale = 1.0f; m_flHDRColorScale = 1.0f;

3
game/shared/basecombatweapon_shared.cpp

@ -60,7 +60,7 @@ ConVar tf_weapon_criticals_bucket_bottom( "tf_weapon_criticals_bucket_bottom", "
ConVar tf_weapon_criticals_bucket_default( "tf_weapon_criticals_bucket_default", "300.0", FCVAR_REPLICATED | FCVAR_CHEAT ); ConVar tf_weapon_criticals_bucket_default( "tf_weapon_criticals_bucket_default", "300.0", FCVAR_REPLICATED | FCVAR_CHEAT );
#endif // TF #endif // TF
CBaseCombatWeapon::CBaseCombatWeapon() CBaseCombatWeapon::CBaseCombatWeapon() : BASECOMBATWEAPON_DERIVED_FROM()
{ {
// Constructor must call this // Constructor must call this
// CONSTRUCT_PREDICTABLE( CBaseCombatWeapon ); // CONSTRUCT_PREDICTABLE( CBaseCombatWeapon );
@ -77,6 +77,7 @@ CBaseCombatWeapon::CBaseCombatWeapon()
m_nViewModelIndex = 0; m_nViewModelIndex = 0;
m_bFlipViewModel = false; m_bFlipViewModel = false;
m_iSubType = 0;
#if defined( CLIENT_DLL ) #if defined( CLIENT_DLL )
m_iState = m_iOldState = WEAPON_NOT_CARRIED; m_iState = m_iOldState = WEAPON_NOT_CARRIED;

Loading…
Cancel
Save