]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Properly unlink video texture and suspend videos on r_restart, so they actually survi...
authorvortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 18 Oct 2010 01:07:41 +0000 (01:07 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 18 Oct 2010 07:31:25 +0000 (09:31 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10547 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=3c58439e9d34602b755bd630d2fb96a83d2f82b6

cl_video.c

index a6a5e0ea5262b9f6a65c8535408e8dec90cc1953..f3595f3df29ecd715b627314ee9ba5abb7521580 100644 (file)
@@ -49,17 +49,20 @@ static void VideoUpdateCallback(rtexture_t *rt, void *data) {
        R_UpdateTexture( video->cpif.tex, (unsigned char *)video->imagedata, 0, 0, video->cpif.width, video->cpif.height );
 }
 
-static void LinkVideoTexture( clvideo_t *video ) {
+static void LinkVideoTexture( clvideo_t *video )
+{
        video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name,
                video->cpif.width, video->cpif.height, NULL, TEXTYPE_BGRA, TEXF_PERSISTENT, -1, NULL );
        R_MakeTextureDynamic( video->cpif.tex, VideoUpdateCallback, video );
        CL_LinkDynTexture( video->cpif.name, video->cpif.tex );
 }
 
-static void UnlinkVideoTexture( clvideo_t *video ) {
+static void UnlinkVideoTexture( clvideo_t *video )
+{
        CL_UnlinkDynTexture( video->cpif.name );
        // free the texture
        R_FreeTexture( video->cpif.tex );
+       video->cpif.tex = NULL;
        // free the image data
        Mem_Free( video->imagedata );
 }
@@ -576,7 +579,13 @@ static void cl_video_start( void )
 
 static void cl_video_shutdown( void )
 {
-       // TODO: unlink video textures?
+       int i;
+       clvideo_t *video;
+
+       for( video = cl_videos, i = 0 ; i < cl_num_videos ; i++, video++ )
+               if( video->state != CLVIDEO_UNUSED && !video->suspended )
+                       SuspendVideo( video );
+
        R_FreeTexturePool( &cl_videotexturepool );
 }