]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix a bug in the video system.
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 4 Mar 2006 14:45:35 +0000 (14:45 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 4 Mar 2006 14:45:35 +0000 (14:45 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6066 d7cf8633-e32d-0410-b094-e92efae38249

cl_video.c
cl_video.h
gl_draw.c
prvm_cmds.c

index 038276bb4007b0139d32cb577580540cb2d17722..64e023070ee1adf3cbc4506de68a8107a6d9de75 100644 (file)
@@ -112,18 +112,9 @@ clvideo_t* CL_OpenVideo( const char *filename, const char *name, int owner )
        return video;
 }
 
-clvideo_t* CL_GetVideo( const char *name )
+static clvideo_t* CL_GetVideoBySlot( int slot )
 {
-       int i;
-       clvideo_t *video;
-
-       for( i = 0 ; i < cl_activevideos ; i++ )
-               if( videoarray[ i ].state != CLVIDEO_UNUSED
-                       &&      !strcmp( videoarray[ i ].cpif.name , name ) )
-                       break;
-       if( i == cl_activevideos )
-               return NULL;
-       video = &videoarray[ i ];
+       clvideo_t *video = &videoarray[ slot ];
 
        if( video->suspended )
        {
@@ -138,6 +129,20 @@ clvideo_t* CL_GetVideo( const char *name )
        return video;
 }
 
+clvideo_t *CL_GetVideoByName( const char *name )
+{
+       int i;
+
+       for( i = 0 ; i < cl_activevideos ; i++ )
+               if( videoarray[ i ].state != CLVIDEO_UNUSED
+                       &&      !strcmp( videoarray[ i ].cpif.name , name ) )
+                       break;
+       if( i != cl_activevideos )
+               return CL_GetVideoBySlot( i );
+       else
+               return NULL;
+}
+
 void CL_SetVideoState( clvideo_t *video, clvideostate_t state )
 {
        if( !video )
@@ -251,7 +256,7 @@ int cl_videoplaying = false; // old, but still supported
 void CL_DrawVideo(void)
 {
        if (cl_videoplaying)
-               DrawQ_Pic(0, 0, &videoarray->cpif, vid_conwidth.integer, vid_conheight.integer, 1, 1, 1, 1, 0);
+               DrawQ_Pic(0, 0, &CL_GetVideoBySlot( 0 )->cpif, vid_conwidth.integer, vid_conheight.integer, 1, 1, 1, 1, 0);
 }
 
 void CL_VideoStart(char *filename)
index 8439e92cc65ba80ceac47048f3c2439258779814..878d24941babc5296b1e570504beaa588de22477 100644 (file)
@@ -46,7 +46,7 @@ typedef struct clvideo_s
 } clvideo_t;
 
 clvideo_t*     CL_OpenVideo( const char *filename, const char *name, int owner );
-clvideo_t*     CL_GetVideo( const char *name );
+clvideo_t*     CL_GetVideoByName( const char *name );
 void           CL_SetVideoState( clvideo_t *video, clvideostate_t state );
 void           CL_RestartVideo( clvideo_t *video );
 
index b908a2429e2fecda4292f23aa67fcc866090f3df..f618099724e9c68bfe6df50a66c8e1765254ef13 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -310,7 +310,7 @@ cachepic_t  *Draw_CachePic (const char *path, qboolean persistent)
        {
                clvideo_t *video;
 
-               video = CL_GetVideo(path);
+               video = CL_GetVideoByName(path);
                if( video )
                        return &video->cpif;
        }
index ee88193313dbe8e1ec7ca476ab279a49857198c7..8f0a3fd944198ee53638046352ac9dac29e05a12 100644 (file)
@@ -2705,7 +2705,7 @@ void VM_cin_close( void )
        name = PRVM_G_STRING( OFS_PARM0 );
        VM_CheckEmptyString( name );
 
-       CL_CloseVideo( CL_GetVideo( name ) );
+       CL_CloseVideo( CL_GetVideoByName( name ) );
 }
 
 /*
@@ -2727,7 +2727,7 @@ void VM_cin_setstate( void )
 
        state = (clvideostate_t)((int)PRVM_G_FLOAT( OFS_PARM1 ));
 
-       video = CL_GetVideo( name );
+       video = CL_GetVideoByName( name );
        if( video && state > CLVIDEO_UNUSED && state < CLVIDEO_STATECOUNT )
                CL_SetVideoState( video, state );
 }
@@ -2749,7 +2749,7 @@ void VM_cin_getstate( void )
        name = PRVM_G_STRING( OFS_PARM0 );
        VM_CheckEmptyString( name );
 
-       video = CL_GetVideo( name );
+       video = CL_GetVideoByName( name );
        if( video )
                PRVM_G_FLOAT( OFS_RETURN ) = (int)video->state;
        else
@@ -2773,7 +2773,7 @@ void VM_cin_restart( void )
        name = PRVM_G_STRING( OFS_PARM0 );
        VM_CheckEmptyString( name );
 
-       video = CL_GetVideo( name );
+       video = CL_GetVideoByName( name );
        if( video )
                CL_RestartVideo( video );
 }