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 )
{
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 )
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)
} 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 );
name = PRVM_G_STRING( OFS_PARM0 );
VM_CheckEmptyString( name );
- CL_CloseVideo( CL_GetVideo( name ) );
+ CL_CloseVideo( CL_GetVideoByName( name ) );
}
/*
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 );
}
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
name = PRVM_G_STRING( OFS_PARM0 );
VM_CheckEmptyString( name );
- video = CL_GetVideo( name );
+ video = CL_GetVideoByName( name );
if( video )
CL_RestartVideo( video );
}