From ce52d79dfc936b5a7607f5ce59e6e3fdfcaee2b5 Mon Sep 17 00:00:00 2001 From: black Date: Sat, 18 Dec 2004 23:59:46 +0000 Subject: [PATCH] -CL_Video now allows multiple streams again. It is registered as a r_module now and automatically restores the textures on r_restart. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4860 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 2 ++ cl_video.c | 27 ++++++++++++++++++++++++--- cl_video.h | 3 +-- host.c | 1 - 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/cl_main.c b/cl_main.c index 8f3e00b2..ca72d8a7 100644 --- a/cl_main.c +++ b/cl_main.c @@ -1381,6 +1381,8 @@ void CL_Init (void) CL_Particles_Init(); CL_Screen_Init(); CL_CGVM_Init(); + + CL_Video_Init(); } diff --git a/cl_video.c b/cl_video.c index 295fb79a..cd34f6f0 100644 --- a/cl_video.c +++ b/cl_video.c @@ -86,8 +86,6 @@ static clvideo_t* OpenVideo( clvideo_t *video, char *filename, char *name, int o video->framerate = dpvsimpledecode_getframerate( video->stream ); video->lasttime = realtime; - cl_videotexturepool = R_AllocTexturePool(); - video->cpif.width = dpvsimpledecode_getwidth( video->stream ); video->cpif.height = dpvsimpledecode_getheight( video->stream ); video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name, @@ -170,7 +168,6 @@ void CL_CloseVideo( clvideo_t * video ) if( !video->suspended ) { Mem_Free( video->imagedata ); R_FreeTexture( video->cpif.tex ); - R_FreeTexturePool( &cl_videotexturepool ); } video->state = CLVIDEO_UNUSED; @@ -287,6 +284,28 @@ static void CL_StopVideo_f(void) CL_VideoStop(); } +static void cl_video_start( void ) +{ + int i; + clvideo_t *video; + + cl_videotexturepool = R_AllocTexturePool(); + + for( video = videoarray, i = 0 ; i < MAXCLVIDEOS ; i++, video++ ) + if( video->state != CLVIDEO_UNUSED && !video->suspended ) + video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name, + video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, 0, NULL ); +} + +static void cl_video_shutdown( void ) +{ + R_FreeTexturePool( &cl_videotexturepool ); +} + +static void cl_video_newmap( void ) +{ +} + void CL_Video_Init( void ) { cl_videobytesperpixel = 4; @@ -298,5 +317,7 @@ void CL_Video_Init( void ) Cmd_AddCommand( "stopvideo", CL_StopVideo_f ); cl_videomempool = Mem_AllocPool( "CL_Video", 0, NULL ); + + R_RegisterModule( "CL_Video", cl_video_start, cl_video_shutdown, cl_video_newmap ); } diff --git a/cl_video.h b/cl_video.h index eff1cc5c..5d9cd2f1 100644 --- a/cl_video.h +++ b/cl_video.h @@ -2,8 +2,7 @@ #ifndef CL_VIDEO_H #define CL_VIDEO_H -//#define MAXCLVIDEOS 64 + 1 // 1 video is reserved for the cinematic mode -#define MAXCLVIDEOS 1 +#define MAXCLVIDEOS 64 + 1 // 1 video is reserved for the cinematic mode #define CLVIDEOPREFIX "_video/" #define CLTHRESHOLD 2.0 diff --git a/host.c b/host.c index 12e19eee..0b73b653 100644 --- a/host.c +++ b/host.c @@ -942,7 +942,6 @@ void Host_Init (void) if (cls.state != ca_dedicated) { VID_Open(); - CL_Video_Init(); CL_InitTEnts (); // We must wait after sound startup to load tent sounds SCR_BeginLoadingPlaque(); MR_Init(); -- 2.39.2