From 04ec1794ba631fc70236d052579b1c8156fe40ca Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 1 Dec 2011 16:57:31 +0100 Subject: [PATCH] Fix idCinematics for x86_64 --- neo/renderer/Cinematic.cpp | 158 ++++++++++++++++++------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/neo/renderer/Cinematic.cpp b/neo/renderer/Cinematic.cpp index be730d5a..11298d47 100644 --- a/neo/renderer/Cinematic.cpp +++ b/neo/renderer/Cinematic.cpp @@ -51,31 +51,31 @@ public: virtual void ResetTime(int time); private: - unsigned int mcomp[256]; + size_t mcomp[256]; byte ** qStatus[2]; idStr fileName; int CIN_WIDTH, CIN_HEIGHT; idFile * iFile; cinStatus_t status; - long tfps; - long RoQPlayed; - long ROQSize; + int tfps; + int RoQPlayed; + int ROQSize; unsigned int RoQFrameSize; - long onQuad; - long numQuads; - long samplesPerLine; + int onQuad; + int numQuads; + int samplesPerLine; unsigned int roq_id; - long screenDelta; + int screenDelta; byte * buf; - long samplesPerPixel; // defaults to 2 + int samplesPerPixel; // defaults to 2 unsigned int xsize, ysize, maxsize, minsize; - long normalBuffer0; - long roq_flags; - long roqF0; - long roqF1; - long t[2]; - long roqFPS; - long drawX, drawY; + int normalBuffer0; + int roq_flags; + int roqF0; + int roqF1; + int t[2]; + int roqFPS; + int drawX, drawY; int animationLength; int startTime; @@ -100,14 +100,14 @@ private: void blit4_32( byte *src, byte *dst, int spl ); void blit2_32( byte *src, byte *dst, int spl ); - unsigned short yuv_to_rgb( long y, long u, long v ); - unsigned int yuv_to_rgb24( long y, long u, long v ); + unsigned short yuv_to_rgb( int y, int u, int v ); + unsigned int yuv_to_rgb24( int y, int u, int v ); void decodeCodeBook( byte *input, unsigned short roq_flags ); - void recurseQuad( long startX, long startY, long quadSize, long xOff, long yOff ); - void setupQuad( long xOff, long yOff ); + void recurseQuad( int startX, int startY, int quadSize, int xOff, int yOff ); + void setupQuad( int xOff, int yOff ); void readQuadInfo( byte *qData ); - void RoQPrepMcomp( long xoff, long yoff ); + void RoQPrepMcomp( int xoff, int yoff ); void RoQReset(); }; @@ -128,11 +128,11 @@ const int ZA_SOUND_MONO = 0x1020; const int ZA_SOUND_STEREO = 0x1021; // temporary buffers used by all cinematics -static long ROQ_YY_tab[256]; -static long ROQ_UB_tab[256]; -static long ROQ_UG_tab[256]; -static long ROQ_VG_tab[256]; -static long ROQ_VR_tab[256]; +static int ROQ_YY_tab[256]; +static int ROQ_UB_tab[256]; +static int ROQ_UG_tab[256]; +static int ROQ_VG_tab[256]; +static int ROQ_VR_tab[256]; static byte * file = NULL; static unsigned short * vq2 = NULL; static unsigned short * vq4 = NULL; @@ -149,7 +149,7 @@ idCinematicLocal::InitCinematic */ void idCinematic::InitCinematic( void ) { float t_ub,t_vr,t_ug,t_vg; - long i; + int i; // generate YUV tables t_ub = (1.77200f/2.0f) * (float)(1<<6) + 0.5f; @@ -159,11 +159,11 @@ void idCinematic::InitCinematic( void ) { for( i = 0; i < 256; i++ ) { float x = (float)(2 * i - 255); - ROQ_UB_tab[i] = (long)( ( t_ub * x) + (1<<5)); - ROQ_VR_tab[i] = (long)( ( t_vr * x) + (1<<5)); - ROQ_UG_tab[i] = (long)( (-t_ug * x) ); - ROQ_VG_tab[i] = (long)( (-t_vg * x) + (1<<5)); - ROQ_YY_tab[i] = (long)( (i << 6) | (i >> 2) ); + ROQ_UB_tab[i] = (int)( ( t_ub * x) + (1<<5)); + ROQ_VR_tab[i] = (int)( ( t_vr * x) + (1<<5)); + ROQ_UG_tab[i] = (int)( (-t_ug * x) ); + ROQ_VG_tab[i] = (int)( (-t_vg * x) + (1<<5)); + ROQ_YY_tab[i] = (int)( (i << 6) | (i >> 2) ); } file = (byte *)Mem_Alloc( 65536 ); @@ -928,8 +928,8 @@ void idCinematicLocal::blitVQQuad32fs( byte **status, unsigned char *data ) { idCinematicLocal::yuv_to_rgb ============== */ -unsigned short idCinematicLocal::yuv_to_rgb( long y, long u, long v ) { - long r,g,b,YY = (long)(ROQ_YY_tab[(y)]); +unsigned short idCinematicLocal::yuv_to_rgb( int y, int u, int v ) { + int r,g,b,YY = (int)(ROQ_YY_tab[(y)]); r = (YY + ROQ_VR_tab[v]) >> 9; g = (YY + ROQ_UG_tab[u] + ROQ_VG_tab[v]) >> 8; @@ -946,8 +946,8 @@ unsigned short idCinematicLocal::yuv_to_rgb( long y, long u, long v ) { idCinematicLocal::yuv_to_rgb24 ============== */ -unsigned int idCinematicLocal::yuv_to_rgb24( long y, long u, long v ) { - long r,g,b,YY = (long)(ROQ_YY_tab[(y)]); +unsigned int idCinematicLocal::yuv_to_rgb24( int y, int u, int v ) { + int r,g,b,YY = (int)(ROQ_YY_tab[(y)]); r = (YY + ROQ_VR_tab[v]) >> 6; g = (YY + ROQ_UG_tab[u] + ROQ_VG_tab[v]) >> 6; @@ -965,9 +965,9 @@ idCinematicLocal::decodeCodeBook ============== */ void idCinematicLocal::decodeCodeBook( byte *input, unsigned short roq_flags ) { - long i, j, two, four; + int i, j, two, four; unsigned short *aptr, *bptr, *cptr, *dptr; - long y0,y1,y2,y3,cr,cb; + int y0,y1,y2,y3,cr,cb; unsigned int *iaptr, *ibptr, *icptr, *idptr; if (!roq_flags) { @@ -989,12 +989,12 @@ void idCinematicLocal::decodeCodeBook( byte *input, unsigned short roq_flags ) { // if (samplesPerPixel==2) { for(i=0;i