game: init uninitialized variables

This commit is contained in:
nillerusr
2022-05-01 20:09:55 +03:00
parent 61cd8d0afc
commit 600695b15f
17 changed files with 37 additions and 56 deletions
+4
View File
@@ -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() :
m_bStoreRagdollInfo = false;
m_pRagdollInfo = NULL;
m_pJiggleBones = NULL;
m_pBoneMergeCache = NULL;
m_flPlaybackRate = 1.0f;
+7 -4
View File
@@ -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() :
#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()
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 )
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
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;
+1 -1
View File
@@ -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 );
+1 -1
View File
@@ -24,7 +24,7 @@ public:
private:
int m_nOccluderIndex;
bool m_bActive;
bool m_bActive = false;
};
IMPLEMENT_CLIENTCLASS_DT( C_FuncOccluder, DT_FuncOccluder, CFuncOccluder )
+1 -1
View File
@@ -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 )
+2 -1
View File
@@ -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 )
ChatPrintf( player->entindex(), CHAT_FILTER_NONE, "(SourceTV) %s", event->GetString( "text" ) );
}
#endif
}
}
+1 -1
View File
@@ -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 );
+8 -37
View File
@@ -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 )
}
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 )
// &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
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
//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
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
// 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 )