diff --git a/src/main.c b/src/main.c index 655fc5a4e..dcac7b142 100644 --- a/src/main.c +++ b/src/main.c @@ -321,7 +321,7 @@ void *build_thumb(int *size, int bzip2) //the saving function void *build_save(int *size, int x0, int y0, int w, int h, unsigned char bmap[YRES/CELL][XRES/CELL], float fvx[YRES/CELL][XRES/CELL], float fvy[YRES/CELL][XRES/CELL], sign signs[MAXSIGNS], void* partsptr, pixel *decorations) { - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*11+MAXSIGNS*262), *c; + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*15+MAXSIGNS*262), *c; int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; particle *parts = partsptr; @@ -417,6 +417,38 @@ void *build_save(int *size, int x0, int y0, int w, int h, unsigned char bmap[YRE } } for (j=0; j>24; + } + } + for (j=0; j>16; + } + } + for (j=0; j>8; + } + } + for (j=0; j=49) { + if (p >= size) { + goto corrupt; + } + if (i <= NPART) { + parts[i-1].dcolour = d[p++]<<24; + } else { + p++; + } + } + } + } + //Read RED component + for (j=0; j=49) { + if (p >= size) { + goto corrupt; + } + if (i <= NPART) { + parts[i-1].dcolour |= d[p++]<<16; + } else { + p++; + } + } + } + } + //Read GREEN component + for (j=0; j=49) { + if (p >= size) { + goto corrupt; + } + if (i <= NPART) { + parts[i-1].dcolour |= d[p++]<<8; + } else { + p++; + } + } + } + } + //Read BLUE component + for (j=0; j=49) { + if (p >= size) { + goto corrupt; + } + if (i <= NPART) { + parts[i-1].dcolour |= d[p++]; + } else { + p++; + } + } + } + } for (j=0; j