From: vortex Date: Mon, 18 Oct 2010 01:07:41 +0000 (+0000) Subject: Properly unlink video texture and suspend videos on r_restart, so they actually survi... X-Git-Tag: xonotic-v0.1.0preview~107 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=5162d674e9fb02e9a9247b8fe21050cd1657f6fe;p=xonotic%2Fdarkplaces.git Properly unlink video texture and suspend videos on r_restart, so they actually survive it. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10547 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=3c58439e9d34602b755bd630d2fb96a83d2f82b6 --- diff --git a/cl_video.c b/cl_video.c index a6a5e0ea..f3595f3d 100644 --- a/cl_video.c +++ b/cl_video.c @@ -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 ); }