Index: terrain.c =================================================================== --- terrain.c (Revision 420) +++ terrain.c (Arbeitskopie) @@ -31,6 +31,7 @@ float *pointtable; int brushnum = 0; int pointsize = 200; +int verbose = 1; // /* @@ -43,7 +44,8 @@ // runtime printing to screen - lets the user know something is actually happening. void write_vec(vec3 v) { - printf("(%3.f %3.f %3.f) \n", + if (verbose) + printf("(%3.f %3.f %3.f) \n", v[0], v[1], v[2]); } @@ -359,7 +361,7 @@ unsigned int bytesPerPixel; int loadImage(char *filename) -{ +{ unsigned char TGAheader[12]={0,0,2,0,0,0,0,0,0,0,0,0}; unsigned char TGAcompare[12]; unsigned char header[6]; @@ -394,7 +396,7 @@ width = header[1] * 256 + header[0]; // Determine The TGA Width (highbyte*256+lowbyte) height = header[3] * 256 + header[2]; // Determine The TGA Height (highbyte*256+lowbyte) - + if( width <=0 || // Is The Width Less Than Or Equal To Zero height <=0 || // Is The Height Less Than Or Equal To Zero (header[4]!=24 && header[4]!=32)) // Is The TGA 24 or 32 Bit? @@ -506,13 +508,13 @@ if (!strcmp(argv[i], "-image")) { int pos; + char *ext; strcpy(imagename, argv[++i]); pos = strlen(imagename); - imagename[pos++] = '.'; - imagename[pos++] = 't'; - imagename[pos++] = 'g'; - imagename[pos++] = 'a'; - imagename[pos++] = 0; + ext = strstr(imagename, "."); + if (ext) + *ext = '\0'; + strcat(imagename, ".tga"); continue; } @@ -556,7 +558,11 @@ sprintf (buf, "terrain.map"); // should never really happen success = loadImage(imagename); - + if (!success) + { + printf ("Could not load image: %s\n", imagename); + } + file = fopen(buf, "wt"); #ifdef _WIN32 @@ -829,6 +835,11 @@ continue; } + if (!strcmp(argv[i], "-silent")) + { + verbose = 0; + } + if (!strcmp(argv[i], "-image")) { return main3(argc, argv);