X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=cl_video.c;h=08db0588845caa8a6cea0d8e7ef9a9d367a14129;hp=624d784755278502ab5b3036705ed1cea3bed7b8;hb=ce130c7da8ce2c1cdf5e19d1823276c5ca5e83b5;hpb=70b3c52211617e1d585a1bbe805c5fd47176bfd1 diff --git a/cl_video.c b/cl_video.c index 624d7847..08db0588 100644 --- a/cl_video.c +++ b/cl_video.c @@ -5,20 +5,20 @@ #include "dpvsimpledecode.h" // VorteX: JAM video module used by Blood Omnicide -//#define USEJAM +#define USEJAM #ifdef USEJAM - #include "jamdecode.c" + #include "cl_video_jamdecode.c" #endif // cvars -cvar_t cl_video_subtitles = {CVAR_SAVE, "cl_video_subtitles", "0", "show subtitles for videos (if they are presented)"}; +cvar_t cl_video_subtitles = {CVAR_SAVE, "cl_video_subtitles", "0", "show subtitles for videos (if they are present)"}; cvar_t cl_video_subtitles_lines = {CVAR_SAVE, "cl_video_subtitles_lines", "4", "how many lines to occupy for subtitles"}; cvar_t cl_video_subtitles_textsize = {CVAR_SAVE, "cl_video_subtitles_textsize", "16", "textsize for subtitles"}; cvar_t cl_video_scale = {CVAR_SAVE, "cl_video_scale", "1", "scale of video, 1 = fullscreen, 0.75 - 3/4 of screen etc."}; -cvar_t cl_video_scale_vpos = {CVAR_SAVE, "cl_video_scale_vpos", "0", "vertial align of scaled video, -1 is top, 1 is bottom"}; +cvar_t cl_video_scale_vpos = {CVAR_SAVE, "cl_video_scale_vpos", "0", "vertical align of scaled video, -1 is top, 1 is bottom"}; cvar_t cl_video_stipple = {CVAR_SAVE, "cl_video_stipple", "0", "draw interlacing-like effect on videos, similar to scr_stipple but static and used only with video playing."}; cvar_t cl_video_brightness = {CVAR_SAVE, "cl_video_brightness", "1", "brightness of video, 1 = fullbright, 0.75 - 3/4 etc."}; -cvar_t cl_video_keepaspectratio = {CVAR_SAVE, "cl_video_keepaspectratio", "0", "keeps aspect ratio of fullscreen videos, leaving black color on unfilled areas, a value of 2 let video to be stretched horizontally with to & bottom being sliced out"}; +cvar_t cl_video_keepaspectratio = {CVAR_SAVE, "cl_video_keepaspectratio", "0", "keeps aspect ratio of fullscreen videos, leaving black color on unfilled areas, a value of 2 let video to be stretched horizontally with top & bottom being sliced out"}; cvar_t cl_video_fadein = {CVAR_SAVE, "cl_video_fadein", "0", "fading-from-black effect once video is started, in seconds"}; cvar_t cl_video_fadeout = {CVAR_SAVE, "cl_video_fadeout", "0", "fading-to-black effect once video is ended, in seconds"}; @@ -61,7 +61,7 @@ static qboolean OpenStream( 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 ); + R_UpdateTexture( video->cpif.tex, (unsigned char *)video->imagedata, 0, 0, 0, video->cpif.width, video->cpif.height, 1 ); } static void LinkVideoTexture( clvideo_t *video ) @@ -418,7 +418,7 @@ typedef struct } cl_video_subtitle_info_t; -float CL_DrawVideo_WordWidthFunc(void *passthrough, const char *w, size_t *length, float maxWidth) +static float CL_DrawVideo_WordWidthFunc(void *passthrough, const char *w, size_t *length, float maxWidth) { cl_video_subtitle_info_t *si = (cl_video_subtitle_info_t *) passthrough; @@ -432,7 +432,7 @@ float CL_DrawVideo_WordWidthFunc(void *passthrough, const char *w, size_t *lengt return 0; } -int CL_DrawVideo_DisplaySubtitleLine(void *passthrough, const char *line, size_t length, float width, qboolean isContinuation) +static int CL_DrawVideo_DisplaySubtitleLine(void *passthrough, const char *line, size_t length, float width, qboolean isContinuation) { cl_video_subtitle_info_t *si = (cl_video_subtitle_info_t *) passthrough; @@ -521,6 +521,7 @@ void CL_DrawVideo(void) if (cl_video_stipple.integer || px != 0 || py != 0 || sx != vid_conwidth.integer || sy != vid_conheight.integer) DrawQ_Fill(0, 0, vid_conwidth.integer, vid_conheight.integer, 0, 0, 0, 1, 0); +#ifndef USE_GLES2 // enable video-only polygon stipple (of global stipple is not active) if (qglPolygonStipple && !scr_stipple.integer && cl_video_stipple.integer) { @@ -538,13 +539,16 @@ void CL_DrawVideo(void) } qglPolygonStipple(stipple);CHECKGLERROR } +#endif // draw video DrawQ_SuperPic(px, py, &video->cpif, sx, sy, st[0], st[1], b, b, b, 1, st[2], st[3], b, b, b, 1, st[4], st[5], b, b, b, 1, st[6], st[7], b, b, b, 1, 0); +#ifndef USE_GLES2 // disable video-only stipple if (qglPolygonStipple && !scr_stipple.integer && cl_video_stipple.integer) qglDisable(GL_POLYGON_STIPPLE);CHECKGLERROR +#endif // VorteX: draw subtitle_text if (!video->subtitles || !cl_video_subtitles.integer) @@ -573,12 +577,13 @@ void CL_DrawVideo(void) void CL_VideoStart(char *filename, const char *subtitlesfile) { + char vabuf[1024]; Host_StartVideo(); if( cl_videos->state != CLVIDEO_UNUSED ) CL_CloseVideo( cl_videos ); // already contains video/ - if( !OpenVideo( cl_videos, filename, va( CLDYNTEXTUREPREFIX "%s", filename ), 0, subtitlesfile ) ) + if( !OpenVideo( cl_videos, filename, va(vabuf, sizeof(vabuf), CLDYNTEXTUREPREFIX "%s", filename ), 0, subtitlesfile ) ) return; // expand the active range to include the new entry cl_num_videos = max(cl_num_videos, 1); @@ -613,6 +618,9 @@ static void CL_PlayVideo_f(void) Host_StartVideo(); + if (COM_CheckParm("-benchmark")) + return; + if (Cmd_Argc() < 2) { Con_Print("usage: playvideo [custom_subtitles_file]\nplays video named video/.dpv\nif custom subtitles file is not presented\nit tries video/.sub");