Skip to content

Commit 26d2f5e

Browse files
committed
slight refactoring
1 parent 1e5ae2d commit 26d2f5e

2 files changed

Lines changed: 26 additions & 42 deletions

File tree

src/game/client/swarm/vgui/nb_header_footer.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ CASW_Background_Movie* ASWBackgroundMovie()
3636
CASW_Background_Movie::CASW_Background_Movie()
3737
{
3838
m_nMaterialType = MATERIAL_INVALID;
39-
m_nBIKMaterial = BIKMATERIAL_INVALID;
4039
m_nTextureID = -1;
4140
m_szCurrentMovie[0] = 0;
4241
m_nLastGameState = -1;
@@ -113,7 +112,7 @@ void CASW_Background_Movie::SetCurrentMovie( const char *szFilename )
113112
g_pWEBM->DestroyVideoMaterial( m_pWEBMMaterial );
114113
break;
115114
case MATERIAL_BIK:
116-
g_pBIK->DestroyMaterial(m_nBIKMaterial);
115+
g_pBIK->DestroyMaterial( m_nBIKMaterial );
117116
break;
118117
}
119118
m_nMaterialType = MATERIAL_INVALID;
@@ -123,7 +122,6 @@ void CASW_Background_Movie::SetCurrentMovie( const char *szFilename )
123122
const char* ext = Q_GetFileExtension(szFilename);
124123
if (ext && !Q_stricmp(ext, "webm"))
125124
{
126-
// Utwórz materia³ WebM
127125
char szMaterialName[MAX_PATH];
128126
Q_snprintf(szMaterialName, sizeof(szMaterialName), "BackgroundWebMMaterial%i", g_pWEBM->GetUniqueMaterialID());
129127

@@ -163,7 +161,7 @@ void CASW_Background_Movie::ClearCurrentMovie()
163161
g_pWEBM->DestroyVideoMaterial( m_pWEBMMaterial );
164162
break;
165163
case MATERIAL_BIK:
166-
g_pBIK->DestroyMaterial(m_nBIKMaterial);
164+
g_pBIK->DestroyMaterial( m_nBIKMaterial );
167165
break;
168166
}
169167
m_nMaterialType = MATERIAL_INVALID;
@@ -272,15 +270,8 @@ void CASW_Background_Movie::Update( bool bForce )
272270

273271
if ( !m_pWEBMMaterial->Update() )
274272
{
275-
if ( m_pWEBMMaterial->IsLooping() )
276-
{
277-
m_pWEBMMaterial->SetTime( 0.0f );
278-
}
279-
else
280-
{
281-
g_pWEBM->DestroyVideoMaterial( m_pWEBMMaterial );
282-
m_nMaterialType = MATERIAL_INVALID;
283-
}
273+
g_pWEBM->DestroyVideoMaterial( m_pWEBMMaterial );
274+
m_nMaterialType = MATERIAL_INVALID;
284275
}
285276
break;
286277
case MATERIAL_BIK:

src/game/client/videoservices/video_material.cpp

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,6 @@ void CVideoMaterial::CreateVideoMaterial( const char* pMaterialName )
313313
m_textureWidth = ALIGN_VALUE(m_videoWidth, 8);
314314
m_textureHeight = ALIGN_VALUE(m_videoHeight, 8);
315315

316-
//Warning("\nm_textureWidth: %d\nm_textureHeight: %d\nm_videoWidth: %d\nm_videoHeight: %d\n", m_textureWidth, m_textureHeight, m_videoWidth, m_videoHeight);
317-
318-
319316
// create the textures
320317
m_yTexture.InitProceduralTexture( ytexture, "VideoCacheTextures", m_textureWidth, m_textureHeight, IMAGE_FORMAT_I8, tex_flags );
321318
// CB and CR are half the size of the Y (the brightness)
@@ -329,31 +326,6 @@ void CVideoMaterial::CreateVideoMaterial( const char* pMaterialName )
329326
m_crTexture->SetTextureRegenerator( m_crTextureRegen );
330327
m_cbTexture->SetTextureRegenerator( m_cbTextureRegen );
331328

332-
333-
// ---------------------------
334-
// material
335-
//
336-
// Use the Bik shader as it deals with YUV420
337-
KeyValues* pVMTKeyValues = new KeyValues( "Bik" );
338-
pVMTKeyValues->SetString( "$ytexture", ytexture );
339-
pVMTKeyValues->SetString( "$cbtexture", cbtexture );
340-
pVMTKeyValues->SetString( "$crtexture", crtexture );
341-
pVMTKeyValues->SetInt( "$nofog", 1 );
342-
pVMTKeyValues->SetInt( "$spriteorientation", 3 );
343-
pVMTKeyValues->SetInt( "$translucent", 1 );
344-
pVMTKeyValues->SetInt( "$nolod", 1 );
345-
pVMTKeyValues->SetInt( "$vertexcolor", 1 );
346-
pVMTKeyValues->SetInt( "$vertexalpha", 1 );
347-
pVMTKeyValues->SetInt( "$nomip", 1 );
348-
m_videoMaterial.Init( pMaterialName, pVMTKeyValues );
349-
350-
// Refresh the material vars because apparently init doesn't do this
351-
// and retains the previous video's frame
352-
m_videoMaterial->Refresh();
353-
354-
m_videoReady = true;
355-
m_videoStarted = false;
356-
357329
// update the procedural texture with the first frame of the video
358330
WebMFrame video_frame;
359331
VPXDecoder::Image image;
@@ -376,8 +348,29 @@ void CVideoMaterial::CreateVideoMaterial( const char* pMaterialName )
376348
break;
377349
}
378350
}
379-
380351
m_demuxer->resetVideo();
352+
353+
// ---------------------------
354+
// material
355+
// Use the Bik shader as it deals with YUV420
356+
KeyValues* pVMTKeyValues = new KeyValues( "Bik" );
357+
pVMTKeyValues->SetString( "$ytexture", ytexture );
358+
pVMTKeyValues->SetString( "$cbtexture", cbtexture );
359+
pVMTKeyValues->SetString( "$crtexture", crtexture );
360+
pVMTKeyValues->SetInt( "$nofog", 1 );
361+
pVMTKeyValues->SetInt( "$spriteorientation", 3 );
362+
pVMTKeyValues->SetInt( "$translucent", 1 );
363+
pVMTKeyValues->SetInt( "$nolod", 1 );
364+
pVMTKeyValues->SetInt( "$vertexcolor", 1 );
365+
pVMTKeyValues->SetInt( "$vertexalpha", 1 );
366+
pVMTKeyValues->SetInt( "$nomip", 1 );
367+
m_videoMaterial.Init( pMaterialName, pVMTKeyValues );
368+
// Refresh the material vars because apparently init doesn't do this
369+
// and retains the previous video's frame
370+
m_videoMaterial->Refresh();
371+
372+
m_videoReady = true;
373+
m_videoStarted = false;
381374
}
382375

383376
const char *CVideoMaterial::GetVideoFileName()

0 commit comments

Comments
 (0)