diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2011-05-28 20:01:31 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-05-29 12:34:37 (GMT) |
| commit | 6a2f357efd2dac87a4a9f30206717500440d2a76 (patch) | |
| tree | 63df6d88119ac8fd0356268e007240e679cdbf57 /src | |
| parent | a40d1dc12122a757a14743da766bed812856dfc3 (diff) | |
| download | powder-6a2f357efd2dac87a4a9f30206717500440d2a76.zip powder-6a2f357efd2dac87a4a9f30206717500440d2a76.tar.gz | |
Revert "Pass decorations to saving functions (doesn't actually save yet)"
This reverts commit 7fe99f32102429113c671615fc2c5cadb9c51e56.
Conflicts:
src/main.c
Diffstat (limited to 'src')
| -rw-r--r-- | src/interface.c | 4 | ||||
| -rw-r--r-- | src/main.c | 23 | ||||
| -rw-r--r-- | src/powder.c | 34 |
3 files changed, 29 insertions, 32 deletions
diff --git a/src/interface.c b/src/interface.c index 65d80dc..c501ddd 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3375,7 +3375,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) if (queue_open) { if (info_ready && data_ready) { // Do Open! - status = parse_save(data, data_size, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap, decorations); + status = parse_save(data, data_size, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap); if (!status) { //if(svf_last) //free(svf_last); @@ -3896,7 +3896,7 @@ void execute_save(pixel *vid_buf) plens[0] = strlen(svf_name); uploadparts[1] = svf_description; plens[1] = strlen(svf_description); - uploadparts[2] = build_save(plens+2, 0, 0, XRES, YRES, bmap, fvx, fvy, signs, parts, decorations); + uploadparts[2] = build_save(plens+2, 0, 0, XRES, YRES, bmap, fvx, fvy, signs, parts); uploadparts[3] = build_thumb(plens+3, 1); uploadparts[4] = (svf_publish==1)?"Public":"Private"; plens[4] = strlen((svf_publish==1)?"Public":"Private"); @@ -59,7 +59,7 @@ #include "pyconsole.h" #endif -pixel *vid_buf, *decorations; +pixel *vid_buf; #define NUM_SOUNDS 2 struct sample { @@ -319,7 +319,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) +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) { 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)); @@ -524,7 +524,7 @@ void *build_save(int *size, int x0, int y0, int w, int h, unsigned char bmap[YRE return c; } -int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char bmap[YRES/CELL][XRES/CELL], float fvx[YRES/CELL][XRES/CELL], float fvy[YRES/CELL][XRES/CELL], sign signs[MAXSIGNS], void* partsptr, unsigned pmap[YRES][XRES], pixel *decorations) +int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char bmap[YRES/CELL][XRES/CELL], float fvx[YRES/CELL][XRES/CELL], float fvy[YRES/CELL][XRES/CELL], sign signs[MAXSIGNS], void* partsptr, unsigned pmap[YRES][XRES]) { unsigned char *d=NULL,*c=save; int q,i,j,k,x,y,p=0,*m=NULL, ver, pty, ty, legacy_beta=0, tempGrav = 0; @@ -615,7 +615,6 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char } clear_sim(); } - clearrect(decorations, x0, y0, w, h); m = calloc(XRES*YRES, sizeof(int)); // make a catalog of free parts @@ -1162,7 +1161,7 @@ void stamp_save(int x, int y, int w, int h) FILE *f; int n; char fn[64], sn[16]; - void *s=build_save(&n, x, y, w, h, bmap, fvx, fvy, signs, parts, decorations); + void *s=build_save(&n, x, y, w, h, bmap, fvx, fvy, signs, parts); #ifdef WIN32 _mkdir("stamps"); @@ -1451,7 +1450,8 @@ int main(int argc, char *argv[]) if(load_data && load_size){ int parsestate = 0; - parsestate = parse_save(load_data, load_size, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap, decorations); + //parsestate = parse_save(load_data, load_size, 1, 0, 0); + parsestate = parse_save(load_data, load_size, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap); for(i=0; i<30; i++){ memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); @@ -1549,7 +1549,6 @@ int main(int argc, char *argv[]) pthread_win32_process_attach_np(); pthread_win32_thread_attach_np(); #endif - decorations = calloc((XRES+BARSIZE)*YRES, PIXELSIZE); vid_buf = calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); pers_bg = calloc((XRES+BARSIZE)*YRES, PIXELSIZE); GSPEED = 1; @@ -1704,7 +1703,7 @@ int main(int argc, char *argv[]) if (file_data) { it=0; - parse_save(file_data, size, 0, 0, 0, bmap, fvx, fvy, signs, parts, pmap, decorations); + parse_save(file_data, size, 0, 0, 0, bmap, fvx, fvy, signs, parts, pmap); } } @@ -2690,7 +2689,7 @@ int main(int argc, char *argv[]) if (load_y<0) load_y=0; if (bq==1 && !b) { - parse_save(load_data, load_size, 0, load_x, load_y, bmap, fvx, fvy, signs, parts, pmap, decorations); + parse_save(load_data, load_size, 0, load_x, load_y, bmap, fvx, fvy, signs, parts, pmap); free(load_data); free(load_img); load_mode = 0; @@ -2732,14 +2731,14 @@ int main(int argc, char *argv[]) { if (copy_mode==1)//CTRL-C, copy { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL, bmap, fvx, fvy, signs, parts, decorations); + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL, bmap, fvx, fvy, signs, parts); clipboard_ready = 1; save_mode = 0; copy_mode = 0; } else if (copy_mode==2)//CTRL-X, cut { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL, bmap, fvx, fvy, signs, parts, decorations); + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL, bmap, fvx, fvy, signs, parts); clipboard_ready = 1; save_mode = 0; copy_mode = 0; @@ -2866,7 +2865,7 @@ int main(int argc, char *argv[]) } if (x>=19 && x<=35 && svf_last && svf_open && !bq) { //int tpval = sys_pause; - parse_save(svf_last, svf_lsize, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap, decorations); + parse_save(svf_last, svf_lsize, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap); //sys_pause = tpval; } if (x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) diff --git a/src/powder.c b/src/powder.c index 34328f3..fcb76b3 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2587,14 +2587,11 @@ void *transform_save(void *odata, int *size, matrix2d transform, vector2d transl float (*fvyo)[XRES/CELL] = calloc((YRES/CELL)*(XRES/CELL), sizeof(float)); float (*fvxn)[XRES/CELL] = calloc((YRES/CELL)*(XRES/CELL), sizeof(float)); float (*fvyn)[XRES/CELL] = calloc((YRES/CELL)*(XRES/CELL), sizeof(float)); - pixel *decorationso = calloc((XRES+BARSIZE)*YRES, PIXELSIZE); - pixel *decorationsn = calloc((XRES+BARSIZE)*YRES, PIXELSIZE); int i, x, y, nx, ny, w, h, nw, nh; - pixel px; vector2d pos, tmp, ctl, cbr; vector2d cornerso[4]; unsigned char *odatac = odata; - if (parse_save(odata, *size, 0, 0, 0, bmapo, fvxo, fvyo, signst, partst, pmapt, decorationso)) + if (parse_save(odata, *size, 0, 0, 0, bmapo, fvxo, fvyo, signst, partst, pmapt)) { free(bmapo); free(bmapn); @@ -2605,8 +2602,6 @@ void *transform_save(void *odata, int *size, matrix2d transform, vector2d transl free(fvyo); free(fvxn); free(fvyn); - free(decorationso); - free(decorationsn); return odata; } w = odatac[6]*CELL; @@ -2663,21 +2658,26 @@ void *transform_save(void *odata, int *size, matrix2d transform, vector2d transl partst[i].x = nx; partst[i].y = ny; } - for (y=0; y<h; y++) - for (x=0; x<w; x++) + for (y=0; y<YRES/CELL; y++) + for (x=0; x<XRES/CELL; x++) { - px = decorationso[y*(XRES+BARSIZE)+x]; - if (!PIXR(px) && !PIXG(px) && !PIXB(px)) - continue; - pos = v2d_new(x, y); + pos = v2d_new(x*CELL+CELL*0.4f, y*CELL+CELL*0.4f); pos = v2d_add(m2d_multiply_v2d(transform,pos),translate); - nx = floor(pos.x+0.5f); - ny = floor(pos.y+0.5f); + nx = pos.x/CELL; + ny = pos.y/CELL; if (nx<0 || nx>=nw || ny<0 || ny>=nh) continue; - decorationsn[ny*(XRES+BARSIZE)+nx] = px; + if (bmapo[y][x]) + { + bmapn[ny][nx] = bmapo[y][x]; + if (bmapo[y][x]==WL_FAN) + { + fvxn[ny][nx] = fvxo[y][x]; + fvyn[ny][nx] = fvyo[y][x]; + } + } } - ndata = build_save(size,0,0,nw,nh,bmapn,fvxn,fvyn,signst,partst,decorationsn); + ndata = build_save(size,0,0,nw,nh,bmapn,fvxn,fvyn,signst,partst); free(bmapo); free(bmapn); free(partst); @@ -2687,8 +2687,6 @@ void *transform_save(void *odata, int *size, matrix2d transform, vector2d transl free(fvyo); free(fvxn); free(fvyn); - free(decorationso); - free(decorationsn); return ndata; } |
