]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_video.c
no longer kicks off client if it got signon 1 twice during a reconnect (not sure...
[xonotic/darkplaces.git] / cl_video.c
index 7707dd77e96fceca59c288eb0e79ae45297a917b..cd34f6f07f2ddeb560543e009c67faa7de512865 100644 (file)
@@ -122,10 +122,12 @@ clvideo_t* CL_GetVideo( char *name )
        video = &videoarray[ i ];
 
        if( video->suspended )
+       {
                if( !WakeVideo( video ) )
                        return NULL;
                else if( video->state == CLVIDEO_RESETONWAKEUP ) 
                        video->framenum = -1;
+       }
 
        video->lasttime = realtime;
 
@@ -205,12 +207,14 @@ void CL_VideoFrame( void ) // update all videos
 
        for( video = videoarray, i = 0 ; i < MAXCLVIDEOS ; video++, i++ )
                if( video->state != CLVIDEO_UNUSED && !video->suspended )
+               {
                        if( realtime - video->lasttime > CLTHRESHOLD )
                                SuspendVideo( video );
                        else if( video->state == CLVIDEO_PAUSE )
-                               video->starttime = realtime + video->framenum * video->framerate;
+                               video->starttime = realtime - video->framenum * video->framerate;
                        else 
                                VideoFrame( video );
+               }
 
        if( videoarray->state == CLVIDEO_FIRSTFRAME )
                CL_VideoStop();
@@ -222,7 +226,6 @@ void CL_Video_Shutdown( void )
        for( i = 0 ; i < MAXCLVIDEOS ; i++ )
                CL_CloseVideo( &videoarray[ i ] );
 
-       R_FreeTexturePool( &cl_videotexturepool );
        Mem_FreePool( &cl_videomempool );
 }
 
@@ -281,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;
@@ -288,9 +313,11 @@ void CL_Video_Init( void )
        cl_videogmask = BigLong(0x00FF0000);
        cl_videobmask = BigLong(0x0000FF00);
 
-       cl_videomempool = Mem_AllocPool( "CL_Video", 0, NULL );
-       cl_videotexturepool = R_AllocTexturePool();
-
        Cmd_AddCommand( "playvideo", CL_PlayVideo_f );
        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 );
 }
+