-CL_Video now allows multiple streams again. It is registered as a r_module
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 18 Dec 2004 23:59:46 +0000 (23:59 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 18 Dec 2004 23:59:46 +0000 (23:59 +0000)
 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
cl_video.c
cl_video.h
host.c

index 8f3e00b..ca72d8a 100644 (file)
--- 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();
 }
 
 
index 295fb79..cd34f6f 100644 (file)
@@ -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 );
 }
 
index eff1cc5..5d9cd2f 100644 (file)
@@ -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 12e19ee..0b73b65 100644 (file)
--- 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();