X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cl_video.c;h=8ea468b3475ed546b02eb6ac8a8307bd4770b776;hb=1d1828cc5ff2288943b8f00a050d46a28597bb8b;hp=8d44d9ae32fae036baa4e32b7c01d26622909b00;hpb=123d759d4e8793229127f44661afe7c1960fae99;p=xonotic%2Fdarkplaces.git diff --git a/cl_video.c b/cl_video.c index 8d44d9ae..8ea468b3 100644 --- a/cl_video.c +++ b/cl_video.c @@ -60,9 +60,9 @@ static qboolean WakeVideo( clvideo_t * video ) return false; } - video->imagedata = Mem_Alloc( cls.mempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel ); + video->imagedata = Mem_Alloc( cls.permanentmempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel ); video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name, - video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, 0, NULL ); + video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, TEXF_ALWAYSPRECACHE, NULL ); // update starttime video->starttime += realtime - video->lasttime; @@ -89,9 +89,9 @@ static clvideo_t* OpenVideo( clvideo_t *video, const char *filename, const char video->cpif.width = dpvsimpledecode_getwidth( video->stream ); video->cpif.height = dpvsimpledecode_getheight( video->stream ); video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name, - video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, 0, NULL ); + video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, TEXF_ALWAYSPRECACHE, NULL ); - video->imagedata = Mem_Alloc( cls.mempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel ); + video->imagedata = Mem_Alloc( cls.permanentmempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel ); return video; } @@ -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 ) { @@ -205,7 +205,7 @@ static void VideoFrame( clvideo_t *video ) return; } } while( video->framenum < destframe ); - R_UpdateTexture( video->cpif.tex, (unsigned char *)video->imagedata ); + R_UpdateTexture( video->cpif.tex, (unsigned char *)video->imagedata, 0, 0, video->cpif.width, video->cpif.height ); } } @@ -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; @@ -314,7 +324,7 @@ static void cl_video_start( void ) for( video = cl_videos, i = 0 ; i < cl_num_videos ; 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 ); + video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, TEXF_ALWAYSPRECACHE, NULL ); } static void cl_video_shutdown( void )