r112 - trunk/tools
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Mar 20 05:48:40 EST 2005
Author: jonas
Date: 2005-03-20 05:48:40 -0500 (Sun, 20 Mar 2005)
New Revision: 112
Modified:
trunk/tools/lvl2magick.c
Log:
introduce a start index parameter, start_index 0 (default) is very usefull for creating an lvl data file....
Modified: trunk/tools/lvl2magick.c
===================================================================
--- trunk/tools/lvl2magick.c 2005-03-19 22:28:41 UTC (rev 111)
+++ trunk/tools/lvl2magick.c 2005-03-20 10:48:40 UTC (rev 112)
@@ -50,6 +50,8 @@
typedef struct {
/* create unknown.bin chunk files if != 0 */
int debug;
+ /* start index (for the frame names) */
+ unsigned int start_index;
/* Write the individial animations */
int write;
/* input lvl file */
@@ -150,6 +152,7 @@
printf("Options:\n");
printf(" -h, --help Print this help message\n\n");
printf(" -debug Create additional debug files (default: off)\n\n");
+ printf(" -start_index <n> Start index of the frame image names (default: 0)\n\n");
printf(" -write <0-7> n=0: Just create the geometry data (no images)\n");
printf(" n=1: Create one big image with all animations in it\n");
printf(" n=2: Create one image for each animation\n");
@@ -174,6 +177,7 @@
strncpy(config.basename,"",16);
strncpy(config.format,"png",4);
config.debug=0;
+ config.start_index=0;
config.write=3;
config.colorkey.red=MaxRGB;
config.colorkey.green=0;
@@ -192,6 +196,10 @@
return errno_quit;
} else if (strcmp(argv[i],"-debug")==0) {
config.debug=1;
+ } else if (strcmp(argv[i],"-start_index")==0) {
+ i++;
+ if (strncmp(argv[i],"-",1)==0) { usage(); return errno_parse; }
+ config.start_index=(unsigned int)atoi(argv[i]);
} else if (strcmp(argv[i],"-write")==0) {
i++;
if (strncmp(argv[i],"-",1)==0) { usage(); return errno_parse; }
@@ -594,7 +602,7 @@
if (config.write!=0) {
tmp_image=getFrame(img_offsets[j]+12,image_info,width,height);
if (config.write&4) {
- snprintf(buf, 80, "%s_%04u.%s",lvlanims[i].name,(j-lvlanims[i].start_num)+1,config.format);
+ snprintf(buf, 80, "%s_%04u.%s",lvlanims[i].name,(j-lvlanims[i].start_num)+config.start_index,config.format);
strcpy(tmp_image->filename,buf);
(void)WriteImage(image_info,tmp_image);
}
More information about the lostpenguins-commits
mailing list