/*
 * Copyright 2000 Greg Velichansky
 * released under the GNU General Public License    
 * see the files README and COPYING for details.
 */

#include<stdio.h>
#include<math.h>
#include<process.h>

/*#define ScrewArrays*/

#include"3dvector.h"
#include"3dpoly.h"

FILE *in, *out;

int gn;

int novertex = 0;
int allowzero = 0;

int i;

main(int argc, char *argv[]){


   puts ("Old2new, converts .mdl files to new poly format");
   puts ("DJGPP Compilation");
   puts (" ");

   if (argc != 3){
      puts ("Bad parameters");
      puts ("Syntax: old2new.exe old.mdl new.mdl");
      exit (1);
	}

   in = fopen (argv[1], "rb");
   if (in == NULL){
      perror ("Unable to open input file");
      exit (2);
	}

   readmodel_old (in);

   if (fclose (in) == EOF){
      perror ("Error on closing input file");
	}

   printf ("Read %d points and %d polygons.\n", pointnum, polynum);

   for (i = 0; i < pointnum; ++i){
	polys[i].type = p_flat;
   }


   out = fopen (argv[2], "wb");
   if (out == NULL){
      perror ("Unable to open output file");
      exit (3);
	}

   writemodel (out);

   if(fclose (out) == EOF){
      perror ("Error on closing output file");
	}

   puts("Share and enjoy.");

	return 0;
}
