int main(void) { static unsigned x; initprg(); initgame(); clrscr(); printf("Alpha test AR-Chess V 1.0\n" "Copyright November 30, 1992\n" "\nMr. Carey Bloodworth\n" "\nThis program may be freely\n" "copied and modified as long\n" "as my name is present as the\n" "original author.\n" "Sharp 7xx port: A.R. Pruss"); ozdelay64hz(200); /* ozsendscreen(); */ while (! quit) { if ( /* (breakpress) || */ (draw) || (mate) || ((tomove==human) && (!bothsides)) ) inputcommand(); printboard(); /* if (pvsflag) { currow=7; atright(); printf(pvsmsg); } */ if (status[0]) { currow=8; atright(); printf(status); } currow=6; atright(); printf(msg); if (! (quit || mate || draw)) selectmove(tomove); /* if (! breakpress) */ tomove=chngcolor(tomove); }; endprg(); return 0; }
int main( int argc, char* argv[] ) { /* char getprm = 0, isfile = 0;*/ int i; char command = 0, argument = -1; char file[256], file2[256], Error[256], *s; #ifdef __unix__ set_keypress(); #endif file[0] = 0; file2[0] = 0; ReturnVideoInfo = TEXTVER_ReturnVideoInfo; check_event = TEXTVER_check_event; Debug = TEXTVER_Debug; eol = TEXTVER_eol; QU_getline = TEXTVER_getline; putline = TEXTVER_putline; if( argc > 1 ) { if( strcmp( argv[1], "-z" ) == 0 ) { command = 1; /* calc a ZBuffer */ } else if( strcmp( argv[1], "-i" ) == 0 ) { command = 2; /* calc an image */ } else if( strcmp( argv[1], "-p" ) == 0 ) { command = 3; /* write parameters */ } else if( strcmp( argv[1], "-c" ) == 0 ) { command = 4; /* continue calculation */ } else if( strcmp( argv[1], "-h" ) == 0 ) { command = 5; /* help */ } } if( argc > 2 ) { strcpy( file, argv[2] ); if( strrchr( file, '.' ) ) { for( i = 0; i < strlen( file ); i++ ) { file[i] = tolower( ( int )file[i] ); } if( strcmp( strrchr( file, '.' ), ".ini" ) == 0 ) { argument = 1; /* ini file */ } else if( strcmp( strrchr( file, '.' ), ".png" ) == 0 ) { argument = 2; /* png file */ } else if( strcmp( strrchr( file, '.' ), ".zpn" ) == 0 ) { argument = 3; /* zpn file */ } else if( file[0] == 0 ) { argument = 0; } strcpy( file, argv[2] ); } } if( argc > 3 ) { strcpy( file2, argv[3] ); } switch( command ) { case 1: if( argument == 0 ) { printf( "You didn´t specify an ini-file.\nUse -h for help.\n" ); endprg(); return( -1 ); } if( argument != 1 ) { printf( "The file you specified has not the suffix '.ini', but it will be assumed to\n" ); printf( "be an ini file.\n" ); } ParseAndCalculate( file, Error, 1 ); break; case 2: if( argument == 1 ) { ParseAndCalculate( file, Error, 0 ); } else if( argument == 3 ) { ImgFromZBuf( file, file2, Error ); } else { printf( "You didn´t specify an ini- or zpn-file.\nUse -h for help.\n" ); endprg(); return( -1 ); } break; case 3: if( argument == 0 ) { printf( "No file given. Use -h for help.\n" ); endprg(); return( -1 ); } GetParameters( file, Error ); break; case 4: if( argument != 2 && argument != 3 ) { printf( "Given file is neither png nor zpn.\n" ); endprg(); return( -1 ); } if( argument == 2 ) { ParseAndCalculate( file, Error, 0 ); } if( argument == 3 ) { ParseAndCalculate( file, Error, 1 ); } break; case 5: strncpy( file, argv[0], 256 ); s = strrchr( file, '/' ); if( s == NULL ) { s = strrchr( file, '\\' ); } if( s == NULL ) { s = ( char* )&file[0]; } else { s++; } printf( "\n%s %s%s%s\n%s", PROGNAME, PROGVERSION, PROGSUBVERSION, PROGSTATE, "A 3d fractal generation program\n" ); printf( "Copyright (C) 1997-2002 Dirk Meyer\n" ); printf( "email: [email protected]\n" ); printf( "WWW: http://www.physcip.uni-stuttgart.de/phy11733/index_e.html\n" ); printf( "Mailing-List: http://groups.yahoo.com/group/quat/\n" ); printf( "\nThis program is distributed under the terms of the\n" ); printf( "GNU General Public License Version 2 (See file 'COPYING' for details)\n\n" ); printf( "-z <ini-file> begin calculation of a ZBuffer\n" ); printf( "-i [<ini-file> | <zpn-file> [& <ini-file>]]\n" ); printf( " begin calculation of an image [using an ini-file | a\n" ); printf( " ZBuffer [& replacing parameters from ini-file]]\n" ); printf( "-p <png- or zpn-file> read fractal parameters from image or ZBuffer and\n" ); printf( " write them to raw data (ini)\n" ); printf( "-c <png- or zpn-file> continue calculation of image or ZBuffer\n" ); printf( "-h Show help text\n" ); endprg(); return( 0 ); default: printf( "Didn't understand the given parameters. For help use -h\n" ); endprg(); return( -1 ); } if( Error[0] != 0 ) { printf( "%s\n", Error ); } endprg(); return( 0 ); }