#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wgt4.h>
#include <io.h>

block dummy;
color scpalette[256];


void erasedata()
{
int stopp;
stopp=0;

  wcls(0);
	dummy=wloadpcx256("books.pcx",scpalette);
	wsetpalette(0,255,scpalette);
	wputblock(0,0,dummy,0);
	wfreeblock(dummy);
	mon();
	while(stopp==0){
		if(but==1){
			noclick();
			if((mx>65)&&(mx<250)&&(my>62)&&(my<85)){
					remove("data\\dungeon.dta");
							stopp=1;/*DUNGEON*/
							}
			if((mx>65)&&(mx<250)&&(my>88)&&(my<108)){
					remove("data\\forest.dta");
					remove("data\\mountain.dta");
					remove("data\\coastal.dta");
					remove("data\\desert.dta");
					remove("data\\plains.dta");
							 stopp=1; /*CITY*/
							 }

			if((mx>126)&&(mx<189)&&(my>170)&&(my<191)){
							 stopp=1;/*MENU*/
							 }
		}
	}
moff();         /*turn mouse off*/
wcls(0);
}

void main()
{
  int advance;
  int stopp,fln;
  int print,erase;
  int menu,setup,monster;

  erase=0;
  setup=0;
  print=0;
  stopp=0;
  monster=0;
  menu=0;
  vga256();
  wcls(0);
   setlib("graphics\\utility.lib");

	dummy=wloadpcx256("utility.pcx",scpalette);
	wsetpalette(0,255,scpalette);
	wputblock(0,0,dummy,0);
	wfreeblock(dummy);


  minit();
msetbounds(0,0,319,199);
mon();      /*turn mouse on*/
	while(stopp==0){
		if(but==1){
			noclick();
			if((mx>97)&&(mx<210)&&(my>31)&&(my<58)){
							setup=1;
							stopp=1;/*SETUP*/
							}
			if((mx>97)&&(mx<210)&&(my>63)&&(my<85)){
							 print=1; /*PRINT*/
							 stopp=1;
							 }
			if((mx>97)&&(mx<211)&&(my>91)&&(my<116)){
							 erase=1; /*ERASE*/
							 stopp=1;
							 }
			if((mx>128)&&(mx<184)&&(my>168)&&(my<190)){
							 menu=1; /*MENU*/
							 stopp=1;
							 }
			if((mx>97)&&(mx<211)&&(my>120)&&(my<157)){
							 monster=1; /*MONSTER*/
							 stopp=1;
							 }
		}
	}
moff();         /*turn mouse off*/

if(erase==1) erasedata();

	mdeinit();

if(setup==1) execv("setup.exe",NULL);
if(print==1) execv("hardcopy",NULL);
if(menu==1)  execv("start.exe",NULL);
if(erase==1) execv("utility",NULL);
if(monster==1) execv("mnstedit",NULL);
}


