]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
-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 8f3e00b274127c21f2970451eb44eb5d922da1b6..ca72d8a72aa88dc91582840ba8efff271f9c2724 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 295fb79a71b5f9dc9193404313d327c41a90d5a6..cd34f6f07f2ddeb560543e009c67faa7de512865 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 eff1cc5c2f7ea1b6aae26facce748b2b0ef50bd8..5d9cd2f16f0d55e8e398ce698be960f9891aca5a 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 12e19eee786dfa47d2bf0ecae0b5ae8b4ef0203c..0b73b6539cb66325e4cf14ac3a4a214a5981858e 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();