X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cl_video.c;h=42c0496d679026ff9e5229329b32cd27bd6321cc;hb=4c357d1b72ef15a540af76b1e62a9ed7952a9563;hp=fabce36c33d626199edd0b9384d205969f0e77f0;hpb=176db0d8c03f85c51f9afdb7f8478ad89cb91aa8;p=xonotic%2Fdarkplaces.git diff --git a/cl_video.c b/cl_video.c index fabce36c..42c0496d 100644 --- a/cl_video.c +++ b/cl_video.c @@ -72,11 +72,11 @@ static qboolean WakeVideo( clvideo_t * video ) static clvideo_t* OpenVideo( clvideo_t *video, const char *filename, const char *name, int owner ) { - strncpy( video->filename, filename, MAX_QPATH ); + strlcpy( video->filename, filename, sizeof(video->filename) ); video->ownertag = owner; if( strncmp( name, CLVIDEOPREFIX, sizeof( CLVIDEOPREFIX ) - 1 ) ) return NULL; - strncpy( video->cpif.name, name, MAX_QPATH ); + strlcpy( video->cpif.name, name, sizeof(video->cpif.name) ); if( !OpenStream( video ) ) return NULL; @@ -189,7 +189,7 @@ static void VideoFrame( clvideo_t *video ) if( video->state == CLVIDEO_FIRSTFRAME ) destframe = 0; else - destframe = (realtime - video->starttime) * video->framerate; + destframe = (int)((realtime - video->starttime) * video->framerate); if( destframe < 0 ) destframe = 0; if( video->framenum < destframe ) { @@ -276,6 +276,16 @@ void CL_VideoStart(char *filename) CL_RestartVideo( cl_videos ); } +void CL_Video_KeyEvent( int key, int ascii, qboolean down ) +{ + // only react to up events, to allow the user to delay the abortion point if it suddenly becomes interesting.. + if( !down ) { + if( key == K_ESCAPE || key == K_ENTER || key == K_SPACE ) { + CL_VideoStop(); + } + } +} + void CL_VideoStop(void) { cl_videoplaying = false;