X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fpcx.c;h=5fdf6f3ecb56d7a53e3272c8b6d88e7df2a604fa;hb=74c0f7de91268e40d15948f473eac51a9760b9c0;hp=c7b308b0900a4d56644f73823e7248c173131fb3;hpb=76510834f382bc82548e72c8e7f6f7672c9484dc;p=rocksndiamonds.git diff --git a/src/libgame/pcx.c b/src/libgame/pcx.c index c7b308b0..5fdf6f3e 100644 --- a/src/libgame/pcx.c +++ b/src/libgame/pcx.c @@ -167,12 +167,11 @@ static boolean PCX_ReadBitmap(FILE *file, struct PCX_Header *pcx, Image *image) for (j = 7; j >= 0; j--) { - byte bit; + byte bit = (value >> j) & 1; if (i * 8 + j >= width) /* skip padding bits */ continue; - bit = (value >> j) & 1; bitmap_ptr[x++] |= bit << plane; } } @@ -221,7 +220,7 @@ static byte *PCX_ReadColormap(Image *image,byte *buffer_ptr, byte *buffer_last) return NULL; /* read 256 colors from PCX colormap */ - for (i=0; irgb.red[i] = *buffer_ptr++ << 8; image->rgb.green[i] = *buffer_ptr++ << 8; @@ -257,7 +256,7 @@ static boolean PCX_ReadColormap(FILE *file,struct PCX_Header *pcx,Image *image) while (value != PCX_256COLORS_MAGIC); /* read 256 colors from PCX colormap */ - for(i = 0; i < PCX_MAXCOLORS; i++) + for (i = 0; i < PCX_MAXCOLORS; i++) { image->rgb.red[i] = (byte)fgetc(file) << 8; image->rgb.green[i] = (byte)fgetc(file) << 8; @@ -266,7 +265,7 @@ static boolean PCX_ReadColormap(FILE *file,struct PCX_Header *pcx,Image *image) } else { - for(i = 0; i < num_colors; i++) + for (i = 0; i < num_colors; i++) { image->rgb.red[i] = pcx->palette[i][0] << 8; image->rgb.green[i] = pcx->palette[i][1] << 8; @@ -376,7 +375,7 @@ Image *Read_PCX_to_Image(char *filename) if (pcx_depth == 8) { /* determine number of used colormap entries for 8-bit PCX images */ - for (i=0; irgb.color_used[i]) image->rgb.used++; }