#ifdef __TINY__ #error Arrow Master will not run in the tiny model. #endif extern "C" { //had to do this to get C libarys to run in C++ #include //flic stuff #include //flic stuff }; //#include //#include //#include //#include <_defs.h> //#include <_nfile.h> #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#define ESC 0x1b /* Define the escape key */ #define TRUE 1 /* Define some handy constants */ #define FALSE 0 /* Define some handy constants */ #define PI 3.14159 /* Define a value for PI */ #define ON 1 /* Define some handy constants */ #define OFF 0 /* Define some handy constants */ #define NFONTS 11 #define F1 315 #define ESC 27 #define PAGEDOWN 337 #define PAGEUP 329 #define DOWNARROW 336 #define UPARROW 328 #define BS 0x8 char *Fonts[NFONTS] = { "DefaultFont", "TriplexFont", "SmallFont", "SansSerifFont", "GothicFont", "ScriptFont", "SimplexFont", "TriplexScriptFont", "ComplexFont", "EuropeanFont", "BoldFont" }; char *LineStyles[] = { "SolidLn", "DottedLn", "CenterLn", "DashedLn", "UserBitLn" }; char *FillStyles[] = { "EmptyFill", "SolidFill", "LineFill", "LtSlashFill", "SlashFill", "BkSlashFill", "LtBkSlashFill", "HatchFill", "XHatchFill", "InterleaveFill", "WideDotFill", "CloseDotFill" }; char *TextDirect[] = { "HorizDir", "VertDir" }; char *HorizJust[] = { "LeftText", "CenterText", "RightText" }; char *VertJust[] = { "BottomText", "CenterText", "TopText" }; struct PTS { int x, y; }; /* Structure to hold vertex points */ int GraphDriver; /* The Graphics device driver */ int GraphMode; /* The Graphics mode value */ double AspectRatio; /* Aspect ratio of a pixel on the screen*/ int MaxX, MaxY; /* The maximum resolution of the screen */ int MaxColors; /* The maximum # of colors available */ int ErrorCode; /* Reports any graphics errors */ struct palettetype palette; /* Used to read palette info */ int number; int x, y; int test; int testkey; int testfortitle=0; int numberoftitles; int whatkey; char titlename[50]; int tempA; ofstream fp_out; //used to make a new one and write a new one ifstream fp_in; ofstream fp; //for the append to file save function fstream fp_driver; //for writing the arw.cfg file (and reading) ofstream prnt; fstream fp_port; long filesize(FILE *stream); int skipmenuredraw=0; int test99=0; char driver_name[50]; char port_name[50]; char help_line[100]; int notnow=0; //int nodrive=0; int Q=0; int juststarted=0; int answer3,answer4; int status,status2,status3,status4,darn; int abyte=0; int position=1; int makeposition=1; float perinch=0,lengthofshaft=0,insertweight=0,insertlength=0,insertbalance=0,insertplacement=0,fletchweight=0,fletchlength=0,fletchbalance=0,fletchplacement=0,glueweight=0,nockweight=0,nocklength=0,nockbalance=0,nockplacement=0; float balancetry,totalmakeweight; float totalmakearrowlength; float insertprotrusion; float Apluspoint,focdist,center,centertobalancewithoutpoint,W; float fbalancetopointbalance,pointweight,extraone; float balancewithpoint; float FOC=8; float balancewithoutpoint=14.5625; float A=27.45; //measured all the way to the back of the nock float weightofarrow=394; float balanceofpoint=.125; float lengthofpoint=.875; int driverthere=0; int answer=0; int z=0; int answer2=0; int yesflic=0; int testmakehighlight; /* */ /* Function prototypes */ /* */ void Arrow_weight (void); void Initialize(void); void Calculate(void); void ReportStatus(void); void Arrow_Master(void); void SayGoodbye(void); void Pause(void); void MainWindow(char *header); void StatusLine(char *msg); void DrawBorder(void); void changetextstyle(int font, int direction, int charsize); int gprintf(int *xloc, int *yloc, char *fmt, ... ); char string[10]; //to hold numbers char userstring[50]; //to hold the name of the current open file char stringz[50]; int getkey (); int reconfigure=0; int loadprinterdriver=0; void numbers_only(void); void count_titles(void); void title_name(void); void letters_numbers(void); void redrawforprinting(void); void make_status_esc(void); void make_status(void); void make(void); void makehighlight(void); //void makehighlightup(void); /* */ /* Begin main function */ /* */ int main() { //Fndata *fn; //flic display starts here (will play a flic until a key is pressed) //int ivmode; //Errval err; //fn = dos_get_dta(); //if (dos_first("*.FLI", DOS_ATTR_NORMAL)) // { // ivmode = dos_get_vmode(); // dos_set_vmode(0x13); // if (dos_get_vmode() == 0x13) // { //err = fli_play(argv[1]); // err = fli_play(fn->name); // dos_set_vmode(ivmode); // if (err < AA_SUCCESS) // puts(fli_error_message(err) ); // } // else // { puts("Not a vga/mcga display"); } // } Fndata *fn; //flic starts here (will play a flic one time) int ivmode; Errval err; fn = dos_get_dta(); if (dos_first("*.FLI", DOS_ATTR_NORMAL)) {yesflic=1; ivmode = dos_get_vmode(); dos_set_vmode(0x13); if (dos_get_vmode() == 0x13) { for (;;) { if (dos_key_is()) { dos_key_in(); break; } err = fli_once(fn->name); if (err < AA_SUCCESS) { puts(fli_error_message(err)); } if (!dos_next()) break; } dos_set_vmode(ivmode); } // else // { // puts("Not a VGA/MCGA display"); // } } //else // { // puts("No .FLI files"); // } _control87(MCW_EM,MCW_EM); Initialize(); /* Set system into Graphics mode */ char *driver, *mode; driver = getdrivername(); if (GraphDriver != VGA || GraphMode != 2) { closegraph(); cout<<"ERROR only VGA 640x480 is supported\n"; cout<<"This is a "<7) {liney=7, y=7;} for (countdd=1; countdd<=1000; countdd++) //this is where you would addjust the size of how big the help file is (set it to the number of lines plus a little of the help file) {fgets (help_line, 100, stream); length=strlen(help_line); help_line[length-1]='\0'; //this takes away the \n at the end of the string because it kept printing as a square block gprintf(&x,&y,"%s",help_line); } backup: h = getkey(); if (h==DOWNARROW) { bar (1,1, 457,322); y=liney-10;} if (h==UPARROW) {bar (1,1, 457,322); y=liney+10;} if (h==PAGEDOWN) {bar (1,1, 457,322); y=liney-290;} if (h==PAGEUP) {bar (1,1, 457,322); y=liney+290;} if ((h!=PAGEUP)&&(h!=PAGEDOWN)&&(h!=UPARROW)&&(h!=DOWNARROW)&&(h!=ESC)) {cout<<"\a"; //beep goto backup; } } while (h!=ESC); fclose(stream); //close the help file Calculate ();} if ((c==101)||(c==69)||(c==13)) //if E or e or the enter key { StatusLine( "Esc to abort..." ); setfillstyle (1,7); bar (25,325, 270,410); //draw input box setcolor (5); rectangle (25,325, 270,410); //draw border around input box line (26,409, 269,409); line (269,409, 269,326); setcolor (15); //white line (25,409, 25, 325); line (26,408, 26,325); line (270,325, 25,325); line (26,326, 269,326); setfillstyle (1, 8); bar (100,370, 195,386); //draw the box for input inside the input box setcolor (5); rectangle (100,370, 195,386); //outline for the box above setcolor (15); //white line (100,386, 195,386); line (195,370, 195,386); setcolor (5); if (position==1) {settextjustify( CENTER_TEXT, CENTER_TEXT ); x=148,y=350; gprintf(&x,&y,"Enter"); gprintf(&x,&y,"Front of Center percent"); setcolor (15); x=123; numbers_only(); f=atof (string); if (test==8745) //if the enter key and f has something in it draw and print it into the correct place and enter the value into the varible (foc or whatever) { FOC=f; testfortitle=0; setfillstyle (1, BLUE); bar (270,328, 355,338); settextjustify( RIGHT_TEXT, CENTER_TEXT ); x=355,y=333; setcolor (14); gprintf(&x,&y,"%.1f%",FOC);} setfillstyle (1, BLUE); bar (25,325, 270,425); } if (position==2) { settextjustify( CENTER_TEXT, CENTER_TEXT ); x=147,y=350; gprintf(&x,&y,"Enter"); gprintf(&x,&y,"Balance position without point"); setcolor (15); x=123; numbers_only(); f=atof (string); if (test==8745) //if the enter key and f has something in it draw and print it into the correct place and enter the value into the varible (foc or whatever) {balancewithoutpoint=f; testfortitle=0; setfillstyle (1, BLUE); bar (270,342, 355,352); settextjustify( RIGHT_TEXT, CENTER_TEXT ); x=355,y=347; setcolor (14); gprintf(&x,&y,"%.3f",balancewithoutpoint);} setfillstyle (1, BLUE); bar (25,325, 270,425); } //color a blue box over where the input box was if (position==3) { settextjustify( CENTER_TEXT, CENTER_TEXT ); x=147,y=350; gprintf(&x,&y,"Enter"); gprintf(&x,&y,"Length of arrow without point"); gotoxy(18,25); setcolor (15); x=123; numbers_only(); f=atof (string); if (test==8745) //if the enter key and f has something in it draw and print it into the correct place and enter the value into the varible (foc or whatever) {A=f; testfortitle=0; setfillstyle (1, BLUE); bar (270,358, 355,368); settextjustify( RIGHT_TEXT, CENTER_TEXT ); x=355,y=363; setcolor (14); gprintf(&x,&y,"%.3f",A);} setfillstyle (1, BLUE); bar (25,325, 270,425); } //color a blue box over where the input box was if (position==4) { settextjustify( CENTER_TEXT, CENTER_TEXT ); x=147,y=350; gprintf(&x,&y,"Enter"); gprintf(&x,&y,"Weight of arrow without point"); gotoxy(18,25); setcolor (15); x=123; numbers_only(); f=atof (string); if (test==8745) //if the enter key and f has something in it draw and print it into the correct place and enter the value into the varible (foc or whatever) {weightofarrow=f; testfortitle=0; setfillstyle (1, BLUE); bar (270,373, 355,383); settextjustify( RIGHT_TEXT, CENTER_TEXT ); x=355,y=378; setcolor (14); gprintf(&x,&y,"%.2f g",weightofarrow);} setfillstyle (1, BLUE); bar (25,325, 270,425); } if (position==5) { settextjustify( CENTER_TEXT, CENTER_TEXT ); x=147,y=350; gprintf(&x,&y,"Enter"); gprintf(&x,&y,"Length of point"); gotoxy(18,25); setcolor (15); x=123; numbers_only(); f=atof (string); if (test==8745) //if the enter key and f has something in it draw and print it into the correct place and enter the value into the varible (foc or whatever) {lengthofpoint=f; testfortitle=0; setfillstyle (1, BLUE); bar (270,388, 355,398); settextjustify( RIGHT_TEXT, CENTER_TEXT ); x=355,y=393; setcolor (14); gprintf(&x,&y,"%.3f",lengthofpoint);} setfillstyle (1, BLUE); bar (25,325, 270,425); } if (position==6) { settextjustify( CENTER_TEXT, CENTER_TEXT ); x=147,y=350; gprintf(&x,&y,"Enter"); gprintf(&x,&y,"Balance position of point"); gotoxy(18,25); setcolor (15); x=123; numbers_only(); f=atof (string); if (test==8745) //if the enter key and f has something in it draw and print it into the correct place and enter the value into the varible (foc or whatever) {balanceofpoint=f; testfortitle=0; setfillstyle (1, BLUE); bar (270,403, 355,413); settextjustify( RIGHT_TEXT, CENTER_TEXT ); x=355,y=408; setcolor (14); gprintf(&x,&y,"%.3f",balanceofpoint);} setfillstyle (1, BLUE); bar (25,325, 270,425); } int height; setviewport( 0, 0, MaxX, MaxY, 1 ); height = textheight( "H" ); x=320; y=474; setfillstyle (1, 7); bar (4,468, 635,478); setcolor (5); //black settextjustify( CENTER_TEXT, CENTER_TEXT ); gprintf(&x,&y," elp dit alculate eight ake ile rint bout uit"); setcolor (RED); x=320; y=474; gprintf(&x,&y,"H E C W M F P A Q "); setviewport( 1, height+5, MaxX-1, MaxY-(height+5), 1 ); } if ((c==99)||(c==67)) //if C or c { position=1; skipmenuredraw=1; Calculate(); skipmenuredraw=0; setfillstyle (1,7); bar (25,325, 270,410); //draw input box setcolor (5); rectangle (25,325, 270,410); //draw border around input box line (26,409, 269,409); line (269,409, 269,326); setcolor (15); //white line (25,409, 25, 325); line (26,408, 26,325); line (270,325, 25,325); line (26,326, 269,326); setcolor (5); // x=148, y=357; x=148, y=340; settextjustify( CENTER_TEXT, CENTER_TEXT ); gprintf(&x,&y,"Ideal point weight"); gprintf(&x,&y,"for this configuration is"); setcolor (14); gprintf(&x,&y," "); gprintf(&x,&y,"%.0f Grains",pointweight); setcolor (4); gprintf(&x,&y," "); gprintf(&x,&y," "); gprintf(&x,&y,"Press any key to continue"); // setcolor (5); // x=148, y=357; // settextjustify( CENTER_TEXT, CENTER_TEXT ); // gprintf(&x,&y,"Ideal point weight"); // gprintf(&x,&y,"for this configuration is"); // setcolor (14); // gprintf(&x,&y,"%.0f Grains",pointweight); // testfortitle=2; Pause(); setfillstyle (1,1); bar (25,325, 270,410); int height; setviewport( 0, 0, MaxX, MaxY, 1 ); height = textheight( "H" ); x=320; y=474; setfillstyle (1, 7); bar (4,468, 635,478); setcolor (5); //black settextjustify( CENTER_TEXT, CENTER_TEXT ); gprintf(&x,&y," elp dit alculate eight ake ile rint bout uit"); setcolor (RED); x=320; y=474; gprintf(&x,&y,"H E C W M F P A Q "); setviewport( 1, height+5, MaxX-1, MaxY-(height+5), 1 ); } // Calculate(); } if ((c==77)||(c==109)) //if M or m make { makeposition=1; //reset the red highlight evertime make is started StatusLine( "Up & Down arrow keys Esc to abort..." ); setfillstyle (1,7); bar (100,25, 540,430); //draw input box setcolor (15); //white line (100,25,100,430); line (100,25,540,25); line (101,26,539,26); line (101,26,101,429); setcolor (5); //black line (100,430,540,430); line (540,25,540,430); line (101,429,539,429); line (539,26,539,429); setcolor (YELLOW); settextjustify(CENTER_TEXT, CENTER_TEXT ); x=320, y=40; gprintf (&x,&y,"This will determine arrow weight & balance"); gprintf (&x,&y,"position of a hypothetical arrow without"); gprintf (&x,&y,"a point to aid in arrow making."); gprintf (&x,&y,""); gprintf (&x,&y,""); x=250; y=90; settextjustify(LEFT_TEXT, CENTER_TEXT ); setcolor (5); //black setfillstyle (1, RED); //draw the highlight cursor bar (248,85,480,95); x=250,y=90; makeposition=1; //make sure highlight is reset gprintf (&x,&y,"weight of shaft per inch"); y=105; gprintf (&x,&y,"length of shaft"); y=130; gprintf (&x,&y,"weight of insert"); y=145; gprintf (&x,&y,"length of insert"); y=160; gprintf (&x,&y,"balance position of insert"); y=175; gprintf (&x,&y,"placement of insert"); y=200; gprintf (&x,&y,"weight of fletching"); y=215; gprintf (&x,&y,"length of fletching"); y=230; gprintf (&x,&y,"balance position of fletching"); y=245; gprintf (&x,&y,"placement of fletching"); y=260; gprintf (&x,&y,"weight of fletching glue"); y=285; gprintf (&x,&y,"weight of nock"); y=300; gprintf (&x,&y,"length of nock"); y=315; gprintf (&x,&y,"balance position of nock"); y=330; gprintf (&x,&y,"placement of nock"); y=90,x=240; //start of placeing in the 15 varibles setcolor (15); settextjustify(RIGHT_TEXT, CENTER_TEXT ); gprintf(&x,&y,"%.4f",perinch); y=105; gprintf(&x,&y,"%.4f",lengthofshaft); y=130; gprintf(&x,&y,"%.4f",insertweight); y=145; gprintf(&x,&y,"%.4f",insertlength); y=160; gprintf(&x,&y,"%.4f",insertbalance); y=175; gprintf(&x,&y,"%.4f",insertplacement); y=200; gprintf(&x,&y,"%.4f",fletchweight); y=215; gprintf(&x,&y,"%.4f",fletchlength); y=230; gprintf(&x,&y,"%.4f",fletchbalance); y=245; gprintf(&x,&y,"%.4f",fletchplacement); y=260; gprintf(&x,&y,"%.4f",glueweight); y=285; gprintf(&x,&y,"%.4f",nockweight); y=300; gprintf(&x,&y,"%.4f",nocklength); y=315; gprintf(&x,&y,"%.4f",nockbalance); y=330; gprintf(&x,&y,"%.4f",nockplacement); settextjustify(CENTER_TEXT, CENTER_TEXT ); x=320; gprintf (&x,&y," "); // gprintf (&x,&y," "); y-=7; setcolor (YELLOW); gprintf (&x,&y,"This feature is only available in Arrow Master Pro."); setcolor (15); y+=5; setcolor (RED); gprintf (&x,&y,"Contact Lindsay Graphics for more information."); gprintf (&x,&y,"Rt. 2 Cedar Hills"); gprintf (&x,&y,"Kearney, NE 68847"); gprintf (&x,&y,"308-236-7885"); // gprintf (&x,&y," "); y+=5; setcolor (YELLOW); gprintf (&x,&y,"Press any key to continue"); make_status(); getkey(); Calculate(); } if ((c==97)||(c==65)) //if A or a (about) {StatusLine( "Press any key to continue..." ); setfillstyle (1,7); bar (90,60, 550,385); //draw input box setcolor (5); //black line (90,385, 550,385); line (91,384, 549,384); line (550,385, 550,60); line (549,384, 549,61); setcolor (15); //white line (90,385, 90,60); line (91,384, 91,61); line (90,60, 550,60); line (91,61, 549,61); settextjustify( CENTER_TEXT, CENTER_TEXT ); x=320, y=80; setcolor (YELLOW); changetextstyle( GOTHIC_FONT, HORIZ_DIR, 4 ); gprintf(&x,&y,"ARROW MASTER"); changetextstyle( DEFAULT_FONT, HORIZ_DIR, 1 ); setcolor (5); gprintf (&x,&y,"Version 1.12"); // gprintf (&x,&y," "); // gprintf (&x,&y," "); gprintf (&x,&y," "); gprintf(&x,&y,"Copyright (c) 1992,1993"); gprintf(&x,&y,"by Lindsay Graphics"); gprintf(&x,&y,"All rights reserved"); gprintf (&x,&y," "); gprintf (&x,&y," "); gprintf (&x,&y,"This program was purchased by and is registered to:"); gprintf (&x,&y,"Ms. Kaye M. Jameson"); gprintf (&x,&y,"10834 Claire Drive"); gprintf (&x,&y,"Leesburg, FL 34788"); gprintf (&x,&y,"Phone 904 742-2282"); gprintf (&x,&y," "); gprintf (&x,&y,"Paid for with"); gprintf (&x,&y,"check #2204 dated May 4, 1993"); gprintf (&x,&y," "); gprintf (&x,&y,"Date purchased: 05-14-93"); setcolor (RED); gprintf (&x,&y," "); gprintf (&x,&y," "); gprintf (&x,&y,"Warning this program is to be used ONLY by"); gprintf (&x,&y,"the registered user."); setcolor (5); gprintf (&x,&y," "); gprintf (&x,&y,"Please read the License Agreement in the manual "); gprintf (&x,&y,"for more information."); getkey(); Calculate(); } if ((c==119)||(c==87)) //if W or w { StatusLine( "Esc to abort..." ); setfillstyle (1,7); bar (90,60, 550,385); //draw input box setcolor (5); //black line (90,385, 550,385); line (91,384, 549,384); line (550,385, 550,60); line (549,384, 549,61); setcolor (15); //white line (90,385, 90,60); line (91,384, 91,61); line (90,60, 550,60); line (91,61, 549,61); setcolor (14); settextjustify( CENTER_TEXT, CENTER_TEXT ); x=320, y=80; gprintf (&x,&y,"This will calculate the"); gprintf (&x,&y,"Weight of an arrow without a point installed"); gprintf (&x,&y,"by using a point of known weight."); gprintf (&x,&y," "); // gprintf (&x,&y," "); setcolor (5); gprintf (&x,&y,"Enter the weight of point you are using"); // gprintf (&x,&y," "); setfillstyle (1, 8); bar (273,130, 367,146); //draw the box for input inside the input box setcolor (15); //black line (273,146, 367,146); line (367,146, 367,130); setcolor (5); //white line (273,146, 273,130); line (273,130, 367,130); x=298; setcolor (15); //white numbers_only(); f=atof (string); strcpy(string, "\0"); //copy "0" into string to reset it for the next numbers_only if (test==8745) //if the enter key {test=0; //reset the text varible to be ready for the next one temp1=f; setcolor (5); //black settextjustify( CENTER_TEXT, CENTER_TEXT ); x=320; gprintf (&x,&y," "); gprintf (&x,&y," "); gprintf (&x,&y,"Enter the balance position without the point installed"); gprintf (&x,&y,"(where point and arrow would meet to balance position)"); bar (273,179, 367,195); setcolor (5); //black line (273,195, 273,179); line (273,179, 367,179); setcolor (15); //white line (273,195, 367,195); line (367,195, 367,179); x=298; numbers_only(); f=atof (string); strcpy(string, "\0"); //copy "0" into string to reset it for the next numbers_only if (test==8745) //if the enter key {test=0; temp2=f; setcolor (5); //black settextjustify( CENTER_TEXT, CENTER_TEXT ); x=320; gprintf (&x,&y," "); gprintf (&x,&y," "); gprintf (&x,&y,"Enter the balance position with the point installed"); gprintf (&x,&y,"(where point and arrow meet to balance position)"); bar (273,228, 367,244); setcolor (5); //black line (273,244, 273,228); line (273,228, 367,228); setcolor (15); //white line (273,244, 367,244); line (367,244, 367,228); x=298; numbers_only(); f=atof (string); strcpy(string, "\0"); //copy "0" into string to reset it for the next numbers_only if (test==8745) //if the enter key {test=0; temp3=f; setcolor (5); //black settextjustify( CENTER_TEXT, CENTER_TEXT ); x=320; gprintf (&x,&y," "); gprintf (&x,&y," "); gprintf (&x,&y,"Enter the balance position of the point (point only)"); gprintf (&x,&y,"measured from seating shoulder on the point to"); gprintf (&x,&y,"balance position of the point"); bar (273,287, 367,303); setcolor (5); //black line (273,303, 273,287); line (273,287, 367,287); setcolor (15); //white line (273,303, 367,303); line (367,303, 367,287); x=298; numbers_only(); f=atof (string); strcpy(string, "\0"); //copy "0" into string to reset it for the next numbers_only //if ((test==8745)&&(f!=0)) //if the enter key and if f has something in it do this if (test==8745) {test=0; temp4=f; temp5= (temp1*(temp3+temp4)) / ((temp2+temp4)-(temp3+temp4)); x=320; setcolor (14); gprintf (&x,&y," "); gprintf (&x,&y," "); gprintf (&x,&y,"The weight of the arrow without the point installed is:"); setcolor (14); gprintf(&x,&y,"%.4f Grains",temp5); gprintf (&x,&y," "); gprintf (&x,&y," "); setcolor (4); gprintf(&x,&y,"Would you like these numbers placed"); gprintf(&x,&y,"into the main screen? Y N"); YN=getch(); if ((YN=='Y')||(YN=='y')) {balancewithoutpoint=temp2; balancewithpoint=temp3; balanceofpoint=temp4; weightofarrow=temp5; testfortitle=0; } }}}} Calculate(); } if ((c==80)||(c==112)) //if P or p keys { overr: driverthere=0; StatusLine( "Esc to abort..." ); setfillstyle (1, 7); bar (180,150, 460,260); setcolor (15); line (180,260, 180,150); line (181,259, 181,151); line (180,150, 460,150); line (181,151, 459,151); setcolor (5); line (180,260, 460,260); line (181,259, 459,259); line (460,260, 460,150); line (459,259, 459,151); x=320,y=175; settextjustify( CENTER_TEXT, CENTER_TEXT ); setcolor (14); gprintf(&x,&y,"Select the type of print"); x=235,y=210; settextjustify( LEFT_TEXT, CENTER_TEXT ); setcolor (5); gprintf(&x,&y,"1. Text printout"); gprintf(&x,&y,""); gprintf(&x,&y,"2. Graphic printout"); y=210; setcolor (4); gprintf(&x,&y,"1. "); gprintf(&x,&y,""); gprintf(&x,&y,"2. "); do {answer=getkey(); if (answer==ESC) { goto done; } if (answer==49) //the 1 key jingle: {strcpy(port_name, "LPT1"); //the default if there is a port.cfg file this will be over written prnt.setf(ios::fixed, ios::floatfield); //make the prnt print out float that don't turn into exponentes stream=fopen("port.cfg", "r"); if(stream) {fgets (port_name, 50, stream); fclose(stream);} // if (!stream) setfillstyle (1, 7); bar (182,152, 458,258); settextjustify( CENTER_TEXT, CENTER_TEXT ); x=324,y=165; setcolor (14); gprintf(&x,&y,"About to print on port %s",port_name); setcolor (5); gprintf(&x,&y," "); gprintf(&x,&y,"Make sure your printer has"); gprintf(&x,&y,"paper and is ON LINE"); // gprintf(&x,&y," "); gprintf(&x,&y," "); gprintf(&x,&y," "); setcolor (14); settextjustify(LEFT_TEXT, CENTER_TEXT ); x=235; gprintf(&x,&y,"P to begin printing"); gprintf(&x,&y,"S to select another port"); gprintf(&x,&y,"ESC to abort"); setcolor (4); y=215; gprintf(&x,&y," "); gprintf(&x,&y,"P "); gprintf(&x,&y,"S "); gprintf(&x,&y,"ESC "); askagain: answer3=getkey(); if ((answer3!=ESC)&&(answer3!=83)&&(answer3!=115)&&(answer3!=80)&&(answer3!=112)) {goto askagain;} if (answer3==ESC) {goto done;} if ((answer3==83)||(answer3==115)) //s or S { setfillstyle (1, 7); bar (182,152, 458,258); x=320,y=165; settextjustify(CENTER_TEXT, CENTER_TEXT ); setcolor (14); gprintf(&x,&y,"Select a port"); gprintf(&x,&y," "); setcolor (5); gprintf(&x,&y,"1. LPT1"); gprintf(&x,&y,"2. LPT2"); gprintf(&x,&y,"3. LPT3"); gprintf(&x,&y,"4. LPT4"); gprintf(&x,&y," "); gprintf(&x,&y," "); setcolor (14); gprintf(&x,&y,"ESC to abort"); setcolor (4); y=185; gprintf(&x,&y,"1. "); gprintf(&x,&y,"2. "); gprintf(&x,&y,"3. "); gprintf(&x,&y,"4. "); gprintf(&x,&y," "); gprintf(&x,&y," "); gprintf(&x,&y,"ESC "); do {answer4=getkey(); if (answer4==49) //1 key {fp_port.open("port.cfg", ios::out); if (!fp_port) {cout<<"\n*** Cannot create port.cfg";} fp_port<<"LPT1"; fp_port.close(); goto jingle;} if (answer4==50) //1 key {fp_port.open("port.cfg", ios::out); if (!fp_port) {cout<<"\n*** Cannot create port.cfg";} fp_port<<"LPT2"; fp_port.close(); goto jingle;} if (answer4==51) //1 key {fp_port.open("port.cfg", ios::out); if (!fp_port) {cout<<"\n*** Cannot create port.cfg";} fp_port<<"LPT3"; fp_port.close(); goto jingle;} if (answer4==52) //1 key {fp_port.open("port.cfg", ios::out); if (!fp_port) {cout<<"\n*** Cannot create port.cfg";} fp_port<<"LPT4"; fp_port.close(); goto jingle;} if (answer4==ESC) {goto jingle;} }while ((answer4!=ESC)&&(answer4!=49)&&(answer4!=50)&&(answer4!=51)&&(answer4!=52)); } //end of if the s key to select status = biosprint(2,abyte,0); //LPT1 status2 = biosprint(2,abyte,1); //LPT2 status3 = biosprint(2,abyte,2); //LPT3 status4 = biosprint(2,abyte,3); //LPT4 if ((status!=144)&&(status2!=144)&&(status3!=144)&&(status4!=144)) {setfillstyle (1, 7); bar (182,152, 458,258); x=320,y=194; settextjustify( CENTER_TEXT, CENTER_TEXT ); gprintf(&x,&y,"I/O error on your printer port"); gprintf(&x,&y," "); gprintf(&x,&y,"press any key to continue"); darn=getkey(); goto jingle;} prnt.open(port_name, ios::out); if (testfortitle==0) {prnt<<"\t\t*** Untitled ***\n";} if (testfortitle==1) {prnt<<"\t"<2)) //this was set on 7 before I added arrow make {y=y-10; x+=textwidth("H"); if (in_char == '\n') {x=holdx; y+=25; // gprintf(&x,&y," "); goto here;} gprintf(&x,&y,"%c",in_char); } // cout<25) {liney=25, y=25;} goto update;} if (G==UPARROW) { y=liney+15; if (y>25) {liney=25, y=25;} goto update;} if (G==PAGEDOWN) { y=liney-255; if (y>25) {liney=25, y=25;} goto update;} if (G==PAGEUP) { y=liney+255; if (y>25) {liney=25, y=25;} goto update;} if ((G==115)||(G==83)) //if s or S key { // setviewport( 0, 0, MaxX, MaxY, 1 ); // setviewport( 102,83 ,540,365, 1 ); char userdescription [50]; settextjustify( CENTER_TEXT, CENTER_TEXT ); StatusLine( "Esc to abort..." ); setfillstyle (1,7); bar (92,373, 548,383); setcolor (14); settextjustify( CENTER_TEXT, CENTER_TEXT ); x=320,y=379; gprintf(&x,&y,"*** Enter a description for the arrow ***"); setfillstyle (1,8); bar (120,357, 520,369); setcolor(5); line (120,357, 120,369); line (120,357, 520,357); setcolor(15); line (120,369, 520,369); line (520,369, 520,357); setcolor (15); x=131,y=355; test99=0; letters_numbers(); x=30; y=liney; if (test99==1) //test to see if they backspace more than two times backwards from the starting place (or the ESC key) {test99=0; goto junk;} fp.open("SAVEARW.DTA", ios::app); fp< (numberoftitles-1))||(f < 0)) //numberoftitles-1 because it adds one to many because of the line return on the last line without any thing else on the line {goto getanother;} if (test==8745) //if the enter key {test=0; count=0; tempA=f; fp_in.open("SAVEARW.DTA", ios::in); if (!fp_in) {cout<<"\n*** Cannot open file ***\n";} while (fp_in.get (in_char)) { if (in_char == '\n') {ctr=0; count++; if (count==1) {goto skip;} while (fp_in.get (in_char)&&(ctr!=21)) //this was 6 before I added arrow make //loop through skiping the floats so count will only cout on titles {if (in_char == '\n') {ctr++;} } //end of if } //end of 2nd while skip: if (count==tempA) { fp_in.seekg(-1L, ios::cur); fp_in>>FOC>>balancewithoutpoint>>A>>weightofarrow>>lengthofpoint>>balanceofpoint; fp_in>>perinch>>lengthofshaft>>insertweight>>insertlength>>insertbalance>>insertplacement>>fletchweight>>fletchlength>>fletchbalance>>fletchplacement>>glueweight>>nockweight>>nocklength>>nockbalance>>nockplacement; fp_in.close();} } title_name(); testfortitle=1; skipmenuredraw=1; Calculate(); skipmenuredraw=0; setfillstyle (1,7); bar (25,325, 270,410); //draw input box setcolor (5); rectangle (25,325, 270,410); //draw border around input box line (26,409, 269,409); line (269,409, 269,326); setcolor (15); //white line (25,409, 25, 325); line (26,408, 26,325); line (270,325, 25,325); line (26,326, 269,326); setcolor (5); // x=148, y=357; x=148, y=340; settextjustify( CENTER_TEXT, CENTER_TEXT ); gprintf(&x,&y,"Ideal point weight"); gprintf(&x,&y,"for this configuration is"); setcolor (14); gprintf(&x,&y," "); gprintf(&x,&y,"%.0f Grains",pointweight); setcolor (4); gprintf(&x,&y," "); gprintf(&x,&y," "); gprintf(&x,&y,"Press any key to continue"); Pause(); Calculate(); break; } //end of if the enter key else { setfillstyle (1,7); bar (92,373, 548,383); setfillstyle (1,3); bar (284,357, 355,369); setcolor (5); settextjustify( CENTER_TEXT, CENTER_TEXT ); x=320; y=379; gprintf(&x,&y," ave pen elete"); setcolor (RED); x=320; y=379; gprintf(&x,&y,"S O D "); StatusLine( "Up & Down arrow keys PgUp PgDn Esc to abort..." ); } } //end of if O or o (open file) if ((G!=PAGEUP)&&(G!=PAGEDOWN)&&(G!=UPARROW)&&(G!=DOWNARROW)&&(G!=ESC)&&(G!=79)&&(G!=111)&&(G!=115)&&(G!=83)) {cout<<"\a"; } //beep } //inside end of do loop (to get G characters) while (G!=ESC); if (G==ESC) { Calculate();} }//end of funtion (F for file that is) if ((c==9)||(c==32)||(c==DOWNARROW)) //if Tab key or space { setcolor (11); position=position++; settextjustify( LEFT_TEXT, CENTER_TEXT ); if (position==7) {position=1;} if (position==1) {setfillstyle (1, RED); //draw the highlight cursor bar (358,328, 599,337); x=360,y=333; gprintf(&x,&y,"Front of Center percent"); setfillstyle (1, BLUE); bar (358,403, 599,412); x=360,y=408; gprintf(&x,&y,"Balance position of point");} if (position==2) {setfillstyle (1, RED); bar (358,342, 599,351); x=360,y=347; gprintf(&x,&y,"Balance position without point"); setfillstyle (1, BLUE); bar (358,328, 599,337); x=360,y=333; gprintf(&x,&y,"Front of Center percent");} if (position==3) {setfillstyle (1, RED); bar (358,358, 599,367); x=360,y=363; gprintf(&x,&y,"Length of arrow without point"); setfillstyle (1, BLUE); bar (358,342, 599,351); x=360,y=347; gprintf(&x,&y,"Balance position without point");} if (position==4) {setfillstyle (1, RED); bar (358,373, 599,382); x=360,y=378; gprintf(&x,&y,"Weight of arrow without point"); setfillstyle (1, BLUE); bar (358,358, 599,367); x=360,y=363; gprintf(&x,&y,"Length of arrow without point");} if (position==5) {setfillstyle (1, RED); bar (358,388, 599,397); x=360,y=393; gprintf(&x,&y,"Length of point"); setfillstyle (1, BLUE); bar (358,373, 599,382); x=360,y=378; gprintf(&x,&y,"Weight of arrow without point");} if (position==6) {setfillstyle (1, RED); bar (358,403, 599,412); x=360,y=408; gprintf(&x,&y,"Balance position of point"); setfillstyle (1, BLUE); bar (358,388, 599,397); x=360,y=393; gprintf(&x,&y,"Length of point");} } if (c==UPARROW) //if Tab key or space {setcolor (11); position=position-1; settextjustify( LEFT_TEXT, CENTER_TEXT ); if (position==0) {position=6;} if (position==1) {setfillstyle (1, RED); //draw the highlight cursor bar (358,328, 599,337); x=360,y=333; gprintf(&x,&y,"Front of Center percent"); setfillstyle (1, BLUE); bar (358,342, 599,351); x=360,y=347; gprintf(&x,&y,"Balance position without point");} if (position==2) {setfillstyle (1, RED); bar (358,342, 599,351); x=360,y=347; gprintf(&x,&y,"Balance position without point"); setfillstyle (1, BLUE); bar (358,358, 599,367); x=360,y=363; gprintf(&x,&y,"Length of arrow without point");} if (position==3) {setfillstyle (1, RED); bar (358,358, 599,367); x=360,y=363; gprintf(&x,&y,"Length of arrow without point"); setfillstyle (1, BLUE); bar (358,373, 599,382); x=360,y=378; gprintf(&x,&y,"Weight of arrow without point");} if (position==4) {setfillstyle (1, RED); bar (358,373, 599,382); x=360,y=378; gprintf(&x,&y,"Weight of arrow without point"); setfillstyle (1, BLUE); bar (358,388, 599,397); x=360,y=393; gprintf(&x,&y,"Length of point");} if (position==5) {setfillstyle (1, RED); bar (358,388, 599,397); x=360,y=393; gprintf(&x,&y,"Length of point"); setfillstyle (1, BLUE); bar (358,403, 599,412); x=360,y=408; gprintf(&x,&y,"Balance position of point");} if (position==6) {setfillstyle (1, RED); bar (358,403, 599,412); x=360,y=408; gprintf(&x,&y,"Balance position of point"); setfillstyle (1, BLUE); bar (358,328, 599,337); x=360,y=333; gprintf(&x,&y,"Front of Center percent");} } if ((c!=F1)&&(c!=ESC)&&(c!=32)&&(c!=27)&&(c!=104)&&(c!=72)&&(c!=101)&&(c!=69)&&(c!=99)&&(c!=67)&&(c!=97)&&(c!=65)&&(c!=113)&&(c!=81)&&(c!=9)&(c!=13)&&(c!=102)&&(c!=70)&&(c!=DOWNARROW)&&(c!=80)&&(c!=112)&&(c!=77)&&(c!=109)&&(c!=UPARROW)&&(c!=119)&&(c!=87)) { cout<<"\a";} } while (c!=999); // goto dear;} } /* */ /* REPORTSTATUS: Report the current configuration of the system */ /* after the auto-detect initialization. */ /* */ void ReportStatus(void) { struct viewporttype viewinfo; /* Params for inquiry procedures*/ struct linesettingstype lineinfo; struct fillsettingstype fillinfo; struct textsettingstype textinfo; struct palettetype palette; char *driver, *mode; /* Strings for driver and mode */ int x, y; getviewsettings( &viewinfo ); getlinesettings( &lineinfo ); getfillsettings( &fillinfo ); gettextsettings( &textinfo ); getpalette( &palette ); x = 10; y = 4; MainWindow( "Status report after InitGraph" ); settextjustify( LEFT_TEXT, TOP_TEXT ); /* get current setting */ gprintf( &x, &y, "Graphics device : %-20s (%d)", driver, GraphDriver ); gprintf( &x, &y, "Graphics mode : %-20s (%d)", mode, GraphMode ); gprintf( &x, &y, "Screen resolution : ( 0, 0, %d, %d )", getmaxx(), getmaxy() ); gprintf( &x, &y, "Current view port : ( %d, %d, %d, %d )", viewinfo.left, viewinfo.top, viewinfo.right, viewinfo.bottom ); gprintf( &x, &y, "Clipping : %s", viewinfo.clip ? "ON" : "OFF" ); gprintf( &x, &y, "Current position : ( %d, %d )", getx(), gety() ); gprintf( &x, &y, "Colors available : %d", MaxColors ); gprintf( &x, &y, "Current color : %d", getcolor() ); gprintf( &x, &y, "Line style : %s", LineStyles[ lineinfo.linestyle ] ); gprintf( &x, &y, "Line thickness : %d", lineinfo.thickness ); gprintf( &x, &y, "Current fill style : %s", FillStyles[ fillinfo.pattern ] ); gprintf( &x, &y, "Current fill color : %d", fillinfo.color ); gprintf( &x, &y, "Current font : %s", Fonts[ textinfo.font ] ); gprintf( &x, &y, "Text direction : %s", TextDirect[ textinfo.direction ] ); gprintf( &x, &y, "Character size : %d", textinfo.charsize ); gprintf( &x, &y, "Horizontal justify : %s", HorizJust[ textinfo.horiz ] ); gprintf( &x, &y, "Vertical justify : %s", VertJust[ textinfo.vert ] ); Pause(); /* Pause for user to read screen*/ } /* */ /* SAYGOODBYE: Give a closing screen to the user before leaving. */ /* */ void SayGoodbye(void) { struct viewporttype viewinfo; /* Structure to read viewport */ int h, w; MainWindow( "== Finale ==" ); getviewsettings( &viewinfo ); /* Read viewport settings */ changetextstyle( TRIPLEX_FONT, HORIZ_DIR, 4 ); settextjustify( CENTER_TEXT, CENTER_TEXT ); h = viewinfo.bottom - viewinfo.top; w = viewinfo.right - viewinfo.left; outtextxy( w/2, h/2, "That's all, folks!" ); StatusLine( "Press any key to EXIT" ); getch(); cleardevice(); /* Clear the graphics screen */ } /* */ /* PAUSE: Pause until the user enters a keystroke. If the */ /* key is an ESC, then exit program, else simply return. */ /* */ void Pause(void) { int c; int height = textheight( "H" ); static char msg[] = " " ; // if (testfortitle==2) // {static char msg[] = "*** Untitled ***";} // static char msg[] = "Press any key to continue..."; StatusLine( msg ); /* Put msg at bottom of screen */ if (testfortitle==0) { settextjustify( CENTER_TEXT, CENTER_TEXT ); setviewport( 0, 0, MaxX, MaxY, 1 ); x=320, y=474; setcolor (5); gprintf(&x,&y,"*** Untitled ***"); setviewport( 1, height+5, MaxX-1, MaxY-(height+5), 1 ); } if (testfortitle==1) { settextjustify( CENTER_TEXT, CENTER_TEXT ); setviewport( 0, 0, MaxX, MaxY, 1 ); x=320, y=474; setcolor (5); gprintf(&x,&y,"%s",titlename); setviewport( 1, height+5, MaxX-1, MaxY-(height+5), 1 ); } c = getch(); /* Read a character from kbd */ // if( ESC == c ){ /* Does user wish to leave? */ // closegraph(); /* Change to text mode */ // exit( 1 ); /* Return to OS */ // } // if( 0 == c ){ /* Did use hit a non-ASCII key? */ /* Read scan code for keyboard */ // } // cleardevice(); /* Clear the screen */ } /* */ /* MAINWINDOW: Establish the main window for the demo and set */ /* a viewport for the demo code. */ /* */ void MainWindow( char *header ) { int height; cleardevice(); /* Clear graphics screen */ // setcolor( MaxColors - 1 ); /* Set current color to white */ setfillstyle (1,7); bar (0,0, 639,12); setcolor (15); line (0,0, 639,0); setcolor (5); setviewport( 0, 0, MaxX, MaxY, 1 ); /* Open port to full screen */ height = textheight( "H" ); /* Get basic text height */ changetextstyle( DEFAULT_FONT, HORIZ_DIR, 1 ); settextjustify( CENTER_TEXT, TOP_TEXT ); outtextxy( MaxX/2, 3, header ); setviewport( 0, height+4, MaxX, MaxY-(height+4), 1 ); DrawBorder(); setviewport( 1, height+5, MaxX-1, MaxY-(height+5), 1 ); } /* */ /* STATUSLINE: Display a status line at the bottom of the screen. */ /* */ void StatusLine( char *msg ) { int height; setviewport( 0, 0, MaxX, MaxY, 1 ); /* Open port to full screen */ //setcolor( MaxColors - 1 ); /* Set current color to white */ setcolor (5); changetextstyle( DEFAULT_FONT, HORIZ_DIR, 1 ); settextjustify( CENTER_TEXT, TOP_TEXT ); setlinestyle( SOLID_LINE, 0, NORM_WIDTH ); // setfillstyle( EMPTY_FILL, 0 ); setfillstyle (1,7); height = textheight( "H" ); /* Detemine current height */ bar( 0, MaxY-(height+4), MaxX, MaxY ); // rectangle( 0, MaxY-(height+4), MaxX, MaxY ); setcolor (15); // line (0,MaxY, 0,MaxY-(height+4)); line (0,MaxY-(height+4), MaxX,MaxY-(height+4)); // setcolor (5); // line (MaxX,MaxY-(height+4), MaxX,MaxY); // line (MaxX,MaxY, 0,MaxY); setcolor (4); outtextxy( MaxX/2, MaxY-(height+1), msg ); setviewport( 1, height+5, MaxX-1, MaxY-(height+5), 1 ); } /* */ /* DRAWBORDER: Draw a solid single line around the current */ /* viewport. */ /* */ void DrawBorder(void) { struct viewporttype vp; setcolor( MaxColors - 1 ); /* Set current color to white */ setlinestyle( SOLID_LINE, 0, NORM_WIDTH ); getviewsettings( &vp ); rectangle( 0, 0, vp.right-vp.left, vp.bottom-vp.top ); setcolor (5); line (0,0, vp.right-vp.left,0); // line (0,0, 0,vp.bottom-vp.top); } /* */ /* CHANGETEXTSTYLE: similar to settextstyle, but checks for */ /* errors that might occur whil loading the font file. */ /* */ void changetextstyle(int font, int direction, int charsize) { int ErrorCode; graphresult(); /* clear error code */ settextstyle(font, direction, charsize); ErrorCode = graphresult(); /* check result */ if( ErrorCode != grOk ){ /* if error occured */ closegraph(); printf(" Graphics System Error: %s\n", grapherrormsg( ErrorCode ) ); exit( 1 ); } } /* */ /* GPRINTF: Used like PRINTF except the output is sent to the */ /* screen in graphics mode at the specified co-ordinate. */ /* */ int gprintf( int *xloc, int *yloc, char *fmt, ... ) { va_list argptr; /* Argument list pointer */ char str[140]; /* Buffer to build sting into */ int cnt; /* Result of SPRINTF for return */ va_start( argptr, fmt ); /* Initialize va_ functions */ cnt = vsprintf( str, fmt, argptr ); /* prints string to buffer */ outtextxy( *xloc, *yloc, str); /* Send string in graphics mode */ *yloc += textheight( "H" ) + 2; /* Advance to next line */ va_end( argptr ); /* Close va_ functions */ return( cnt ); /* Return the conversion count */ } int getkey(void) /* Uses the BIOS to read the next keyboard character */ { int key, lo, hi; key = bioskey(0); lo = key & 0X00FF; hi = (key & 0XFF00) >> 8; return((lo == 0) ? hi + 256 : lo); } /* getkey */ //*************************************** void numbers_only(void) //function to input just a few numbers { int c; int counter=0; int holdheight; holdheight=y+9; //this and the next line are to position the numbers in the box //x=123; test=0; donothing: while (counter < 50) //it will never get to 50 the if just below stops it //when counter is up to 7 stop getting numbers (if it reaches 7 numbers it will just end and nothing will be in the string) just like hitting ESC. { // strcpy(string, "0"); x+=textwidth("H"); y=holdheight; c = getch(); // if ((counter>7)||(c==BS)) if ((counter>7)&&(c!=BS)) //only let it get 7 numbers then when you type a number it does nothing {x-=textwidth("H"); if (c==ESC) {break;} if (c==13) //the enter key {test=8745; break;} goto donothing;} // if (c==BS) // {counter-=1; } // x-=textwidth("H");} if ((c<48)||(c>57)) {x-=textwidth("H");} if ((c>=48)&&(c<=57)||(c==46)||(c==45)) //or the - key //if the input keys are any of the number keys (or a "." or the enter key (13)) find out what they are and add the to the string. {counter++; // if (counter==8) // {break;} // if (c==45) // { x+=textwidth("H"); // strcat (string, "-"); // gprintf(&x,&y,"-");} if (c==48) {strcat (string, "0"); c=0;} //the c= are for displaying the input with the cout and the bottom of this loop. if (c==49) {strcat (string, "1"); c=1;} if (c==50) {strcat (string, "2"); c=2;} if (c==51) {strcat (string, "3"); c=3;} if (c==52) {strcat (string, "4"); c=4;} if (c==53) {strcat (string, "5"); c=5;} if (c==54) {strcat (string, "6"); c=6;} if (c==55) {strcat (string, "7"); c=7;} if (c==56) {strcat (string, "8"); gprintf(&x,&y,"8");} // c=8;} if (c==57) {strcat (string, "9"); c=9;} if (c==46) //if the "." key { x+=textwidth("H"); strcat (string, "."); gprintf(&x,&y,".");} if (c==45) {x+=textwidth("H"); strcat (string,"-"); gprintf(&x,&y,"-");} if ((c!=46)&&(c!=56)&&(c!=45)) {gprintf(&x,&y,"%i",c);}} if ((c==13)&&(counter==0)) //in case the user just enters the enter key without inputing any numbers it will just continue to wait for another number {goto donothing;} if (c==ESC) { break;} if (c==13) //the enter key {test=8745; break;} if (c==BS) //the backspace key {setfillstyle (1, 8); bar (x-3,y-4, x+3,y+2); //draw a bar over the previous number to cover it up if (counter==1) {string[0]='\0';} if (counter==2) {string[1]='\0';} if (counter==3) {string[2]='\0';} if (counter==4) {string[3]='\0';} if (counter==5) {string[4]='\0';} if (counter==6) {string[5]='\0';} if (counter==7) {string[6]='\0';} if (counter==8) {string[7]='\0';} x-=textwidth("H"); //set the text back one space counter-=1; if (counter<-1) //will let you backspace one back from where the starting place then. If any more than that this funtion will end {break;} } } //end of the while loop } //end of this function void count_titles(void) //count the titles in save file { FILE *stream; char in_char; int ccc=0; numberoftitles=0; stream = fopen("SAVEARW.DTA", "r+"); //open the file if (!stream) {cout<<"\n*** Cannot open file ***\n";} zzzz: while (in_char = getc(stream)) {if (in_char == '\n') {ccc++;} if (in_char==EOF) //if end of file break this while loop {break;} if ((ccc==1)||((ccc%22)==0)&&(ccc>2)) //ccc% 7 before i added arrow make {if (in_char=='\n') {numberoftitles++; } } } fclose (stream); //close stream } void title_name(void) //get the name of the opened arrow file { char in_char; int count; int ctr; count=1; fp_in.open("SAVEARW.DTA", ios::in); if (!fp_in) {cout<<"\n*** Cannot open file ***\n";} if (tempA==1) { goto skip2;} while (count != tempA) // {if (in_char=='\n') // {count++;} { fp_in.get (in_char); if (in_char == '\n') {ctr=0; count++; while (fp_in.get (in_char)&&(ctr!=21)) //this was on 6 before I added arrow make//loop through skiping the floats so count will only cout on titles { if (in_char == '\n') {ctr++; if (ctr==21) //this was on 6 before I added arrow make { break;} } } } } skip2: int counting=0; // fflush(stdin); // stpcpy(titlename, "0"); // fflush(stdin); // titlename[0]='\0'; titlename[1]='\0'; titlename[2]='\0'; titlename[3]='\0'; titlename[4]='\0'; titlename[5]='\0'; titlename[6]='\0'; titlename[7]='\0'; titlename[8]='\0'; titlename[9]='\0'; titlename[10]='\0'; titlename[11]='\0'; titlename[12]='\0'; titlename[13]='\0'; titlename[14]='\0'; titlename[15]='\0'; titlename[16]='\0'; titlename[17]='\0'; titlename[18]='\0'; titlename[19]='\0'; titlename[20]='\0'; titlename[21]='\0'; titlename[22]='\0'; titlename[23]='\0'; titlename[24]='\0'; titlename[25]='\0'; titlename[26]='\0'; titlename[27]='\0'; titlename[28]='\0'; titlename[29]='\0'; titlename[30]='\0'; titlename[31]='\0'; titlename[32]='\0'; titlename[33]='\0'; titlename[34]='\0'; titlename[35]='\0'; titlename[36]='\0'; titlename[37]='\0'; titlename[38]='\0'; titlename[39]='\0'; titlename[40]='\0'; titlename[41]='\0'; titlename[42]='\0'; titlename[43]='\0'; titlename[44]='\0'; titlename[45]='\0'; titlename[46]='\0'; titlename[47]='\0'; titlename[48]='\0'; titlename[49]='\0'; while (fp_in.get (in_char)) { if (in_char== '\n') {break;} counting++; switch (counting) {case (1): {titlename[0]=in_char; break;} case (2): {titlename[1]=in_char; break;} case (3): {titlename[2]=in_char; break;} case (4): {titlename[3]=in_char; break; } case (5): {titlename[4]=in_char; break;} case (6): {titlename[5]=in_char; break;} case (7): {titlename[6]=in_char; break;} case (8): {titlename[7]=in_char; break;} case (9): {titlename[8]=in_char; break;} case (10): {titlename[9]=in_char; break;} case (11): {titlename[10]=in_char; break;} case (12): {titlename[11]=in_char; break;} case (13): {titlename[12]=in_char; break;} case (14): {titlename[13]=in_char; break;} case (15): {titlename[14]=in_char; break;} case (16): {titlename[15]=in_char; break;} case (17): {titlename[16]=in_char; break;} case (18): {titlename[17]=in_char; break;} case (19): {titlename[18]=in_char; break;} case (20): {titlename[19]=in_char; break;} case (21): {titlename[20]=in_char; break;} case (22): {titlename[21]=in_char; break;} case (23): {titlename[22]=in_char; break;} case (24): {titlename[23]=in_char; break;} case (25): {titlename[24]=in_char; break;} case (26): {titlename[25]=in_char; break;} case (27): {titlename[26]=in_char; break;} case (28): {titlename[27]=in_char; break;} case (29): {titlename[28]=in_char; break;} case (30): {titlename[29]=in_char; break;} case (31): {titlename[30]=in_char; break;} case (32): {titlename[31]=in_char; break;} case (33): {titlename[32]=in_char; break;} case (34): {titlename[33]=in_char; break;} case (35): {titlename[34]=in_char; break;} case (36): {titlename[35]=in_char; break;} case (37): {titlename[36]=in_char; break;} case (38): {titlename[37]=in_char; break;} case (39): {titlename[38]=in_char; break;} case (40): {titlename[39]=in_char; break;} case (41): {titlename[40]=in_char; break;} case (42): {titlename[41]=in_char; break;} case (43): {titlename[42]=in_char; break;} case (44): {titlename[43]=in_char; break;} case (45): {titlename[44]=in_char; break;} case (46): {titlename[45]=in_char; break;} case (47): {titlename[46]=in_char; break;} case (48): {titlename[47]=in_char; break;} case (49): {titlename[48]=in_char; break;} case (50): {titlename[49]=in_char; break;} } } fp_in.close(); } //*************************************** void letters_numbers(void) //function to input just a few numbers { int c; int counter=0; int holdheight; holdheight=y+9; //this and the next line are to position the numbers in the box //x=123; test=0; strcpy(stringz, "\0"); //copy "0" into string to reset it for the next numbers_only donothing: while (counter < 100) { // strcpy(string, "0"); x+=textwidth("H"); y=holdheight; c = getch(); if ((c<32)||(c>125)) //set x back one space if it was a chacter that can not be printed {x-=textwidth("H");} if ((c>=32)&&(c<=125)) //if the input keys are any printable characters and a space #32 {counter++; if (counter==49) //when counter is up to 49 stop getting numbers (if it reaches 7 numbers it will just end and nothing will be in the string) just like hitting ESC. {counter-=1; x-=textwidth("H"); goto donothing;} // if (counter==49) // {break;} if (c==32) //this is the space {strcat (stringz, " ");} if (c==33) {strcat (stringz, "!");} if (c==34) {strcat (stringz, "\"");} if (c==35) {strcat (stringz, "#");} if (c==36) {strcat (stringz, "$");} if (c==37) {strcat (stringz, "%");} if (c==38) {strcat (stringz, "&");} if (c==39) {strcat (stringz, "'");} if (c==40) {strcat (stringz, "(");} if (c==41) {strcat (stringz, ")");} if (c==42) {strcat (stringz, "*");} if (c==43) {strcat (stringz, "+");} if (c==44) {strcat (stringz, "`");} if (c==45) {strcat (stringz, "-");} if (c==46) {strcat (stringz, ".");} if (c==47) {strcat (stringz, "/");} if (c==48) {strcat (stringz, "0");} if (c==49) {strcat (stringz, "1");} if (c==50) {strcat (stringz, "2");} if (c==51) {strcat (stringz, "3");} if (c==52) {strcat (stringz, "4");} if (c==53) {strcat (stringz, "5");} if (c==54) {strcat (stringz, "6");} if (c==55) {strcat (stringz, "7");} if (c==56) {strcat (stringz, "8");} if (c==57) {strcat (stringz, "9");} if (c==58) {strcat (stringz, ":");} if (c==59) {strcat (stringz, ";");} if (c==60) {strcat (stringz, "<");} if (c==61) {strcat (stringz, "=");} if (c==62) {strcat (stringz, ">");} if (c==63) {strcat (stringz, "?");} if (c==64) {strcat (stringz, "@");} if (c==65) {strcat (stringz, "A");} if (c==66) {strcat (stringz, "B");} if (c==67) {strcat (stringz, "C");} if (c==68) {strcat (stringz, "D");} if (c==69) {strcat (stringz, "E");} if (c==70) {strcat (stringz, "F");} if (c==71) {strcat (stringz, "G");} if (c==72) {strcat (stringz, "H");} if (c==73) {strcat (stringz, "I");} if (c==74) {strcat (stringz, "J");} if (c==75) {strcat (stringz, "K");} if (c==76) {strcat (stringz, "L");} if (c==77) {strcat (stringz, "M");} if (c==78) {strcat (stringz, "N");} if (c==79) {strcat (stringz, "O");} if (c==80) {strcat (stringz, "P");} if (c==81) {strcat (stringz, "Q");} if (c==82) {strcat (stringz, "R");} if (c==83) {strcat (stringz, "S");} if (c==84) {strcat (stringz, "T");} if (c==85) {strcat (stringz, "U");} if (c==86) {strcat (stringz, "V");} if (c==87) {strcat (stringz, "W");} if (c==88) {strcat (stringz, "X");} if (c==89) {strcat (stringz, "Y");} if (c==90) {strcat (stringz, "Z");} if (c==91) {strcat (stringz, "[");} if (c==92) {strcat (stringz, "\\");} if (c==93) {strcat (stringz, "]");} if (c==94) {strcat (stringz, "^");} if (c==95) {strcat (stringz, "-");} if (c==96) {strcat (stringz, "`");} if (c==97) {strcat (stringz, "a");} if (c==98) {strcat (stringz, "b");} if (c==99) {strcat (stringz, "c");} if (c==100) {strcat (stringz, "d");} if (c==101) {strcat (stringz, "e");} if (c==102) {strcat (stringz, "f");} if (c==103) {strcat (stringz, "g");} if (c==104) {strcat (stringz, "h");} if (c==105) {strcat (stringz, "i");} if (c==106) {strcat (stringz, "j");} if (c==107) {strcat (stringz, "k");} if (c==108) {strcat (stringz, "l");} if (c==109) {strcat (stringz, "m");} if (c==110) {strcat (stringz, "n");} if (c==111) {strcat (stringz, "o");} if (c==112) {strcat (stringz, "p");} if (c==113) {strcat (stringz, "q");} if (c==114) {strcat (stringz, "r");} if (c==115) {strcat (stringz, "s");} if (c==116) {strcat (stringz, "t");} if (c==117) {strcat (stringz, "u");} if (c==118) {strcat (stringz, "v");} if (c==119) {strcat (stringz, "w");} if (c==120) {strcat (stringz, "x");} if (c==121) {strcat (stringz, "y");} if (c==122) {strcat (stringz, "z");} if (c==123) {strcat (stringz, "{");} if (c==124) {strcat (stringz, "|");} if (c==125) {strcat (stringz, "}");} if (c==126) {strcat (stringz, "~");} gprintf(&x,&y,"%c",c);} if ((c==13)&&(counter==0)) //in case the user just enters the enter key without inputing any numbers it will just continue to wait for another number {goto donothing;} if (c==ESC) { test99=1; break;} if (c==13) //the enter key {test=8745; break;} if (c==BS) //the backspace key {setfillstyle (1, 8); bar (x-3,y-4, x+4,y+3); //draw a bar over the previous number to cover it up if (counter==1) {stringz[0]='\0';} if (counter==2) {stringz[1]='\0';} if (counter==3) {stringz[4]='\0';} if (counter==4) {stringz[3]='\0';} if (counter==5) {stringz[4]='\0';} if (counter==6) {stringz[5]='\0';} if (counter==7) {stringz[6]='\0';} if (counter==8) {stringz[7]='\0';} if (counter==9) {stringz[8]='\0';} if (counter==10) {stringz[9]='\0';} if (counter==11) {stringz[10]='\0';} if (counter==12) {stringz[11]='\0';} if (counter==13) {stringz[12]='\0';} if (counter==14) {stringz[13]='\0';} if (counter==15) {stringz[14]='\0';} if (counter==16) {stringz[15]='\0';} if (counter==17) {stringz[16]='\0';} if (counter==18) {stringz[17]='\0';} if (counter==19) {stringz[18]='\0';} if (counter==20) {stringz[19]='\0';} if (counter==21) {stringz[20]='\0';} if (counter==22) {stringz[21]='\0';} if (counter==23) {stringz[22]='\0';} if (counter==24) {stringz[23]='\0';} if (counter==25) {stringz[24]='\0';} if (counter==26) {stringz[25]='\0';} if (counter==27) {stringz[26]='\0';} if (counter==28) {stringz[27]='\0';} if (counter==29) {stringz[28]='\0';} if (counter==30) {stringz[29]='\0';} if (counter==31) {stringz[30]='\0';} if (counter==32) {stringz[31]='\0';} if (counter==33) {stringz[32]='\0';} if (counter==34) {stringz[33]='\0';} if (counter==35) {stringz[34]='\0';} if (counter==36) {stringz[35]='\0';} if (counter==37) {stringz[36]='\0';} if (counter==38) {stringz[37]='\0';} if (counter==39) {stringz[38]='\0';} if (counter==40) {stringz[39]='\0';} if (counter==41) {stringz[40]='\0';} if (counter==42) {stringz[41]='\0';} if (counter==43) {stringz[42]='\0';} if (counter==44) {stringz[43]='\0';} if (counter==45) {stringz[44]='\0';} if (counter==46) {stringz[45]='\0';} if (counter==47) {stringz[46]='\0';} if (counter==48) {stringz[47]='\0';} if (counter==49) {stringz[48]='\0';} if (counter==50) {stringz[49]='\0';} x-=textwidth("H"); //set the text back one space counter-=1; if (counter<-1) //will let you backspace one back from where the starting place then. If any more than that this funtion will end { test99=1; break;} } } //end of the while loop } //end of this function void redrawforprinting() //turn the screen black and white { int number; int x, y; int height; setviewport( 0, 0, MaxX, MaxY, 1 ); height = textheight( "H" ); struct viewporttype vp; struct PTS points[MAXPTS]; int i, j, h, w, xcenter, ycenter; int radius, angle, step; double rads; // MainWindow( "ARROW MASTER" ); // int height; cleardevice(); /* Clear graphics screen */ // setcolor( MaxColors - 1 ); /* Set current color to white */ setfillstyle (1,8); bar (0,468, 639,479); //bottom redraw bar (0,0, 639,12); //top redraw // setcolor (15); // line (0,0, 639,0); setcolor (15); setviewport( 0, 0, MaxX, MaxY, 1 ); /* Open port to full screen */ height = textheight( "H" ); /* Get basic text height */ changetextstyle( DEFAULT_FONT, HORIZ_DIR, 1 ); settextjustify( CENTER_TEXT, TOP_TEXT ); outtextxy( MaxX/2, 3, "ARROW MASTER" ); setviewport( 0, height+4, MaxX, MaxY-(height+4), 1 ); // DrawBorder(); setcolor( 8 ); /* Set current color to white */ setlinestyle( SOLID_LINE, 0, NORM_WIDTH ); getviewsettings( &vp ); rectangle( 0, 0, vp.right-vp.left, vp.bottom-vp.top ); setcolor (5); line (0,0, vp.right-vp.left,0); setviewport( 1, height+5, MaxX-1, MaxY-(height+5), 1 ); //getviewsettings( &vp ); //h = vp.bottom - vp.top; //h=479 //w = vp.right - vp.left; //w=639 //xcenter = w / 2; /* Determine the center of circle */ //ycenter = h / 2; //radius = (h - 30) / (AspectRatio * 2); // cout<<"GraphDriver = "<150) //if it cannot get it by now not it should be close so break out of the loop {break;} tailside=lengthofshaft-balancetry; pointside=balancetry; tailcount=tailside*100; pointcount=pointside*100; tailtemp=0; pointtemp=0; tailtemp+=((tailside-fletchplacementgravity)*100)*(fletchweight); pointtemp+=((pointside-insertplacementgravity)*100)*(insertweight); tailtemp+=((tailside-glueplacementgravity)*100)*(glueweight); tailtemp+=((tailside-nockplacementgravity)*100)*(nockweight); for (cTr=1;cTr<=tailcount;cTr++) {tailtemp+= (pertenth*cTr);} for (cTr=1;cTr<=pointcount;cTr++) {pointtemp+= (pertenth*cTr);} //cout<<"thinking"; sizedown: if ((pointtemp>20000)||(tailtemp>20000)) { pointtemp/=2; tailtemp/=2; if (pointtemp||tailtemp>20000) {goto sizedown; } } if (pointtemp>tailtemp) { difference=pointtemp-tailtemp; if (difference>5000) {balancetry-=1;} else if (difference>2500) {balancetry-=.125; } else if (difference>1250) {balancetry-=.0625; } else if (difference>200) {balancetry-=.0312;} else if (difference>50) {balancetry-=.020; } else if (difference>11) {balancetry-=.0005;} // else if (difference>5) // {balancetry-=.0001;} } if (pointtemp5000) {balancetry+=1; } else if (difference>2500) {balancetry+=.125;} else if (difference>1250) {balancetry+=.0625;} else if (difference>200) {balancetry+=.0312; } else if (difference>50) {balancetry+=.020;} else if (difference>11) {balancetry+=.0005;} // else if (difference>5) // {balancetry+=.0001; } } } while (difference >11); //cout <<"The balance position is at "<