コード例 #1
0
ファイル: main.c プロジェクト: johnnywell/NginText
int main(int argc, const char * argv[]) {
	char story_path[256];
	setbuf(stdout, NULL);
    //printf("Please inform the path to the story you want to play:\n> " );
	strcpy(story_path, "..\\NginText\\stories\\prototype.story");
	//gets(story_path);
	open_story(story_path);
    load_scene("@Inicio");
	system("pause");
    exit(0);
}
コード例 #2
0
ファイル: jzip.c プロジェクト: dschwen/jszip
int spinupJS( char *fname ) 
{
   open_story( fname );

   configure( V1, V8 );
#else
int main( int argc, char *argv[] )
{
   process_arguments( argc, argv );

   configure( V1, V8 );

   initialize_screen(  );
#endif

   load_cache(  );

   z_restart(  );

#ifdef EMSCRIPTEN
   interpreter_status = 1;
   return 0;
}
コード例 #3
0
ファイル: osdepend.c プロジェクト: spark404/jzip-zmachine
void process_arguments( int argc, char *argv[] )
{
   int c, errflg = 0;
   int infoflag = 0;
   int size;
   int expected_args;
   int num;

#ifdef STRICTZ
   /* Initialize the STRICTZ variables. */

   strictz_report_mode = STRICTZ_DEFAULT_REPORT_MODE;

   for ( num = 0; num < STRICTZ_NUM_ERRORS; num++ )
   {
      strictz_error_count[num] = 0;
   }
#endif /* STRICTZ */

   /* Parse the options */

   monochrome = 0;
   hist_buf_size = 1024;
   bigscreen = 0;

#ifdef STRICTZ                  
#if defined OS2 || defined __MSDOS__ 
#define GETOPT_SET "gbomvzhy?l:c:k:r:t:s:" 
#elif defined TURBOC            
#define GETOPT_SET   "bmvzhy?l:c:k:r:t:s:" 
#elif defined HARD_COLORS       
#define GETOPT_SET    "mvzhy?l:c:k:r:t:s:f:b:" 
#else 
#define GETOPT_SET    "mvzhy?l:c:k:r:t:s:" 
#endif 
#else 
#if defined OS2 || defined __MSDOS__ 
#define GETOPT_SET "gbomvzhy?l:c:k:r:t:" 
#elif defined TURBOC            
#define GETOPT_SET   "bmvzhy?l:c:k:r:t:" 
#elif defined HARD_COLORS       
#define GETOPT_SET    "mvzhy?l:c:k:r:t:f:b:" 
#else 
#define GETOPT_SET    "mvzhy?l:c:k:r:t:" 
#endif 
#endif 
   while ( ( c = getopt( argc, argv, GETOPT_SET ) ) != EOF )
   {                            
      switch ( c )
      {
         case 'l':             /* lines */
            screen_rows = atoi( optarg );
            break;
         case 'c':             /* columns */
            screen_cols = atoi( optarg );
            break;
         case 'r':             /* right margin */
            right_margin = atoi( optarg );
            break;
         case 't':             /* top margin */
            top_margin = atoi( optarg );
            break;
         case 'k':             /* number of K for hist_buf_size */
            size = atoi( optarg );
            hist_buf_size = ( hist_buf_size > size ) ? hist_buf_size : size;
            if ( hist_buf_size > 16384 )
               hist_buf_size = 16384;
            break;
         case 'y':             /* Tandy */
            fTandy = 1;         
            break;              
#if defined OS2 || defined __MSDOS__ 
         case 'g':             /* Beyond Zork or other games using IBM graphics */
            fIBMGraphics = 1;   
            break;              
#endif 
         case 'v':             /* version information */

            fprintf( stdout, "\nJZIP - An Infocom Z-code Interpreter Program \n" );
            fprintf( stdout, "       %s %s\n", JZIPVER, JZIPRELDATE );
            if ( STANDALONE_FLAG )
            {
               fprintf( stdout, "       Standalone game: %s\n", argv[0] );
            }
            fprintf( stdout, "---------------------------------------------------------\n" );
            fprintf( stdout, "Author          :  %s\n", JZIPAUTHOR );
            fprintf( stdout, "Official Webpage: %s\n", JZIPURL );
            fprintf( stdout, "IF Archive      : ftp://ftp.gmd.de/if-archive/interpreters/zip/\n" );
            fprintf( stdout, "         Based on ZIP 2.0 source code by Mark Howell\n\n" );
            fprintf( stdout,
                     "Bugs:    Please report bugs and portability bugs to the maintainer." );
            fprintf( stdout, "\n\nInterpreter:\n\n" );
            fprintf( stdout, "\tThis interpreter will run all Infocom V1 to V5 and V8 games.\n" );
            fprintf( stdout,
                     "\tThis is a Z-machine standard 1.0 interpreter, including support for\n" );
            fprintf( stdout, "\tthe Quetzal portable save file format, ISO 8859-1 (Latin-1)\n" );
            fprintf( stdout,
                     "\tinternational character support, and the extended save and load opcodes.\n" );
            fprintf( stdout, "\t\n" );
            infoflag++;
            break;
#if defined (HARD_COLORS)
         case 'f':
            default_fg = atoi( optarg );
            break;
         case 'b':
            default_bg = atoi( optarg );
            break;
#endif
#if defined OS2 || defined __MSDOS__ 
         case 'm':             /* monochrome */
            iPalette = 2;       
            break;              
         case 'b':             /* black-and-white */
            iPalette = 1;       
            break;              
         case 'o':             /* color */
            iPalette = 0;       
            break;              
#else 
         case 'm':
            monochrome = 1;
            break;
#endif 
#if defined TURBOC              
         case 'b':
            bigscreen = 1;
            break;
#endif 
#ifdef STRICTZ
         case 's':             /* strictz reporting mode */
            strictz_report_mode = atoi( optarg );
            if ( strictz_report_mode < STRICTZ_REPORT_NEVER ||
                 strictz_report_mode > STRICTZ_REPORT_FATAL )
            {
               errflg++;
            }
            break;
#endif /* STRICTZ */

         case 'z':
            print_license(  );
            infoflag++;
            break;

         case 'h':
         case '?':
         default:
            errflg++;
      }
   }

   if ( infoflag )
      exit( EXIT_SUCCESS );

   if ( STANDALONE_FLAG )
      expected_args = 0;
   else
      expected_args = 1;

   /* Display usage */

   if ( errflg || optind + expected_args != argc )
   {

      if ( STANDALONE_FLAG )
         fprintf( stdout, "usage: %s [options...]\n", argv[0] ); 
      else
         fprintf( stdout, "usage: %s [options...] story-file\n", argv[0] ); 

      fprintf( stdout, "JZIP - an Infocom story file interpreter.\n" );
      fprintf( stdout, "      Version %s by %s.\n", JZIPVER, JZIPAUTHOR );
      fprintf( stdout, "      Release %s.\n", JZIPRELDATE );
      fprintf( stdout, "      Based on ZIP V2.0 source by Mark Howell\n" );
      fprintf( stdout, "      Plays types 1-5 and 8 Infocom and Inform games.\n\n" );
      fprintf( stdout, "\t-l n lines in display\n" );
      fprintf( stdout, "\t-c n columns in display\n" );
      fprintf( stdout, "\t-r n text right margin (default = %d)\n", DEFAULT_RIGHT_MARGIN );
      fprintf( stdout, "\t-t n text top margin (default = %d)\n", DEFAULT_TOP_MARGIN );
      fprintf( stdout, "\t-k n set the size of the command history buffer to n bytes\n" );
      fprintf( stdout, "\t     (Default is 1024 bytes.  Maximum is 16384 bytes.)\n" );
      fprintf( stdout, "\t-y   turn on the legendary \"Tandy\" bit\n" ); 
      fprintf( stdout, "\t-v   display version information\n" );
      fprintf( stdout, "\t-h   display this usage information\n" );

#if defined (HARD_COLORS)
      fprintf( stdout, "\t-f n foreground color\n" );
      fprintf( stdout, "\t-b n background color (-1 to ignore bg color (try it on an Eterm))\n" );
      fprintf( stdout, "\t     Black=0 Red=1 Green=2 Yellow=3 Blue=4 Magenta=5 Cyan=6 White=7\n" );
#endif
      fprintf( stdout, "\t-m   force monochrome mode\n" ); 
#if defined __MSDOS__ || defined OS2 
      fprintf( stdout, "\t-b   force black-and-white mode\n" ); 
      fprintf( stdout, "\t-o   force color mode\n" ); 
      fprintf( stdout, "\t-g   use \"Beyond Zork\" graphics, rather than standard international\n" ); 
#elif defined TURBOC            
      fprintf( stdout, "\t-b   run in 43/50 line EGA/VGA mode\n" ); 
#endif 

#ifdef STRICTZ
      fprintf( stdout, "\t-s n stricter error checking (default = %d) (0: none; 1: report 1st\n",
               STRICTZ_DEFAULT_REPORT_MODE );
      fprintf( stdout, "\t     error; 2: report all errors; 3: exit after any error)\n" );
#endif /* STRICTZ */

      fprintf( stdout, "\t-z   display license information.\n" );
      exit( EXIT_FAILURE );
   }

   /* Open the story file */

   if ( !STANDALONE_FLAG )      /* mol 951115 */
      open_story( argv[optind] );
   else
   {
      /* standalone, ie. the .exe file _is_ the story file. */
      if ( argv[0][0] == 0 )
      {
         /* some OS's (ie DOS prior to v.3.0) don't supply the path to */
         /* the .exe file in argv[0]; in that case, we give up. (mol) */
         fatal( "process_arguments(): Sorry, this program will not run on this platform." );
      }
      open_story( argv[0] );
   }

}                               /* process_arguments */