diff options
Diffstat (limited to 'src/client/cl_cin.c')
-rw-r--r-- | src/client/cl_cin.c | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c index 1443937c..7690d627 100644 --- a/src/client/cl_cin.c +++ b/src/client/cl_cin.c @@ -621,7 +621,10 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) unsigned short *aptr, *bptr, *cptr, *dptr; long y0,y1,y2,y3,cr,cb; byte *bbptr, *baptr, *bcptr, *bdptr; - unsigned int *iaptr, *ibptr, *icptr, *idptr; + union { + unsigned int *i; + unsigned short *s; + } iaptr, ibptr, icptr, idptr; if (!roq_flags) { two = four = 256; @@ -664,7 +667,7 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) VQ2TO4(aptr,bptr,cptr,dptr); } } else if (cinTable[currentHandle].samplesPerPixel==4) { - ibptr = (unsigned int *)bptr; + ibptr.s = bptr; for(i=0;i<two;i++) { y0 = (long)*input++; y1 = (long)*input++; @@ -672,20 +675,22 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) y3 = (long)*input++; cr = (long)*input++; cb = (long)*input++; - *ibptr++ = yuv_to_rgb24( y0, cr, cb ); - *ibptr++ = yuv_to_rgb24( y1, cr, cb ); - *ibptr++ = yuv_to_rgb24( y2, cr, cb ); - *ibptr++ = yuv_to_rgb24( y3, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y0, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y1, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y2, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y3, cr, cb ); } - icptr = (unsigned int *)vq4; - idptr = (unsigned int *)vq8; + icptr.s = vq4; + idptr.s = vq8; for(i=0;i<four;i++) { - iaptr = (unsigned int *)vq2 + (*input++)*4; - ibptr = (unsigned int *)vq2 + (*input++)*4; + iaptr.s = vq2; + iaptr.i += (*input++)*4; + ibptr.s = vq2; + ibptr.i += (*input++)*4; for(j=0;j<2;j++) - VQ2TO4(iaptr, ibptr, icptr, idptr); + VQ2TO4(iaptr.i, ibptr.i, icptr.i, idptr.i); } } else if (cinTable[currentHandle].samplesPerPixel==1) { bbptr = (byte *)bptr; @@ -740,7 +745,7 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) } } } else if (cinTable[currentHandle].samplesPerPixel==4) { - ibptr = (unsigned int *)bptr; + ibptr.s = bptr; for(i=0;i<two;i++) { y0 = (long)*input++; y1 = (long)*input++; @@ -748,25 +753,27 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) y3 = (long)*input++; cr = (long)*input++; cb = (long)*input++; - *ibptr++ = yuv_to_rgb24( y0, cr, cb ); - *ibptr++ = yuv_to_rgb24( y1, cr, cb ); - *ibptr++ = yuv_to_rgb24( ((y0*3)+y2)/4, cr, cb ); - *ibptr++ = yuv_to_rgb24( ((y1*3)+y3)/4, cr, cb ); - *ibptr++ = yuv_to_rgb24( (y0+(y2*3))/4, cr, cb ); - *ibptr++ = yuv_to_rgb24( (y1+(y3*3))/4, cr, cb ); - *ibptr++ = yuv_to_rgb24( y2, cr, cb ); - *ibptr++ = yuv_to_rgb24( y3, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y0, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y1, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( ((y0*3)+y2)/4, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( ((y1*3)+y3)/4, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( (y0+(y2*3))/4, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( (y1+(y3*3))/4, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y2, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y3, cr, cb ); } - icptr = (unsigned int *)vq4; - idptr = (unsigned int *)vq8; + icptr.s = vq4; + idptr.s = vq8; for(i=0;i<four;i++) { - iaptr = (unsigned int *)vq2 + (*input++)*8; - ibptr = (unsigned int *)vq2 + (*input++)*8; + iaptr.s = vq2; + iaptr.i += (*input++)*8; + ibptr.s = vq2; + ibptr.i += (*input++)*8; for(j=0;j<2;j++) { - VQ2TO4(iaptr, ibptr, icptr, idptr); - VQ2TO4(iaptr, ibptr, icptr, idptr); + VQ2TO4(iaptr.i, ibptr.i, icptr.i, idptr.i); + VQ2TO4(iaptr.i, ibptr.i, icptr.i, idptr.i); } } } else if (cinTable[currentHandle].samplesPerPixel==1) { @@ -842,24 +849,26 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) } } } else if (cinTable[currentHandle].samplesPerPixel == 4) { - ibptr = (unsigned int *) bptr; + ibptr.s = bptr; for(i=0;i<two;i++) { y0 = (long)*input; input+=2; y2 = (long)*input; input+=2; cr = (long)*input++; cb = (long)*input++; - *ibptr++ = yuv_to_rgb24( y0, cr, cb ); - *ibptr++ = yuv_to_rgb24( y2, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y0, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y2, cr, cb ); } - icptr = (unsigned int *)vq4; - idptr = (unsigned int *)vq8; + icptr.s = vq4; + idptr.s = vq8; for(i=0;i<four;i++) { - iaptr = (unsigned int *)vq2 + (*input++)*2; - ibptr = (unsigned int *)vq2 + (*input++)*2; + iaptr.s = vq2; + iaptr.i += (*input++)*2; + ibptr.s = vq2 + (*input++)*2; + ibptr.i += (*input++)*2; for(j=0;j<2;j++) { - VQ2TO2(iaptr,ibptr,icptr,idptr); + VQ2TO2(iaptr.i,ibptr.i,icptr.i,idptr.i); } } } @@ -1194,8 +1203,8 @@ redump: cinTable[currentHandle].roq_id = framedata[0] + framedata[1]*256; cinTable[currentHandle].RoQFrameSize = framedata[2] + framedata[3]*256 + framedata[4]*65536; cinTable[currentHandle].roq_flags = framedata[6] + framedata[7]*256; - cinTable[currentHandle].roqF0 = (char)framedata[7]; - cinTable[currentHandle].roqF1 = (char)framedata[6]; + cinTable[currentHandle].roqF0 = (signed char)framedata[7]; + cinTable[currentHandle].roqF1 = (signed char)framedata[6]; if (cinTable[currentHandle].RoQFrameSize>65536||cinTable[currentHandle].roq_id==0x1084) { Com_DPrintf("roq_size>65536||roq_id==0x1084\n"); |