Render changes
This commit is contained in:
parent
380a45a4c9
commit
edc6339369
27
src/main.c
27
src/main.c
@ -1312,6 +1312,7 @@ int main(int argc, char *argv[])
|
|||||||
int load_size, i=0, j=0;
|
int load_size, i=0, j=0;
|
||||||
void *load_data = file_load(argv[1], &load_size);
|
void *load_data = file_load(argv[1], &load_size);
|
||||||
unsigned char c[3];
|
unsigned char c[3];
|
||||||
|
char ppmfilename[256], ptifilename[256], ptismallfilename[256];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
cmode = CM_FIRE;
|
cmode = CM_FIRE;
|
||||||
@ -1328,6 +1329,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
prepare_alpha();
|
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){
|
if(load_data && load_size){
|
||||||
int parsestate = 0;
|
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, bmap, fvx, fvy, signs, parts, pmap, decorations);
|
||||||
@ -1347,20 +1352,29 @@ int main(int argc, char *argv[])
|
|||||||
info_box(vid_buf, "Save file invalid or from newer version");
|
info_box(vid_buf, "Save file invalid or from newer version");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strncmp(argv[3], "pti", 3)){
|
//Save PTi images
|
||||||
char * datares = NULL, *scaled_buf;
|
char * datares = NULL, *scaled_buf;
|
||||||
int res = 0, sw, sh;
|
int res = 0, sw, sh;
|
||||||
scaled_buf = rescale_img(vid_buf, XRES, YRES, &sw, &sh, 4);
|
datares = ptif_pack(vid_buf, XRES, YRES, &res);
|
||||||
datares = ptif_pack(scaled_buf, sw, sh, &res);
|
|
||||||
if(datares!=NULL){
|
if(datares!=NULL){
|
||||||
f=fopen(argv[2], "wb");
|
f=fopen(ptifilename, "wb");
|
||||||
fwrite(datares, res, 1, f);
|
fwrite(datares, res, 1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
free(datares);
|
free(datares);
|
||||||
|
datares = NULL;
|
||||||
|
}
|
||||||
|
scaled_buf = rescale_img(vid_buf, XRES, YRES, &sw, &sh, 4);
|
||||||
|
datares = ptif_pack(scaled_buf, sw, sh, &res);
|
||||||
|
if(datares!=NULL){
|
||||||
|
f=fopen(ptismallfilename, "wb");
|
||||||
|
fwrite(datares, res, 1, f);
|
||||||
|
fclose(f);
|
||||||
|
free(datares);
|
||||||
|
datares = NULL;
|
||||||
}
|
}
|
||||||
free(scaled_buf);
|
free(scaled_buf);
|
||||||
} else {
|
//Save PPM image
|
||||||
f=fopen(argv[2],"wb");
|
f=fopen(ppmfilename, "wb");
|
||||||
fprintf(f,"P6\n%d %d\n255\n",XRES,YRES);
|
fprintf(f,"P6\n%d %d\n255\n",XRES,YRES);
|
||||||
for (j=0; j<YRES; j++)
|
for (j=0; j<YRES; j++)
|
||||||
{
|
{
|
||||||
@ -1374,7 +1388,6 @@ int main(int argc, char *argv[])
|
|||||||
vid_buf+=XRES+BARSIZE;
|
vid_buf+=XRES+BARSIZE;
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user