From edc63393699ff6f1d39cee9e8912cbd44cf9c004 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 28 May 2011 14:57:07 +0100 Subject: [PATCH] Render changes --- src/main.c | 65 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/src/main.c b/src/main.c index de2fc543d..94d581017 100644 --- a/src/main.c +++ b/src/main.c @@ -1312,6 +1312,7 @@ int main(int argc, char *argv[]) int load_size, i=0, j=0; void *load_data = file_load(argv[1], &load_size); unsigned char c[3]; + char ppmfilename[256], ptifilename[256], ptismallfilename[256]; FILE *f; cmode = CM_FIRE; @@ -1327,6 +1328,10 @@ int main(int argc, char *argv[]) fire_bg = calloc(XRES*YRES, PIXELSIZE); prepare_alpha(); + + sprintf(ppmfilename, "%s.ppm", argv[2]); + sprintf(ptifilename, "%s.pti", argv[2]); + sprintf(ptismallfilename, "%s-small.pti", argv[2]); if(load_data && load_size){ int parsestate = 0; @@ -1347,34 +1352,42 @@ int main(int argc, char *argv[]) info_box(vid_buf, "Save file invalid or from newer version"); } - if(!strncmp(argv[3], "pti", 3)){ - char * datares = NULL, *scaled_buf; - int res = 0, sw, sh; - scaled_buf = rescale_img(vid_buf, XRES, YRES, &sw, &sh, 4); - datares = ptif_pack(scaled_buf, sw, sh, &res); - if(datares!=NULL){ - f=fopen(argv[2], "wb"); - fwrite(datares, res, 1, f); - fclose(f); - free(datares); - } - free(scaled_buf); - } else { - f=fopen(argv[2],"wb"); - fprintf(f,"P6\n%d %d\n255\n",XRES,YRES); - for (j=0; j