X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=cl_video.c;h=fcfd0d0a96b452ec84cace550305635de677753c;hb=077ab7429f22daaf1cf6c9cb4801127444eecbe7;hp=d12854086f2deaf4fd790a1fbd53b3acdf8d2820;hpb=d5892a29c4f1e6954eb59ffc790d29d3f9925fe2;p=xonotic%2Fdarkplaces.git diff --git a/cl_video.c b/cl_video.c index d1285408..fcfd0d0a 100644 --- a/cl_video.c +++ b/cl_video.c @@ -35,13 +35,14 @@ static qboolean OpenStream( clvideo_t * video ) return true; } -static void VideoUpdateCallback(rtexture_t *rt, clvideo_t *video) { +static void VideoUpdateCallback(rtexture_t *rt, void *data) { + clvideo_t *video = (clvideo_t *) data; R_UpdateTexture( video->cpif.tex, (unsigned char *)video->imagedata, 0, 0, video->cpif.width, video->cpif.height ); } static void LinkVideoTexture( clvideo_t *video ) { video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name, - video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, TEXF_ALWAYSPRECACHE, NULL ); + video->cpif.width, video->cpif.height, NULL, TEXTYPE_BGRA, TEXF_PERSISTENT | TEXF_ALLOWUPDATES, NULL ); R_MakeTextureDynamic( video->cpif.tex, VideoUpdateCallback, video ); CL_LinkDynTexture( video->cpif.name, video->cpif.tex ); } @@ -115,9 +116,7 @@ clvideo_t* CL_OpenVideo( const char *filename, const char *name, int owner ) clvideo_t *video; // sanity check if( !name || !*name || strncmp( name, CLVIDEOPREFIX, sizeof( CLVIDEOPREFIX ) - 1 ) != 0 ) { - if( developer.integer > 0 ) { - Con_Printf( "CL_OpenVideo: Bad video texture name '%s'!\n", name ); - } + Con_DPrintf( "CL_OpenVideo: Bad video texture name '%s'!\n", name ); return NULL; } @@ -327,7 +326,7 @@ static void CL_PlayVideo_f(void) return; } - sprintf(name, "video/%s.dpv", Cmd_Argv(1)); + dpsnprintf(name, sizeof(name), "video/%s.dpv", Cmd_Argv(1)); CL_VideoStart(name); } @@ -360,11 +359,20 @@ static void cl_video_newmap( void ) void CL_Video_Init( void ) { + union + { + unsigned char b[4]; + unsigned int i; + } + bgra; + cl_num_videos = 0; cl_videobytesperpixel = 4; - cl_videormask = BigLong(0xFF000000); - cl_videogmask = BigLong(0x00FF0000); - cl_videobmask = BigLong(0x0000FF00); + + // set masks in an endian-independent way (as they really represent bytes) + bgra.i = 0;bgra.b[0] = 0xFF;cl_videobmask = bgra.i; + bgra.i = 0;bgra.b[1] = 0xFF;cl_videogmask = bgra.i; + bgra.i = 0;bgra.b[2] = 0xFF;cl_videormask = bgra.i; Cmd_AddCommand( "playvideo", CL_PlayVideo_f, "play a .dpv video file" ); Cmd_AddCommand( "stopvideo", CL_StopVideo_f, "stop playing a .dpv video file" );