#include <svgacc.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <dos.h>
#include <hrprint.h>
#include <wgt4.h>

int stopp;
int origdisk;
char origpath[255];
int vmode,er,filestart,fileend;
char fname[]="test.pcx";
PaletteData pcxpal;
int city,dungeon,world;

FILE *fr;




void printimage()
{
	Verbose = FALSE;
	Brightness = 0;
	PrintMode = POSPRINT;
	Matrix = BayerMatrix;


PrtScreen(PrintMode,3);

}
void startend()
{                       if(city==1){
			 if((fr=fopen("citymap\\cmap1.pcx","rb"))==NULL){
						filestart=0;
						fileend=0;
						fclose(fr);
						}
			 }/*CITY*/
			if(dungeon==1){
							 stopp=1;
							 filestart=80;
							 fileend=87;
			 if((fr=fopen("dunmap\\dmapa.pcx","rb"))==NULL){
						filestart=0;
						fileend=0;
						fclose(fr);
						}
			 }/*DUNGEON*/
			if(world==1){
							 stopp=1;
							 filestart=0;
							 fileend=79;
			 if((fr=fopen("worldmap\\map1a.pcx","rb"))==NULL){
						filestart=0;
						fileend=0;
						fclose(fr);
						}
			 }/*WORLD*/
}

void no_files()
{
printf("\n\n\n\n\n");
printf("               No files to print\n");
printf("             Press RETURN or ENTER");
getch();
world=0;
dungeon=0;
city=0;
}




void main(void)
{
  int xsiz,ysiz,bumcol,p;
  int what;

  origdisk=getdisk();           /* Find current disk drive */
  getcwd(origpath,255);         /* And the current pathname */
  vmode=videomodeget();

	fr=fopen("data\\world.cfg","r");
	fscanf(fr,"%d",&p);   /*1=music 0=no music*/
	fscanf(fr,"%d",&p);   /*1=laser 0=dotmatrix*/
	fclose(fr);
	if(p==1) p=1;  /*laser*/
	if(p==0) p=2;  /*dotmatrix*/

  printf("1=city 2=dungeon 3=world\n");
  scanf("%d",&what);
  if(what==1) city=1;
  if(what==2) dungeon=1;
  if(what==3) world=1;

  startend();
  if((filestart==0)&&(fileend==0)) no_files();

  if(!whichvga()||(whichmem()<256)){
	printf("unknown svga card or less than 256k of ram\n");
		exit(1); }

  if(!res640l()) exit(1);




if(world==1){
    setdisk (origdisk);
    chdir (origpath);
	fillscreen(0);
  pcxgetinfo("worldmap\\map1a.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map1a.pcx");
  pcxput(SET,320,0,"worldmap\\map1b.pcx");
  pcxput(SET,0,191,"worldmap\\map1e.pcx");
  pcxput(SET,320,191,"worldmap\\map1f.pcx");
  drwstring(SET,255,0,"MAP 1A",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}

  fillscreen(0);
  pcxgetinfo("worldmap\\map1c.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map1c.pcx");
  pcxput(SET,320,0,"worldmap\\map1d.pcx");
  pcxput(SET,0,191,"worldmap\\map1g.pcx");
  pcxput(SET,320,191,"worldmap\\map1h.pcx");
  drwstring(SET,255,0,"MAP 2A",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  fillscreen(0);
  pcxgetinfo("worldmap\\map1i.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map1i.pcx");
  pcxput(SET,320,0,"worldmap\\map1j.pcx");
  pcxput(SET,0,191,"worldmap\\map1m.pcx");
  pcxput(SET,320,191,"worldmap\\map1n.pcx");
  drwstring(SET,255,0,"MAP 3A",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  fillscreen(0);
  pcxgetinfo("worldmap\\map1k.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map1k.pcx");
  pcxput(SET,320,0,"worldmap\\map1l.pcx");
  pcxput(SET,0,191,"worldmap\\map1o.pcx");
  pcxput(SET,320,191,"worldmap\\map1p.pcx");
  drwstring(SET,255,0,"MAP 4A",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
	fillscreen(0);
  pcxgetinfo("worldmap\\map1a.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map2a.pcx");
  pcxput(SET,320,0,"worldmap\\map2b.pcx");
  pcxput(SET,0,191,"worldmap\\map2e.pcx");
  pcxput(SET,320,191,"worldmap\\map2f.pcx");
  drwstring(SET,255,0,"MAP 1B",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}

  fillscreen(0);
  pcxgetinfo("worldmap\\map2c.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map2c.pcx");
  pcxput(SET,320,0,"worldmap\\map2d.pcx");
  pcxput(SET,0,191,"worldmap\\map2g.pcx");
  pcxput(SET,320,191,"worldmap\\map2h.pcx");
  drwstring(SET,255,0,"MAP 2B",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  fillscreen(0);
  pcxgetinfo("worldmap\\map2i.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map2i.pcx");
  pcxput(SET,320,0,"worldmap\\map2j.pcx");
  pcxput(SET,0,191,"worldmap\\map2m.pcx");
  pcxput(SET,320,191,"worldmap\\map2n.pcx");
  drwstring(SET,255,0,"MAP 3B",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  fillscreen(0);
  pcxgetinfo("worldmap\\map2k.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map2k.pcx");
  pcxput(SET,320,0,"worldmap\\map2l.pcx");
  pcxput(SET,0,191,"worldmap\\map2o.pcx");
  pcxput(SET,320,191,"worldmap\\map2p.pcx");
  drwstring(SET,255,0,"MAP 4B",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
	fillscreen(0);
  pcxgetinfo("worldmap\\map3a.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map3a.pcx");
  pcxput(SET,320,0,"worldmap\\map3b.pcx");
  pcxput(SET,0,191,"worldmap\\map3e.pcx");
  pcxput(SET,320,191,"worldmap\\map3f.pcx");
  drwstring(SET,255,0,"MAP 1C",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}

  fillscreen(0);
  pcxgetinfo("worldmap\\map3c.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map3c.pcx");
  pcxput(SET,320,0,"worldmap\\map3d.pcx");
  pcxput(SET,0,191,"worldmap\\map3g.pcx");
  pcxput(SET,320,191,"worldmap\\map3h.pcx");
  drwstring(SET,255,0,"MAP 2C",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  fillscreen(0);
  pcxgetinfo("worldmap\\map3i.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map3i.pcx");
  pcxput(SET,320,0,"worldmap\\map3j.pcx");
  pcxput(SET,0,191,"worldmap\\map3m.pcx");
  pcxput(SET,320,191,"worldmap\\map1n.pcx");
  drwstring(SET,255,0,"MAP 3C",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  fillscreen(0);
  pcxgetinfo("worldmap\\map3k.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map3k.pcx");
  pcxput(SET,320,0,"worldmap\\map3l.pcx");
  pcxput(SET,0,191,"worldmap\\map3o.pcx");
  pcxput(SET,320,191,"worldmap\\map3p.pcx");
  drwstring(SET,255,0,"MAP 4C",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
	fillscreen(0);
  pcxgetinfo("worldmap\\map4a.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map4a.pcx");
  pcxput(SET,320,0,"worldmap\\map4b.pcx");
  pcxput(SET,0,191,"worldmap\\map4e.pcx");
  pcxput(SET,320,191,"worldmap\\map4f.pcx");
  drwstring(SET,255,0,"MAP 1D",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}

  fillscreen(0);
  pcxgetinfo("worldmap\\map4c.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map4c.pcx");
  pcxput(SET,320,0,"worldmap\\map4d.pcx");
  pcxput(SET,0,191,"worldmap\\map4g.pcx");
  pcxput(SET,320,191,"worldmap\\map4h.pcx");
  drwstring(SET,255,0,"MAP 2D",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  fillscreen(0);
  pcxgetinfo("worldmap\\map4i.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map4i.pcx");
  pcxput(SET,320,0,"worldmap\\map4j.pcx");
  pcxput(SET,0,191,"worldmap\\map4m.pcx");
  pcxput(SET,320,191,"worldmap\\map4n.pcx");
  drwstring(SET,255,0,"MAP 3D",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  fillscreen(0);
  pcxgetinfo("worldmap\\map4k.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"worldmap\\map4k.pcx");
  pcxput(SET,320,0,"worldmap\\map4l.pcx");
  pcxput(SET,0,191,"worldmap\\map4o.pcx");
  pcxput(SET,320,191,"worldmap\\map4p.pcx");
  drwstring(SET,255,0,"MAP 4D",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}

  pcxgetinfo("worldmap\\legmap1.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
	fillscreen(255);
  pcxput(SET,0,0,"worldmap\\legmap1.pcx");
  pcxput(SET,320,0,"worldmap\\legmap2.pcx");
  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  pcxgetinfo("worldmap\\legmap1.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
	fillscreen(255);
  pcxput(SET,0,0,"worldmap\\legmap3.pcx");
  pcxput(SET,320,0,"worldmap\\legmap4.pcx");
  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  pcxgetinfo("worldmap\\legmap5.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
	fillscreen(255);
  pcxput(SET,0,0,"worldmap\\legmap5.pcx");
  pcxput(SET,320,0,"worldmap\\legmap6.pcx");
  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  pcxgetinfo("worldmap\\legmap7.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
	fillscreen(255);
  pcxput(SET,0,0,"worldmap\\legmap7.pcx");
  pcxput(SET,320,0,"worldmap\\legmap8.pcx");
  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}

  pcxgetinfo("worldmap\\legmap9.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
	fillscreen(255);
  pcxput(SET,320,0,"worldmap\\legmap9.pcx");
  pcxput(SET,320,191,"worldmap\\legmap10.pcx");
  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  pcxgetinfo("worldmap\\legmap11.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
	fillscreen(255);
  pcxput(SET,320,0,"worldmap\\legmap11.pcx");
  pcxput(SET,320,191,"worldmap\\legmap12.pcx");
  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  pcxgetinfo("worldmap\\legmap13.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
	fillscreen(255);
  pcxput(SET,320,0,"worldmap\\legmap13.pcx");
  pcxput(SET,320,191,"worldmap\\legmap14.pcx");
  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
  pcxgetinfo("worldmap\\legmap15.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
	fillscreen(255);
  pcxput(SET,320,0,"worldmap\\legmap15.pcx");
  pcxput(SET,320,191,"worldmap\\legmap16.pcx");
  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
 } /*end if world==1*/


if(dungeon==1){
    setdisk (origdisk);
    chdir (origpath);
	fillscreen(0);
  pcxgetinfo("dunmap\\dmapa.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"dunmap\\dmapa.pcx");
  pcxput(SET,320,0,"dunmap\\dmapb.pcx");
  pcxput(SET,0,191,"dunmap\\dmapc.pcx");
  pcxput(SET,320,191,"dunmap\\dmapd.pcx");
  drwstring(SET,255,0,"MAP 1",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
	fillscreen(0);
  pcxgetinfo("dunmap\\dmape.pcx",&xsiz,&ysiz,&bumcol,pcxpal);
  palset(pcxpal,0,255);
  pcxput(SET,0,0,"dunmap\\dmape.pcx");
  pcxput(SET,320,0,"dunmap\\dmapf.pcx");
  pcxput(SET,0,191,"dunmap\\dmapg.pcx");
  pcxput(SET,320,191,"dunmap\\dmaph.pcx");
  drwstring(SET,255,0,"MAP 2",300,388);

  /*er=pcxmake(0,0,639,399,fname); */
     if(p==2){
	printimage();
	delay(300);
	fprintf(stdprn,"\f");
	delay(2500);
	}/*end if dot matrix*/
     if(p==1){
	laser_print(640,400);
	}
 } /*end if dungeon=1*/



  videomodeset(vmode);			/* Return text mode */
      setdisk (origdisk);
      chdir (origpath);
}

