From 6516be2fed3ad47f49ce7ce4f6757d2eb2c61e4d Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Fri, 11 Feb 2011 14:46:34 +0000 Subject: [PATCH] Support non-256x256 videos in shaders, by Zack Middleton (#4745) --- code/client/cl_cin.c | 132 +++++++++++++++++++++++++++---------------- 1 file changed, 84 insertions(+), 48 deletions(-) diff --git a/code/client/cl_cin.c b/code/client/cl_cin.c index 12556658..3bb20cce 100644 --- a/code/client/cl_cin.c +++ b/code/client/cl_cin.c @@ -1508,6 +1508,66 @@ void CIN_SetLooping(int handle, qboolean loop) { cinTable[handle].looping = loop; } +/* +================== +CIN_ResampleCinematic + +Resample cinematic to 256x256 and store in buf2 +================== +*/ +void CIN_ResampleCinematic(int handle, int *buf2) { + int ix, iy, *buf3, xm, ym, ll; + byte *buf; + + buf = cinTable[handle].buf; + + xm = cinTable[handle].CIN_WIDTH/256; + ym = cinTable[handle].CIN_HEIGHT/256; + ll = 8; + if (cinTable[handle].CIN_WIDTH==512) { + ll = 9; + } + + buf3 = (int*)buf; + if (xm==2 && ym==2) { + byte *bc2, *bc3; + int ic, iiy; + + bc2 = (byte *)buf2; + bc3 = (byte *)buf3; + for (iy = 0; iy<256; iy++) { + iiy = iy<<12; + for (ix = 0; ix<2048; ix+=8) { + for(ic = ix;ic<(ix+4);ic++) { + *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic]+bc3[iiy+2048+ic]+bc3[iiy+2048+4+ic])>>2; + bc2++; + } + } + } + } else if (xm==2 && ym==1) { + byte *bc2, *bc3; + int ic, iiy; + + bc2 = (byte *)buf2; + bc3 = (byte *)buf3; + for (iy = 0; iy<256; iy++) { + iiy = iy<<11; + for (ix = 0; ix<2048; ix+=8) { + for(ic = ix;ic<(ix+4);ic++) { + *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic])>>1; + bc2++; + } + } + } + } else { + for (iy = 0; iy<256; iy++) { + for (ix = 0; ix<256; ix++) { + buf2[(iy<<8)+ix] = buf3[((iy*ym)<>2; - bc2++; - } - } - } - } else if (xm==2 && ym==1) { - byte *bc2, *bc3; - int ic, iiy; - - bc2 = (byte *)buf2; - bc3 = (byte *)buf3; - for (iy = 0; iy<256; iy++) { - iiy = iy<<11; - for (ix = 0; ix<2048; ix+=8) { - for(ic = ix;ic<(ix+4);ic++) { - *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic])>>1; - bc2++; - } - } - } - } else { - for (iy = 0; iy<256; iy++) { - for (ix = 0; ix<256; ix++) { - buf2[(iy<<8)+ix] = buf3[((iy*ym)<integer == 0 && cinTable[handle].playonwalls == 1) { cinTable[handle].playonwalls--; }