diff --git a/Quake/gl_draw.c b/Quake/gl_draw.c index c5714d9b..adc44675 100644 --- a/Quake/gl_draw.c +++ b/Quake/gl_draw.c @@ -586,13 +586,13 @@ void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom) { static int oldtop = -2; static int oldbottom = -2; - gltexture_t *glt; if (top != oldtop || bottom != oldbottom) { + glpic_t *p = (glpic_t *)pic->data; + gltexture_t *glt = p->gltexture; oldtop = top; oldbottom = bottom; - glt = ((glpic_t *)pic->data)->gltexture; TexMgr_ReloadImage (glt, top, bottom); } Draw_Pic (x, y, pic); diff --git a/Quake/gl_rmain.c b/Quake/gl_rmain.c index 5255bd57..1cc642a2 100644 --- a/Quake/gl_rmain.c +++ b/Quake/gl_rmain.c @@ -784,6 +784,7 @@ void R_RenderView (void) if (!cl.worldmodel) Sys_Error ("R_RenderView: NULL worldmodel"); + time1 = 0; /* avoid compiler warning */ if (r_speeds.value) { glFinish (); diff --git a/Quake/gl_texmgr.c b/Quake/gl_texmgr.c index e5dd8c6b..03242cee 100644 --- a/Quake/gl_texmgr.c +++ b/Quake/gl_texmgr.c @@ -427,8 +427,6 @@ TexMgr_LoadPalette -- johnfitz -- was VID_SetPalette, moved here, renamed, rewri */ void TexMgr_LoadPalette (void) { - byte mask[] = {255,255,255,0}; - byte black[] = {0,0,0,255}; byte *pal, *src, *dst; int i, mark; FILE *f; @@ -452,7 +450,7 @@ void TexMgr_LoadPalette (void) *dst++ = *src++; *dst++ = 255; } - d_8to24table[255] &= *(int *)mask; + ((byte *) &d_8to24table[255]) [3] = 0; //fullbright palette, 0-223 are black (for additive blending) src = pal + 224*3; @@ -465,7 +463,11 @@ void TexMgr_LoadPalette (void) *dst++ = 255; } for (i=0; i<224; i++) - d_8to24table_fbright[i] = *(int *)black; + { + dst = (byte *) &d_8to24table_fbright[i]; + dst[3] = 255; + dst[2] = dst[1] = dst[0] = 0; + } //nobright palette, 224-255 are black (for additive blending) dst = (byte *)d_8to24table_nobright; @@ -478,11 +480,15 @@ void TexMgr_LoadPalette (void) *dst++ = 255; } for (i=224; i<256; i++) - d_8to24table_nobright[i] = *(int *)black; + { + dst = (byte *) &d_8to24table_nobright[i]; + dst[3] = 255; + dst[2] = dst[1] = dst[0] = 0; + } //conchars palette, 0 and 255 are transparent memcpy(d_8to24table_conchars, d_8to24table, 256*4); - d_8to24table_conchars[0] &= *(int *)mask; + ((byte *) &d_8to24table_conchars[0]) [3] = 0; Hunk_FreeToLowMark (mark); } @@ -1149,6 +1155,8 @@ gltexture_t *TexMgr_LoadImage (model_t *owner, const char *name, int width, int case SRC_RGBA: crc = CRC_Block(data, width * height * 4); break; + default: /* not reachable but avoids compiler warnings */ + crc = 0; } if ((flags & TEXPREF_OVERWRITE) && (glt = TexMgr_FindTexture (owner, name))) { diff --git a/Quake/image.c b/Quake/image.c index 772c60b2..c6e9e556 100644 --- a/Quake/image.c +++ b/Quake/image.c @@ -196,24 +196,24 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height) switch (targa_header.pixel_size) { case 24: - blue = getc(fin); - green = getc(fin); - red = getc(fin); - *pixbuf++ = red; - *pixbuf++ = green; - *pixbuf++ = blue; - *pixbuf++ = 255; - break; + blue = getc(fin); + green = getc(fin); + red = getc(fin); + *pixbuf++ = red; + *pixbuf++ = green; + *pixbuf++ = blue; + *pixbuf++ = 255; + break; case 32: - blue = getc(fin); - green = getc(fin); - red = getc(fin); - alphabyte = getc(fin); - *pixbuf++ = red; - *pixbuf++ = green; - *pixbuf++ = blue; - *pixbuf++ = alphabyte; - break; + blue = getc(fin); + green = getc(fin); + red = getc(fin); + alphabyte = getc(fin); + *pixbuf++ = red; + *pixbuf++ = green; + *pixbuf++ = blue; + *pixbuf++ = alphabyte; + break; } } } @@ -236,17 +236,19 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height) switch (targa_header.pixel_size) { case 24: - blue = getc(fin); - green = getc(fin); - red = getc(fin); - alphabyte = 255; - break; + blue = getc(fin); + green = getc(fin); + red = getc(fin); + alphabyte = 255; + break; case 32: - blue = getc(fin); - green = getc(fin); - red = getc(fin); - alphabyte = getc(fin); - break; + blue = getc(fin); + green = getc(fin); + red = getc(fin); + alphabyte = getc(fin); + break; + default: /* avoid compiler warnings */ + blue = red = green = alphabyte = 0; } for(j=0;jcolor]; + c = (GLubyte *) &d_8to24table[(int)p->color]; + color[0] = c[0]; + color[1] = c[1]; + color[2] = c[2]; //alpha = CLAMP(0, p->die + 0.5 - cl.time, 1); color[3] = 255; //(int)(alpha * 255); glColor4ubv(color); @@ -896,7 +899,10 @@ void R_DrawParticles (void) scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures //johnfitz -- particle transparency and fade out - *(int *)color = d_8to24table[(int)p->color]; + c = (GLubyte *) &d_8to24table[(int)p->color]; + color[0] = c[0]; + color[1] = c[1]; + color[2] = c[2]; //alpha = CLAMP(0, p->die + 0.5 - cl.time, 1); color[3] = 255; //(int)(alpha * 255); glColor4ubv(color);