Browse Source

game: init uninitialized variables

sanitize
nillerusr 3 years ago
parent
commit
600695b15f
  1. 4
      game/client/c_baseanimating.cpp
  2. 11
      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. 3
      game/client/hud_basechat.cpp
  7. 2
      game/client/view.cpp
  8. 45
      game/client/viewrender.cpp
  9. 1
      game/server/ai_basenpc.cpp
  10. 2
      game/server/ai_behavior_lead.cpp
  11. 6
      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() : @@ -677,6 +677,8 @@ C_BaseAnimating::C_BaseAnimating() :
m_pRagdoll = NULL;
m_builtRagdoll = false;
m_hitboxBoneCacheHandle = 0;
m_nHitboxSet = 0;
int i;
for ( i = 0; i < ARRAYSIZE( m_flEncodedController ); i++ )
{
@ -694,6 +696,8 @@ C_BaseAnimating::C_BaseAnimating() : @@ -694,6 +696,8 @@ C_BaseAnimating::C_BaseAnimating() :
m_bStoreRagdollInfo = false;
m_pRagdollInfo = NULL;
m_pJiggleBones = NULL;
m_pBoneMergeCache = NULL;
m_flPlaybackRate = 1.0f;

11
game/client/c_baseentity.cpp

@ -903,6 +903,7 @@ C_BaseEntity::C_BaseEntity() : @@ -903,6 +903,7 @@ C_BaseEntity::C_BaseEntity() :
m_DataChangeEventRef = -1;
m_EntClientFlags = 0;
m_bEnableRenderingClipPlane = false;
m_iParentAttachment = 0;
m_nRenderFXBlend = 255;
@ -940,10 +941,12 @@ C_BaseEntity::C_BaseEntity() : @@ -940,10 +941,12 @@ C_BaseEntity::C_BaseEntity() :
#if !defined( NO_ENTITY_PREDICTION )
m_pPredictionContext = NULL;
#endif
//NOTE: not virtual! we are in the constructor!
C_BaseEntity::Clear();
SetModelName( NULL_STRING );
m_iClassname = NULL_STRING;
m_InterpolationListEntry = 0xFFFF;
m_TeleportListEntry = 0xFFFF;
@ -984,7 +987,6 @@ C_BaseEntity::~C_BaseEntity() @@ -984,7 +987,6 @@ C_BaseEntity::~C_BaseEntity()
void C_BaseEntity::Clear( void )
{
m_bDormant = true;
m_nCreationTick = -1;
m_RefEHandle.Term();
m_ModelInstance = MODEL_INSTANCE_INVALID;
@ -998,6 +1000,7 @@ void C_BaseEntity::Clear( void ) @@ -998,6 +1000,7 @@ void C_BaseEntity::Clear( void )
SetLocalOrigin( vec3_origin );
SetLocalAngles( vec3_angle );
model = NULL;
m_pOriginalData = NULL;
m_vecAbsOrigin.Init();
m_angAbsRotation.Init();
m_vecVelocity.Init();
@ -3741,7 +3744,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd @@ -3741,7 +3744,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd
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 );
}
break;

2
game/client/c_baseflex.h

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

2
game/client/c_func_occluder.cpp

@ -24,7 +24,7 @@ public: @@ -24,7 +24,7 @@ public:
private:
int m_nOccluderIndex;
bool m_bActive;
bool m_bActive = false;
};
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 @@ -1539,7 +1539,7 @@ void CTempEnts::BloodSprite( const Vector &org, int r, int g, int b, int a, int
{
C_LocalTempEntity *pTemp;
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
if ( ( pTemp = TempEntAllocHigh( org, model ) ) != NULL )

3
game/client/hud_basechat.cpp

@ -633,6 +633,7 @@ CBaseHudChat::CBaseHudChat( const char *pElementName ) @@ -633,6 +633,7 @@ CBaseHudChat::CBaseHudChat( const char *pElementName )
}
m_pChatHistory = new CHudChatHistory( this, "HudChatHistory" );
m_pFilterPanel = NULL;
CreateChatLines();
CreateChatInputLine();
@ -1829,4 +1830,4 @@ void CBaseHudChat::FireGameEvent( IGameEvent *event ) @@ -1829,4 +1830,4 @@ void CBaseHudChat::FireGameEvent( IGameEvent *event )
ChatPrintf( player->entindex(), CHAT_FILTER_NONE, "(SourceTV) %s", event->GetString( "text" ) );
}
#endif
}
}

2
game/client/view.cpp

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

45
game/client/viewrender.cpp

@ -1435,8 +1435,8 @@ static void GetFogColorTransition( fogparams_t *pFogParams, float *pColorPrimary @@ -1435,8 +1435,8 @@ static void GetFogColorTransition( fogparams_t *pFogParams, float *pColorPrimary
{
float flPercent = 1.0f - (( pFogParams->lerptime - gpGlobals->curtime ) / pFogParams->duration );
float flPrimaryColorLerp[3] = { pFogParams->colorPrimaryLerpTo.GetR(), pFogParams->colorPrimaryLerpTo.GetG(), pFogParams->colorPrimaryLerpTo.GetB() };
float flSecondaryColorLerp[3] = { pFogParams->colorSecondaryLerpTo.GetR(), pFogParams->colorSecondaryLerpTo.GetG(), pFogParams->colorSecondaryLerpTo.GetB() };
float flPrimaryColorLerp[3] = { (float)pFogParams->colorPrimaryLerpTo.GetR(), (float)pFogParams->colorPrimaryLerpTo.GetG(), (float)pFogParams->colorPrimaryLerpTo.GetB() };
float flSecondaryColorLerp[3] = { (float)pFogParams->colorSecondaryLerpTo.GetR(), (float)pFogParams->colorSecondaryLerpTo.GetG(), (float)pFogParams->colorSecondaryLerpTo.GetB() };
CheckAndTransitionColor( flPercent, pColorPrimary, flPrimaryColorLerp );
CheckAndTransitionColor( flPercent, pColorSecondary, flSecondaryColorLerp );
@ -1459,8 +1459,8 @@ static void GetFogColor( fogparams_t *pFogParams, float *pColor ) @@ -1459,8 +1459,8 @@ static void GetFogColor( fogparams_t *pFogParams, float *pColor )
}
else
{
float flPrimaryColor[3] = { pFogParams->colorPrimary.GetR(), pFogParams->colorPrimary.GetG(), pFogParams->colorPrimary.GetB() };
float flSecondaryColor[3] = { pFogParams->colorSecondary.GetR(), pFogParams->colorSecondary.GetG(), pFogParams->colorSecondary.GetB() };
float flPrimaryColor[3] = { (float)pFogParams->colorPrimary.GetR(), (float)pFogParams->colorPrimary.GetG(), (float)pFogParams->colorPrimary.GetB() };
float flSecondaryColor[3] = { (float)pFogParams->colorSecondary.GetR(), (float)pFogParams->colorSecondary.GetG(), (float)pFogParams->colorSecondary.GetB() };
GetFogColorTransition( pFogParams, flPrimaryColor, flSecondaryColor );
@ -2689,6 +2689,7 @@ bool DoesViewPlaneIntersectWater( float waterZ, int leafWaterDataID ) @@ -2689,6 +2689,7 @@ bool DoesViewPlaneIntersectWater( float waterZ, int leafWaterDataID )
// &view - the camera view to render from
// nClearFlags - how to clear the buffer
//-----------------------------------------------------------------------------
void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCustomVisibility_t *pCustomVisibility )
{
VPROF( "CViewRender::ViewDrawScene_PortalStencil" );
@ -2700,28 +2701,6 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus @@ -2700,28 +2701,6 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus
QAngle vecOldAngles = CurrentViewAngles();
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;
SkyboxVisibility_t nSkyboxVisible = SKYBOX_NOT_VISIBLE;
@ -2738,7 +2717,7 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus @@ -2738,7 +2717,7 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus
//generate unique view ID's for each stencil view
view_id_t iNewViewID = (view_id_t)g_pPortalRender->GetCurrentViewId();
SetupCurrentView( view.origin, view.angles, (view_id_t)iNewViewID );
// update vis data
unsigned int visFlags;
SetupVis( view, visFlags, pCustomVisibility );
@ -2757,10 +2736,10 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus @@ -2757,10 +2736,10 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus
DetermineWaterRenderInfo( fogInfo, waterInfo );
if ( waterInfo.m_bCheapWater )
{
{
cplane_t glassReflectionPlane;
if ( IsReflectiveGlassInView( viewIn, glassReflectionPlane ) )
{
{
CRefPtr<CReflectiveGlassView> pGlassReflectionView = new CReflectiveGlassView( this );
pGlassReflectionView->Setup( viewIn, VIEW_CLEAR_DEPTH | VIEW_CLEAR_COLOR | VIEW_CLEAR_OBEY_STENCIL, drawSkybox, fogInfo, waterInfo, glassReflectionPlane );
AddViewToScene( pGlassReflectionView );
@ -2813,14 +2792,6 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus @@ -2813,14 +2792,6 @@ void CViewRender::ViewDrawScene_PortalStencil( const CViewSetup &viewIn, ViewCus
// Return to the previous view
SetupCurrentView( vecOldOrigin, vecOldAngles, (view_id_t)iCurrentViewID );
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 )

1
game/server/ai_basenpc.cpp

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

2
game/server/ai_behavior_lead.cpp

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

6
game/server/ai_squad.cpp

@ -153,7 +153,7 @@ END_DATADESC() @@ -153,7 +153,7 @@ END_DATADESC()
//-------------------------------------
CAI_Squad::CAI_Squad(string_t newName)
CAI_Squad::CAI_Squad(string_t newName)
#ifndef PER_ENEMY_SQUADSLOTS
: m_squadSlotsUsed(MAX_SQUADSLOTS)
#endif
@ -163,7 +163,7 @@ CAI_Squad::CAI_Squad(string_t newName) @@ -163,7 +163,7 @@ CAI_Squad::CAI_Squad(string_t newName)
//-------------------------------------
CAI_Squad::CAI_Squad()
CAI_Squad::CAI_Squad()
#ifndef PER_ENEMY_SQUADSLOTS
: m_squadSlotsUsed(MAX_SQUADSLOTS)
#endif
@ -175,7 +175,7 @@ CAI_Squad::CAI_Squad() @@ -175,7 +175,7 @@ CAI_Squad::CAI_Squad()
void CAI_Squad::Init(string_t newName)
{
m_Name = AllocPooledString( STRING(newName) );
m_Name = newName;
m_pNextSquad = NULL;
m_flSquadSoundWaitTime = 0;
m_SquadMembers.RemoveAll();

2
game/server/func_dust.cpp

@ -162,7 +162,7 @@ void CFunc_Dust::Spawn() @@ -162,7 +162,7 @@ void CFunc_Dust::Spawn()
//Since keyvalues can arrive in any order, and UTIL_StringToColor32 stomps alpha,
//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 );
BaseClass::Spawn();

2
game/server/hl1/hl1_ents.cpp

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

2
game/server/hl2/npc_scanner.cpp

@ -1988,7 +1988,7 @@ void CNPC_CScanner::BlindFlashTarget( CBaseEntity *pTarget ) @@ -1988,7 +1988,7 @@ void CNPC_CScanner::BlindFlashTarget( CBaseEntity *pTarget )
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 ) )
{

2
game/server/nav_mesh.h

@ -199,7 +199,7 @@ public: @@ -199,7 +199,7 @@ public:
unsigned int operator()( const NavVisPair_t &item ) const
{
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 );
}
};

2
game/shared/Sprite.cpp

@ -174,7 +174,7 @@ BEGIN_NETWORK_TABLE( CSprite, DT_Sprite ) @@ -174,7 +174,7 @@ BEGIN_NETWORK_TABLE( CSprite, DT_Sprite )
END_NETWORK_TABLE()
CSprite::CSprite()
CSprite::CSprite() : BaseClass()
{
m_flGlowProxySize = 2.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", " @@ -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 );
#endif // TF
CBaseCombatWeapon::CBaseCombatWeapon()
CBaseCombatWeapon::CBaseCombatWeapon() : BASECOMBATWEAPON_DERIVED_FROM()
{
// Constructor must call this
// CONSTRUCT_PREDICTABLE( CBaseCombatWeapon );
@ -77,6 +77,7 @@ CBaseCombatWeapon::CBaseCombatWeapon() @@ -77,6 +77,7 @@ CBaseCombatWeapon::CBaseCombatWeapon()
m_nViewModelIndex = 0;
m_bFlipViewModel = false;
m_iSubType = 0;
#if defined( CLIENT_DLL )
m_iState = m_iOldState = WEAPON_NOT_CARRIED;

Loading…
Cancel
Save